From 21343bc3c1a1c472be5fe42e44a47bd557a35977 Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 3 Dec 2021 17:49:25 +0000 Subject: [PATCH 1/2] feat: Add WriteDisposition to BigQuery Export API PiperOrigin-RevId: 413945427 Source-Link: https://github.com/googleapis/googleapis/commit/6230f6eaf6c6c58f0a472434159d8b6abc10084b Source-Link: https://github.com/googleapis/googleapis-gen/commit/00cdef308d6d6ba4c75354de491da484f642bd80 Copy-Tag: eyJwIjoiLmdpdGh1Yi8uT3dsQm90LnlhbWwiLCJoIjoiMDBjZGVmMzA4ZDZkNmJhNGM3NTM1NGRlNDkxZGE0ODRmNjQyYmQ4MCJ9 --- owl-bot-staging/v1/.eslintignore | 7 + owl-bot-staging/v1/.eslintrc.json | 3 + owl-bot-staging/v1/.gitignore | 14 + owl-bot-staging/v1/.jsdoc.js | 55 + owl-bot-staging/v1/.mocharc.js | 33 + owl-bot-staging/v1/.prettierrc.js | 22 + owl-bot-staging/v1/README.md | 1 + owl-bot-staging/v1/linkinator.config.json | 10 + owl-bot-staging/v1/package.json | 64 + .../v1/contact_center_insights.proto | 970 +++++ .../contactcenterinsights/v1/resources.proto | 1086 +++++ ...er_insights.calculate_issue_model_stats.js | 53 + ...contact_center_insights.calculate_stats.js | 58 + ...contact_center_insights.create_analysis.js | 59 + ...act_center_insights.create_conversation.js | 66 + ...tact_center_insights.create_issue_model.js | 59 + ...t_center_insights.create_phrase_matcher.js | 61 + ...contact_center_insights.delete_analysis.js | 53 + ...act_center_insights.delete_conversation.js | 59 + ...tact_center_insights.delete_issue_model.js | 54 + ...t_center_insights.delete_phrase_matcher.js | 53 + ...tact_center_insights.deploy_issue_model.js | 54 + ...ct_center_insights.export_insights_data.js | 73 + .../contact_center_insights.get_analysis.js | 53 + ...ontact_center_insights.get_conversation.js | 57 + .../v1/contact_center_insights.get_issue.js | 53 + ...contact_center_insights.get_issue_model.js | 53 + ...tact_center_insights.get_phrase_matcher.js | 53 + .../contact_center_insights.get_settings.js | 53 + .../contact_center_insights.list_analyses.js | 73 + ...tact_center_insights.list_conversations.js | 77 + ...ntact_center_insights.list_issue_models.js | 53 + .../v1/contact_center_insights.list_issues.js | 53 + ...ct_center_insights.list_phrase_matchers.js | 73 + ...ct_center_insights.undeploy_issue_model.js | 54 + ...act_center_insights.update_conversation.js | 57 + .../contact_center_insights.update_issue.js | 57 + ...tact_center_insights.update_issue_model.js | 57 + ...t_center_insights.update_phrase_matcher.js | 57 + ...contact_center_insights.update_settings.js | 58 + owl-bot-staging/v1/src/index.ts | 25 + .../src/v1/contact_center_insights_client.ts | 3362 +++++++++++++++ ...contact_center_insights_client_config.json | 183 + .../contact_center_insights_proto_list.json | 4 + owl-bot-staging/v1/src/v1/gapic_metadata.json | 325 ++ owl-bot-staging/v1/src/v1/index.ts | 19 + .../system-test/fixtures/sample/src/index.js | 27 + .../system-test/fixtures/sample/src/index.ts | 32 + owl-bot-staging/v1/system-test/install.ts | 49 + .../test/gapic_contact_center_insights_v1.ts | 3736 +++++++++++++++++ owl-bot-staging/v1/tsconfig.json | 19 + owl-bot-staging/v1/webpack.config.js | 64 + 52 files changed, 11803 insertions(+) create mode 100644 owl-bot-staging/v1/.eslintignore create mode 100644 owl-bot-staging/v1/.eslintrc.json create mode 100644 owl-bot-staging/v1/.gitignore create mode 100644 owl-bot-staging/v1/.jsdoc.js create mode 100644 owl-bot-staging/v1/.mocharc.js create mode 100644 owl-bot-staging/v1/.prettierrc.js create mode 100644 owl-bot-staging/v1/README.md create mode 100644 owl-bot-staging/v1/linkinator.config.json create mode 100644 owl-bot-staging/v1/package.json create mode 100644 owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto create mode 100644 owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js create mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js create mode 100644 owl-bot-staging/v1/src/index.ts create mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_client.ts create mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json create mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json create mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json create mode 100644 owl-bot-staging/v1/src/v1/index.ts create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js create mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts create mode 100644 owl-bot-staging/v1/system-test/install.ts create mode 100644 owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts create mode 100644 owl-bot-staging/v1/tsconfig.json create mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore new file mode 100644 index 0000000..cfc348e --- /dev/null +++ b/owl-bot-staging/v1/.eslintignore @@ -0,0 +1,7 @@ +**/node_modules +**/.coverage +build/ +docs/ +protos/ +system-test/ +samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json new file mode 100644 index 0000000..7821534 --- /dev/null +++ b/owl-bot-staging/v1/.eslintrc.json @@ -0,0 +1,3 @@ +{ + "extends": "./node_modules/gts" +} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore new file mode 100644 index 0000000..5d32b23 --- /dev/null +++ b/owl-bot-staging/v1/.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/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js new file mode 100644 index 0000000..84ce5a5 --- /dev/null +++ b/owl-bot-staging/v1/.jsdoc.js @@ -0,0 +1,55 @@ +// 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. +// +// ** This file 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 2021 Google LLC', + includeDate: false, + sourceFiles: false, + systemName: '@google-cloud/contact-center-insights', + theme: 'lumen', + default: { + outputSourceFiles: false + } + }, + markdown: { + idInHeadings: true + } +}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js new file mode 100644 index 0000000..50bc7f7 --- /dev/null +++ b/owl-bot-staging/v1/.mocharc.js @@ -0,0 +1,33 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +const config = { + "enable-source-maps": true, + "throw-deprecation": true, + "timeout": 10000 +} +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/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js new file mode 100644 index 0000000..84f4713 --- /dev/null +++ b/owl-bot-staging/v1/.prettierrc.js @@ -0,0 +1,22 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + + +module.exports = { + ...require('gts/.prettierrc.json') +} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md new file mode 100644 index 0000000..eabc434 --- /dev/null +++ b/owl-bot-staging/v1/README.md @@ -0,0 +1 @@ +Contactcenterinsights: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json new file mode 100644 index 0000000..0121dfa --- /dev/null +++ b/owl-bot-staging/v1/linkinator.config.json @@ -0,0 +1,10 @@ +{ + "recurse": true, + "skip": [ + "https://codecov.io/gh/googleapis/", + "www.googleapis.com", + "img.shields.io" + ], + "silent": true, + "concurrency": 5 +} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json new file mode 100644 index 0000000..bcd35c1 --- /dev/null +++ b/owl-bot-staging/v1/package.json @@ -0,0 +1,64 @@ +{ + "name": "@google-cloud/contact-center-insights", + "version": "0.1.0", + "description": "Contactcenterinsights client for Node.js", + "repository": "googleapis/nodejs-contactcenterinsights", + "license": "Apache-2.0", + "author": "Google LLC", + "main": "build/src/index.js", + "files": [ + "build/src", + "build/protos" + ], + "keywords": [ + "google apis client", + "google api client", + "google apis", + "google api", + "google", + "google cloud platform", + "google cloud", + "cloud", + "google contactcenterinsights", + "contactcenterinsights", + "contact center insights" + ], + "scripts": { + "clean": "gts clean", + "compile": "tsc -p . && cp -r protos build/", + "compile-protos": "compileProtos src", + "docs": "jsdoc -c .jsdoc.js", + "predocs-test": "npm run docs", + "docs-test": "linkinator docs", + "fix": "gts fix", + "lint": "gts check", + "prepare": "npm run compile-protos && npm run compile", + "system-test": "c8 mocha build/system-test", + "test": "c8 mocha build/test" + }, + "dependencies": { + "google-gax": "^2.28.0" + }, + "devDependencies": { + "@types/mocha": "^9.0.0", + "@types/node": "^14.17.32", + "@types/sinon": "^10.0.6", + "c8": "^7.10.0", + "gts": "^3.1.0", + "jsdoc": "^3.6.7", + "jsdoc-fresh": "^1.1.1", + "jsdoc-region-tag": "^1.3.1", + "linkinator": "^2.14.5", + "mocha": "^9.1.3", + "null-loader": "^4.0.1", + "pack-n-play": "^1.0.0-2", + "sinon": "^11.1.2", + "ts-loader": "^9.2.6", + "typescript": "^4.4.4", + "webpack": "^5.62.1", + "webpack-cli": "^4.9.1" + }, + "engines": { + "node": ">=v10.24.0" + } +} diff --git a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto new file mode 100644 index 0000000..922219b --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto @@ -0,0 +1,970 @@ +// 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. + +syntax = "proto3"; + +package google.cloud.contactcenterinsights.v1; + +import "google/api/annotations.proto"; +import "google/api/client.proto"; +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/cloud/contactcenterinsights/v1/resources.proto"; +import "google/longrunning/operations.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/empty.proto"; +import "google/protobuf/field_mask.proto"; +import "google/protobuf/timestamp.proto"; +import "google/rpc/status.proto"; + +option csharp_namespace = "Google.Cloud.ContactCenterInsights.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1;contactcenterinsights"; +option java_multiple_files = true; +option java_outer_classname = "ContactCenterInsightsProto"; +option java_package = "com.google.cloud.contactcenterinsights.v1"; +option php_namespace = "Google\\Cloud\\ContactCenterInsights\\V1"; +option ruby_package = "Google::Cloud::ContactCenterInsights::V1"; + +// An API that lets users analyze and explore their business conversation data. +service ContactCenterInsights { + option (google.api.default_host) = "contactcenterinsights.googleapis.com"; + option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; + + // Creates a conversation. + rpc CreateConversation(CreateConversationRequest) returns (Conversation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/conversations" + body: "conversation" + }; + option (google.api.method_signature) = "parent,conversation,conversation_id"; + } + + // Updates a conversation. + rpc UpdateConversation(UpdateConversationRequest) returns (Conversation) { + option (google.api.http) = { + patch: "/v1/{conversation.name=projects/*/locations/*/conversations/*}" + body: "conversation" + }; + option (google.api.method_signature) = "conversation,update_mask"; + } + + // Gets a conversation. + rpc GetConversation(GetConversationRequest) returns (Conversation) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/conversations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists conversations. + rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/conversations" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a conversation. + rpc DeleteConversation(DeleteConversationRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/conversations/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Creates an analysis. The long running operation is done when the analysis + // has completed. + rpc CreateAnalysis(CreateAnalysisRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*/conversations/*}/analyses" + body: "analysis" + }; + option (google.api.method_signature) = "parent,analysis"; + option (google.longrunning.operation_info) = { + response_type: "Analysis" + metadata_type: "CreateAnalysisOperationMetadata" + }; + } + + // Gets an analysis. + rpc GetAnalysis(GetAnalysisRequest) returns (Analysis) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists analyses. + rpc ListAnalyses(ListAnalysesRequest) returns (ListAnalysesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/conversations/*}/analyses" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes an analysis. + rpc DeleteAnalysis(DeleteAnalysisRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Export insights data to a destination defined in the request body. + rpc ExportInsightsData(ExportInsightsDataRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/insightsdata:export" + body: "*" + }; + option (google.api.method_signature) = "parent"; + option (google.longrunning.operation_info) = { + response_type: "ExportInsightsDataResponse" + metadata_type: "ExportInsightsDataMetadata" + }; + } + + // Creates an issue model. + rpc CreateIssueModel(CreateIssueModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/issueModels" + body: "issue_model" + }; + option (google.api.method_signature) = "parent,issue_model"; + option (google.longrunning.operation_info) = { + response_type: "IssueModel" + metadata_type: "CreateIssueModelMetadata" + }; + } + + // Updates an issue model. + rpc UpdateIssueModel(UpdateIssueModelRequest) returns (IssueModel) { + option (google.api.http) = { + patch: "/v1/{issue_model.name=projects/*/locations/*/issueModels/*}" + body: "issue_model" + }; + option (google.api.method_signature) = "issue_model,update_mask"; + } + + // Gets an issue model. + rpc GetIssueModel(GetIssueModelRequest) returns (IssueModel) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/issueModels/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists issue models. + rpc ListIssueModels(ListIssueModelsRequest) returns (ListIssueModelsResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/issueModels" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes an issue model. + rpc DeleteIssueModel(DeleteIssueModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/issueModels/*}" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "google.protobuf.Empty" + metadata_type: "DeleteIssueModelMetadata" + }; + } + + // Deploys an issue model. Returns an error if a model is already deployed. + // An issue model can only be used in analysis after it has been deployed. + rpc DeployIssueModel(DeployIssueModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/issueModels/*}:deploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "DeployIssueModelResponse" + metadata_type: "DeployIssueModelMetadata" + }; + } + + // Undeploys an issue model. + // An issue model can not be used in analysis after it has been undeployed. + rpc UndeployIssueModel(UndeployIssueModelRequest) returns (google.longrunning.Operation) { + option (google.api.http) = { + post: "/v1/{name=projects/*/locations/*/issueModels/*}:undeploy" + body: "*" + }; + option (google.api.method_signature) = "name"; + option (google.longrunning.operation_info) = { + response_type: "UndeployIssueModelResponse" + metadata_type: "UndeployIssueModelMetadata" + }; + } + + // Gets an issue. + rpc GetIssue(GetIssueRequest) returns (Issue) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/issueModels/*/issues/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists issues. + rpc ListIssues(ListIssuesRequest) returns (ListIssuesResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*/issueModels/*}/issues" + }; + option (google.api.method_signature) = "parent"; + } + + // Updates an issue. + rpc UpdateIssue(UpdateIssueRequest) returns (Issue) { + option (google.api.http) = { + patch: "/v1/{issue.name=projects/*/locations/*/issueModels/*/issues/*}" + body: "issue" + }; + option (google.api.method_signature) = "issue,update_mask"; + } + + // Gets an issue model's statistics. + rpc CalculateIssueModelStats(CalculateIssueModelStatsRequest) returns (CalculateIssueModelStatsResponse) { + option (google.api.http) = { + get: "/v1/{issue_model=projects/*/locations/*/issueModels/*}:calculateIssueModelStats" + }; + option (google.api.method_signature) = "issue_model"; + } + + // Creates a phrase matcher. + rpc CreatePhraseMatcher(CreatePhraseMatcherRequest) returns (PhraseMatcher) { + option (google.api.http) = { + post: "/v1/{parent=projects/*/locations/*}/phraseMatchers" + body: "phrase_matcher" + }; + option (google.api.method_signature) = "parent,phrase_matcher"; + } + + // Gets a phrase matcher. + rpc GetPhraseMatcher(GetPhraseMatcherRequest) returns (PhraseMatcher) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/phraseMatchers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Lists phrase matchers. + rpc ListPhraseMatchers(ListPhraseMatchersRequest) returns (ListPhraseMatchersResponse) { + option (google.api.http) = { + get: "/v1/{parent=projects/*/locations/*}/phraseMatchers" + }; + option (google.api.method_signature) = "parent"; + } + + // Deletes a phrase matcher. + rpc DeletePhraseMatcher(DeletePhraseMatcherRequest) returns (google.protobuf.Empty) { + option (google.api.http) = { + delete: "/v1/{name=projects/*/locations/*/phraseMatchers/*}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates a phrase matcher. + rpc UpdatePhraseMatcher(UpdatePhraseMatcherRequest) returns (PhraseMatcher) { + option (google.api.http) = { + patch: "/v1/{phrase_matcher.name=projects/*/locations/*/phraseMatchers/*}" + body: "phrase_matcher" + }; + option (google.api.method_signature) = "phrase_matcher,update_mask"; + } + + // Gets conversation statistics. + rpc CalculateStats(CalculateStatsRequest) returns (CalculateStatsResponse) { + option (google.api.http) = { + get: "/v1/{location=projects/*/locations/*}/conversations:calculateStats" + }; + option (google.api.method_signature) = "location"; + } + + // Gets project-level settings. + rpc GetSettings(GetSettingsRequest) returns (Settings) { + option (google.api.http) = { + get: "/v1/{name=projects/*/locations/*/settings}" + }; + option (google.api.method_signature) = "name"; + } + + // Updates project-level settings. + rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { + option (google.api.http) = { + patch: "/v1/{settings.name=projects/*/locations/*/settings}" + body: "settings" + }; + option (google.api.method_signature) = "settings,update_mask"; + } +} + +// The request for calculating conversation statistics. +message CalculateStatsRequest { + // Required. The location of the conversations. + string location = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // A filter to reduce results to a specific subset. This field is useful for + // getting statistics about conversations with specific properties. + string filter = 2; +} + +// Represents the options for views of a conversation. +enum ConversationView { + // Not specified. Defaults to FULL on GetConversationRequest and BASIC for + // ListConversationsRequest. + CONVERSATION_VIEW_UNSPECIFIED = 0; + + // Transcript field is not populated in the response. + BASIC = 1; + + // All fields are populated. + FULL = 2; +} + +// The response for calculating conversation statistics. +message CalculateStatsResponse { + // A time series representing conversations over time. + message TimeSeries { + // A single interval in a time series. + message Interval { + // The start time of this interval. + google.protobuf.Timestamp start_time = 1; + + // The number of conversations created in this interval. + int32 conversation_count = 2; + } + + // The duration of each interval. + google.protobuf.Duration interval_duration = 1; + + // An ordered list of intervals from earliest to latest, where each interval + // represents the number of conversations that transpired during the time + // window. + repeated Interval points = 2; + } + + // The average duration of all conversations. The average is calculated using + // only conversations that have a time duration. + google.protobuf.Duration average_duration = 1; + + // The average number of turns per conversation. + int32 average_turn_count = 2; + + // The total number of conversations. + int32 conversation_count = 3; + + // A map associating each smart highlighter display name with its respective + // number of matches in the set of conversations. + map smart_highlighter_matches = 4; + + // A map associating each custom highlighter resource name with its respective + // number of matches in the set of conversations. + map custom_highlighter_matches = 5; + + // A map associating each issue resource name with its respective number of + // matches in the set of conversations. Key has the format: + // `projects//locations//issueModels//issues/` + // Deprecated, use `issue_matches_stats` field instead. + map issue_matches = 6 [deprecated = true]; + + // A map associating each issue resource name with its respective number of + // matches in the set of conversations. Key has the format: + // `projects//locations//issueModels//issues/` + map issue_matches_stats = 8; + + // A time series representing the count of conversations created over time + // that match that requested filter criteria. + TimeSeries conversation_count_time_series = 7; +} + +// Metadata for a create analysis operation. +message CreateAnalysisOperationMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The Conversation that this Analysis Operation belongs to. + string conversation = 3 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Conversation" + } + ]; +} + +// Request to create a conversation. +message CreateConversationRequest { + // Required. The parent resource of the conversation. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The conversation resource to create. + Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; + + // A unique ID for the new conversation. This ID will become the final + // component of the conversation's resource name. If no ID is specified, a + // server-generated ID will be used. + // + // This value should be 4-64 characters and must match the regular + // expression `^[a-z0-9-]{4,64}$`. Valid characters are `[a-z][0-9]-` + string conversation_id = 3; +} + +// Request to list conversations. +message ListConversationsRequest { + // Required. The parent resource of the conversation. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of conversations to return in the response. A valid page + // size ranges from 0 to 1,000 inclusive. If the page size is zero or + // unspecified, a default page size of 100 will be chosen. Note that a call + // might return fewer results than the requested page size. + int32 page_size = 2; + + // The value returned by the last `ListConversationsResponse`. This value + // indicates that this is a continuation of a prior `ListConversations` call + // and that the system should return the next page of data. + string page_token = 3; + + // A filter to reduce results to a specific subset. Useful for querying + // conversations with specific properties. + string filter = 4; + + // The level of details of the conversation. Default is `BASIC`. + ConversationView view = 5; +} + +// The response of listing conversations. +message ListConversationsResponse { + // The conversations that match the request. + repeated Conversation conversations = 1; + + // A token which can be sent as `page_token` to retrieve the next page. If + // this field is set, it means there is another page available. If it is not + // set, it means no other pages are available. + string next_page_token = 2; +} + +// The request to get a conversation. +message GetConversationRequest { + // Required. The name of the conversation to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Conversation" + } + ]; + + // The level of details of the conversation. Default is `FULL`. + ConversationView view = 2; +} + +// The request to update a conversation. +message UpdateConversationRequest { + // Required. The new values for the conversation. + Conversation conversation = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request to delete a conversation. +message DeleteConversationRequest { + // Required. The name of the conversation to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Conversation" + } + ]; + + // If set to true, all of this conversation's analyses will also be deleted. + // Otherwise, the request will only succeed if the conversation has no + // analyses. + bool force = 2; +} + +// The request to create an analysis. +message CreateAnalysisRequest { + // Required. The parent resource of the analysis. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Conversation" + } + ]; + + // Required. The analysis to create. + Analysis analysis = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// The request to list analyses. +message ListAnalysesRequest { + // Required. The parent resource of the analyses. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Conversation" + } + ]; + + // The maximum number of analyses to return in the response. If this + // value is zero, the service will select a default size. A call might return + // fewer objects than requested. A non-empty `next_page_token` in the response + // indicates that more data is available. + int32 page_size = 2; + + // The value returned by the last `ListAnalysesResponse`; indicates + // that this is a continuation of a prior `ListAnalyses` call and + // the system should return the next page of data. + string page_token = 3; + + // A filter to reduce results to a specific subset. Useful for querying + // conversations with specific properties. + string filter = 4; +} + +// The response to list analyses. +message ListAnalysesResponse { + // The analyses that match the request. + repeated Analysis analyses = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request to get an analysis. +message GetAnalysisRequest { + // Required. The name of the analysis to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Analysis" + } + ]; +} + +// The request to delete an analysis. +message DeleteAnalysisRequest { + // Required. The name of the analysis to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Analysis" + } + ]; +} + +// The request to export insights. +message ExportInsightsDataRequest { + // A BigQuery Table Reference. + message BigQueryDestination { + // A project ID or number. If specified, then export will attempt to + // write data to this project instead of the resource project. Otherwise, + // the resource project will be used. + string project_id = 3; + + // Required. The name of the BigQuery dataset that the snapshot result should be + // exported to. If this dataset does not exist, the export call returns an + // INVALID_ARGUMENT error. + string dataset = 1 [(google.api.field_behavior) = REQUIRED]; + + // The BigQuery table name to which the insights data should be written. + // If this table does not exist, the export call returns an INVALID_ARGUMENT + // error. + string table = 2; + } + + // Specifies the action that occurs if the destination table already exists. + enum WriteDisposition { + // Write disposition is not specified. Defaults to WRITE_TRUNCATE. + WRITE_DISPOSITION_UNSPECIFIED = 0; + + // If the table already exists, BigQuery will overwrite the table data and + // use the schema from the load. + WRITE_TRUNCATE = 1; + + // If the table already exists, BigQuery will append data to the table. + WRITE_APPEND = 2; + } + + // Exporter destination. + oneof destination { + // Specified if sink is a BigQuery table. + BigQueryDestination big_query_destination = 2; + } + + // Required. The parent resource to export data from. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // A filter to reduce results to a specific subset. Useful for exporting + // conversations with specific properties. + string filter = 3; + + // A fully qualified KMS key name for BigQuery tables protected by CMEK. + // Format: + // projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} + string kms_key = 4; + + // Options for what to do if the destination table already exists. + WriteDisposition write_disposition = 5; +} + +// Metadata for an export insights operation. +message ExportInsightsDataMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original request for export. + ExportInsightsDataRequest request = 3; + + // Partial errors during export operation that might cause the operation + // output to be incomplete. + repeated google.rpc.Status partial_errors = 4; +} + +// Response for an export insights operation. +message ExportInsightsDataResponse { + +} + +// The request to create an issue model. +message CreateIssueModelRequest { + // Required. The parent resource of the issue model. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The issue model to create. + IssueModel issue_model = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Metadata for creating an issue model. +message CreateIssueModelMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original request for creation. + CreateIssueModelRequest request = 3; +} + +// The request to update an issue model. +message UpdateIssueModelRequest { + // Required. The new values for the issue model. + IssueModel issue_model = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to list issue models. +message ListIssueModelsRequest { + // Required. The parent resource of the issue model. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; +} + +// The response of listing issue models. +message ListIssueModelsResponse { + // The issue models that match the request. + repeated IssueModel issue_models = 1; +} + +// The request to get an issue model. +message GetIssueModelRequest { + // Required. The name of the issue model to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// The request to delete an issue model. +message DeleteIssueModelRequest { + // Required. The name of the issue model to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// Metadata for deleting an issue model. +message DeleteIssueModelMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original request for deletion. + DeleteIssueModelRequest request = 3; +} + +// The request to deploy an issue model. +message DeployIssueModelRequest { + // Required. The issue model to deploy. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// The response to deploy an issue model. +message DeployIssueModelResponse { + +} + +// Metadata for deploying an issue model. +message DeployIssueModelMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original request for deployment. + DeployIssueModelRequest request = 3; +} + +// The request to undeploy an issue model. +message UndeployIssueModelRequest { + // Required. The issue model to undeploy. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// The response to undeploy an issue model. +message UndeployIssueModelResponse { + +} + +// Metadata for undeploying an issue model. +message UndeployIssueModelMetadata { + // Output only. The time the operation was created. + google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time the operation finished running. + google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The original request for undeployment. + UndeployIssueModelRequest request = 3; +} + +// The request to get an issue. +message GetIssueRequest { + // Required. The name of the issue to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Issue" + } + ]; +} + +// Request to list issues. +message ListIssuesRequest { + // Required. The parent resource of the issue. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// The response of listing issues. +message ListIssuesResponse { + // The issues that match the request. + repeated Issue issues = 1; +} + +// The request to update an issue. +message UpdateIssueRequest { + // Required. The new values for the issue. + Issue issue = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// Request to get statistics of an issue model. +message CalculateIssueModelStatsRequest { + // Required. The resource name of the issue model to query against. + string issue_model = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + } + ]; +} + +// Response of querying an issue model's statistics. +message CalculateIssueModelStatsResponse { + // The latest label statistics for the queried issue model. Includes results + // on both training data and data labeled after deployment. + IssueModelLabelStats current_stats = 4; +} + +// Request to create a phrase matcher. +message CreatePhraseMatcherRequest { + // Required. The parent resource of the phrase matcher. Required. The location to create + // a phrase matcher for. + // Format: `projects//locations/` or + // `projects//locations/` + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // Required. The phrase matcher resource to create. + PhraseMatcher phrase_matcher = 2 [(google.api.field_behavior) = REQUIRED]; +} + +// Request to list phrase matchers. +message ListPhraseMatchersRequest { + // Required. The parent resource of the phrase matcher. + string parent = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "locations.googleapis.com/Location" + } + ]; + + // The maximum number of phrase matchers to return in the response. If this + // value is zero, the service will select a default size. A call might return + // fewer objects than requested. A non-empty `next_page_token` in the response + // indicates that more data is available. + int32 page_size = 2; + + // The value returned by the last `ListPhraseMatchersResponse`. This value + // indicates that this is a continuation of a prior `ListPhraseMatchers` call + // and that the system should return the next page of data. + string page_token = 3; + + // A filter to reduce results to a specific subset. Useful for querying + // phrase matchers with specific properties. + string filter = 4; +} + +// The response of listing phrase matchers. +message ListPhraseMatchersResponse { + // The phrase matchers that match the request. + repeated PhraseMatcher phrase_matchers = 1; + + // A token, which can be sent as `page_token` to retrieve the next page. + // If this field is omitted, there are no subsequent pages. + string next_page_token = 2; +} + +// The request to get a a phrase matcher. +message GetPhraseMatcherRequest { + // Required. The name of the phrase matcher to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/PhraseMatcher" + } + ]; +} + +// The request to delete a phrase matcher. +message DeletePhraseMatcherRequest { + // Required. The name of the phrase matcher to delete. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/PhraseMatcher" + } + ]; +} + +// The request to update a phrase matcher. +message UpdatePhraseMatcherRequest { + // Required. The new values for the phrase matcher. + PhraseMatcher phrase_matcher = 1 [(google.api.field_behavior) = REQUIRED]; + + // The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2; +} + +// The request to get project-level settings. +message GetSettingsRequest { + // Required. The name of the settings resource to get. + string name = 1 [ + (google.api.field_behavior) = REQUIRED, + (google.api.resource_reference) = { + type: "contactcenterinsights.googleapis.com/Settings" + } + ]; +} + +// The request to update project-level settings. +message UpdateSettingsRequest { + // Required. The new settings values. + Settings settings = 1 [(google.api.field_behavior) = REQUIRED]; + + // Required. The list of fields to be updated. + google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; +} diff --git a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto new file mode 100644 index 0000000..491106c --- /dev/null +++ b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto @@ -0,0 +1,1086 @@ +// 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. + +syntax = "proto3"; + +package google.cloud.contactcenterinsights.v1; + +import "google/api/field_behavior.proto"; +import "google/api/resource.proto"; +import "google/protobuf/duration.proto"; +import "google/protobuf/timestamp.proto"; +import "google/api/annotations.proto"; + +option csharp_namespace = "Google.Cloud.ContactCenterInsights.V1"; +option go_package = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1;contactcenterinsights"; +option java_multiple_files = true; +option java_outer_classname = "ResourcesProto"; +option java_package = "com.google.cloud.contactcenterinsights.v1"; +option php_namespace = "Google\\Cloud\\ContactCenterInsights\\V1"; +option ruby_package = "Google::Cloud::ContactCenterInsights::V1"; +option (google.api.resource_definition) = { + type: "dialogflow.googleapis.com/Participant" + pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" +}; + +// The conversation resource. +message Conversation { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/Conversation" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}" + }; + + // Call-specific metadata. + message CallMetadata { + // The audio channel that contains the customer. + int32 customer_channel = 1; + + // The audio channel that contains the agent. + int32 agent_channel = 2; + } + + // A message representing the transcript of a conversation. + message Transcript { + // A segment of a full transcript. + message TranscriptSegment { + // Word-level info for words in a transcript. + message WordInfo { + // Time offset of the start of this word relative to the beginning of + // the total conversation. + google.protobuf.Duration start_offset = 1; + + // Time offset of the end of this word relative to the beginning of the + // total conversation. + google.protobuf.Duration end_offset = 2; + + // The word itself. Includes punctuation marks that surround the word. + string word = 3; + + // A confidence estimate between 0.0 and 1.0 of the fidelity of this + // word. A default value of 0.0 indicates that the value is unset. + float confidence = 4; + } + + // Metadata from Dialogflow relating to the current transcript segment. + message DialogflowSegmentMetadata { + // Whether the transcript segment was covered under the configured smart + // reply allowlist in Agent Assist. + bool smart_reply_allowlist_covered = 1; + } + + // The time that the message occurred, if provided. + google.protobuf.Timestamp message_time = 6; + + // The text of this segment. + string text = 1; + + // A confidence estimate between 0.0 and 1.0 of the fidelity of this + // segment. A default value of 0.0 indicates that the value is unset. + float confidence = 2; + + // A list of the word-specific information for each word in the segment. + repeated WordInfo words = 3; + + // The language code of this segment as a + // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. + // Example: "en-US". + string language_code = 4; + + // For conversations derived from multi-channel audio, this is the channel + // number corresponding to the audio from that channel. For + // audioChannelCount = N, its output values can range from '1' to 'N'. A + // channel tag of 0 indicates that the audio is mono. + int32 channel_tag = 5; + + // The participant of this segment. + ConversationParticipant segment_participant = 9; + + // CCAI metadata relating to the current transcript segment. + DialogflowSegmentMetadata dialogflow_segment_metadata = 10; + + // The sentiment for this transcript segment. + SentimentData sentiment = 11; + } + + // A list of sequential transcript segments that comprise the conversation. + repeated TranscriptSegment transcript_segments = 1; + } + + // Possible media for the conversation. + enum Medium { + // Default value, if unspecified will default to PHONE_CALL. + MEDIUM_UNSPECIFIED = 0; + + // The format for conversations that took place over the phone. + PHONE_CALL = 1; + + // The format for conversations that took place over chat. + CHAT = 2; + } + + // Metadata that applies to the conversation. + oneof metadata { + // Call-specific metadata. + CallMetadata call_metadata = 7; + } + + // A time to live expiration setting, can be either a specified timestamp or a + // duration from the time that the conversation creation request was received. + // Conversations with an expiration set will be removed up to 24 hours after + // the specified time. + oneof expiration { + // The time at which this conversation should expire. After this time, the + // conversation data and any associated analyses will be deleted. + google.protobuf.Timestamp expire_time = 15; + + // Input only. The TTL for this resource. If specified, then this TTL will + // be used to calculate the expire time. + google.protobuf.Duration ttl = 16 [(google.api.field_behavior) = INPUT_ONLY]; + } + + // Immutable. The resource name of the conversation. + // Format: + // projects/{project}/locations/{location}/conversations/{conversation} + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The source of the audio and transcription for the conversation. + ConversationDataSource data_source = 2; + + // Output only. The time at which the conversation was created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the conversation was updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The time at which the conversation started. + google.protobuf.Timestamp start_time = 17; + + // A user-specified language code for the conversation. + string language_code = 14; + + // An opaque, user-specified string representing the human agent who handled + // the conversation. + string agent_id = 5; + + // A map for the user to specify any custom fields. A maximum of 20 labels per + // conversation is allowed, with a maximum of 256 characters per entry. + map labels = 6; + + // Output only. The conversation transcript. + Transcript transcript = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Immutable. The conversation medium, if unspecified will default to PHONE_CALL. + Medium medium = 9 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The duration of the conversation. + google.protobuf.Duration duration = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The number of turns in the conversation. + int32 turn_count = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The conversation's latest analysis, if one exists. + Analysis latest_analysis = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The annotations that were generated during the customer and agent + // interaction. + repeated RuntimeAnnotation runtime_annotations = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. All the matched Dialogflow intents in the call. The key corresponds to a + // Dialogflow intent, format: + // projects/{project}/agent/{agent}/intents/{intent} + map dialogflow_intents = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The analysis resource. +message Analysis { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/Analysis" + pattern: "projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis}" + }; + + // Immutable. The resource name of the analysis. + // Format: + // projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis} + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time at which the analysis was requested. + google.protobuf.Timestamp request_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the analysis was created, which occurs when the + // long-running operation completes. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The result of the analysis, which is populated when the analysis + // finishes. + AnalysisResult analysis_result = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// The conversation source, which is a combination of transcript and audio. +message ConversationDataSource { + // The source of the conversation. + oneof source { + // A Cloud Storage location specification for the audio and transcript. + GcsSource gcs_source = 1; + + // The source when the conversation comes from Dialogflow. + DialogflowSource dialogflow_source = 3; + } +} + +// A Cloud Storage source of conversation data. +message GcsSource { + // Cloud Storage URI that points to a file that contains the conversation + // audio. + string audio_uri = 1; + + // Immutable. Cloud Storage URI that points to a file that contains the conversation + // transcript. + string transcript_uri = 2 [(google.api.field_behavior) = IMMUTABLE]; +} + +// A Dialogflow source of conversation data. +message DialogflowSource { + // Output only. The name of the Dialogflow conversation that this conversation + // resource is derived from. Format: + // projects/{project}/locations/{location}/conversations/{conversation} + string dialogflow_conversation = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Cloud Storage URI that points to a file that contains the conversation + // audio. + string audio_uri = 3; +} + +// The result of an analysis. +message AnalysisResult { + // Call-specific metadata created during analysis. + message CallAnalysisMetadata { + // A list of call annotations that apply to this call. + repeated CallAnnotation annotations = 2; + + // All the entities in the call. + map entities = 3; + + // Overall conversation-level sentiment for each channel of the call. + repeated ConversationLevelSentiment sentiments = 4; + + // All the matched intents in the call. + map intents = 6; + + // All the matched phrase matchers in the call. + map phrase_matchers = 7; + + // Overall conversation-level issue modeling result. + IssueModelResult issue_model_result = 8; + } + + // Metadata discovered during analysis. + oneof metadata { + // Call-specific metadata created by the analysis. + CallAnalysisMetadata call_analysis_metadata = 2; + } + + // The time at which the analysis ended. + google.protobuf.Timestamp end_time = 1; +} + +// Issue Modeling result on a conversation. +message IssueModelResult { + // Issue model that generates the result. + string issue_model = 1; + + // All the matched issues. + repeated IssueAssignment issues = 2; +} + +// One channel of conversation-level sentiment data. +message ConversationLevelSentiment { + // The channel of the audio that the data applies to. + int32 channel_tag = 1; + + // Data specifying sentiment. + SentimentData sentiment_data = 2; +} + +// Information about the issue. +message IssueAssignment { + // Resource name of the assigned issue. + string issue = 1; + + // Score indicating the likelihood of the issue assignment. + // currently bounded on [0,1]. + double score = 2; + + // Immutable. Display name of the assigned issue. This field is set at time of analyis + // and immutable since then. + string display_name = 3 [(google.api.field_behavior) = IMMUTABLE]; +} + +// A piece of metadata that applies to a window of a call. +message CallAnnotation { + // The data in the annotation. + oneof data { + // Data specifying an interruption. + InterruptionData interruption_data = 10; + + // Data specifying sentiment. + SentimentData sentiment_data = 11; + + // Data specifying silence. + SilenceData silence_data = 12; + + // Data specifying a hold. + HoldData hold_data = 13; + + // Data specifying an entity mention. + EntityMentionData entity_mention_data = 15; + + // Data specifying an intent match. + IntentMatchData intent_match_data = 16; + + // Data specifying a phrase match. + PhraseMatchData phrase_match_data = 17; + } + + // The channel of the audio where the annotation occurs. For single-channel + // audio, this field is not populated. + int32 channel_tag = 1; + + // The boundary in the conversation where the annotation starts, inclusive. + AnnotationBoundary annotation_start_boundary = 4; + + // The boundary in the conversation where the annotation ends, inclusive. + AnnotationBoundary annotation_end_boundary = 5; +} + +// A point in a conversation that marks the start or the end of an annotation. +message AnnotationBoundary { + // A detailed boundary, which describes a more specific point. + oneof detailed_boundary { + // The word index of this boundary with respect to the first word in the + // transcript piece. This index starts at zero. + int32 word_index = 3; + } + + // The index in the sequence of transcribed pieces of the conversation where + // the boundary is located. This index starts at zero. + int32 transcript_index = 1; +} + +// The data for an entity annotation. +// Represents a phrase in the conversation that is a known entity, such +// as a person, an organization, or location. +message Entity { + // The type of the entity. For most entity types, the associated metadata is a + // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table + // below lists the associated fields for entities that have different + // metadata. + enum Type { + // Unspecified. + TYPE_UNSPECIFIED = 0; + + // Person. + PERSON = 1; + + // Location. + LOCATION = 2; + + // Organization. + ORGANIZATION = 3; + + // Event. + EVENT = 4; + + // Artwork. + WORK_OF_ART = 5; + + // Consumer product. + CONSUMER_GOOD = 6; + + // Other types of entities. + OTHER = 7; + + // Phone number. + // + // The metadata lists the phone number (formatted according to local + // convention), plus whichever additional elements appear in the text: + // + // * `number` - The actual number, broken down into sections according to + // local convention. + // * `national_prefix` - Country code, if detected. + // * `area_code` - Region or area code, if detected. + // * `extension` - Phone extension (to be dialed after connection), if + // detected. + PHONE_NUMBER = 9; + + // Address. + // + // The metadata identifies the street number and locality plus whichever + // additional elements appear in the text: + // + // * `street_number` - Street number. + // * `locality` - City or town. + // * `street_name` - Street/route name, if detected. + // * `postal_code` - Postal code, if detected. + // * `country` - Country, if detected. + // * `broad_region` - Administrative area, such as the state, if detected. + // * `narrow_region` - Smaller administrative area, such as county, if + // detected. + // * `sublocality` - Used in Asian addresses to demark a district within a + // city, if detected. + ADDRESS = 10; + + // Date. + // + // The metadata identifies the components of the date: + // + // * `year` - Four digit year, if detected. + // * `month` - Two digit month number, if detected. + // * `day` - Two digit day number, if detected. + DATE = 11; + + // Number. + // + // The metadata is the number itself. + NUMBER = 12; + + // Price. + // + // The metadata identifies the `value` and `currency`. + PRICE = 13; + } + + // The representative name for the entity. + string display_name = 1; + + // The entity type. + Type type = 2; + + // Metadata associated with the entity. + // + // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) + // and Knowledge Graph MID (`mid`), if they are available. For the metadata + // associated with other entity types, see the Type table below. + map metadata = 3; + + // The salience score associated with the entity in the [0, 1.0] range. + // + // The salience score for an entity provides information about the + // importance or centrality of that entity to the entire document text. + // Scores closer to 0 are less salient, while scores closer to 1.0 are highly + // salient. + float salience = 4; + + // The aggregate sentiment expressed for this entity in the conversation. + SentimentData sentiment = 5; +} + +// The data for an intent. +// Represents a detected intent in the conversation, for example MAKES_PROMISE. +message Intent { + // The unique identifier of the intent. + string id = 1; + + // The human-readable name of the intent. + string display_name = 2; +} + +// The data for a matched phrase matcher. +// Represents information identifying a phrase matcher for a given match. +message PhraseMatchData { + // The unique identifier (the resource name) of the phrase matcher. + string phrase_matcher = 1; + + // The human-readable name of the phrase matcher. + string display_name = 2; +} + +// The data for a Dialogflow intent. +// Represents a detected intent in the conversation, e.g. MAKES_PROMISE. +message DialogflowIntent { + // The human-readable name of the intent. + string display_name = 1; +} + +// The data for an interruption annotation. +message InterruptionData { + +} + +// The data for a silence annotation. +message SilenceData { + +} + +// The data for a hold annotation. +message HoldData { + +} + +// The data for an entity mention annotation. +// This represents a mention of an `Entity` in the conversation. +message EntityMentionData { + // The supported types of mentions. + enum MentionType { + // Unspecified. + MENTION_TYPE_UNSPECIFIED = 0; + + // Proper noun. + PROPER = 1; + + // Common noun (or noun compound). + COMMON = 2; + } + + // The key of this entity in conversation entities. + // Can be used to retrieve the exact `Entity` this mention is attached to. + string entity_unique_id = 1; + + // The type of the entity mention. + MentionType type = 2; + + // Sentiment expressed for this mention of the entity. + SentimentData sentiment = 3; +} + +// The data for an intent match. +// Represents an intent match for a text segment in the conversation. A text +// segment can be part of a sentence, a complete sentence, or an utterance +// with multiple sentences. +message IntentMatchData { + // The id of the matched intent. + // Can be used to retrieve the corresponding intent information. + string intent_unique_id = 1; +} + +// The data for a sentiment annotation. +message SentimentData { + // A non-negative number from 0 to infinity which represents the abolute + // magnitude of sentiment regardless of score. + float magnitude = 1; + + // The sentiment score between -1.0 (negative) and 1.0 (positive). + float score = 2; +} + +// The issue model resource. +message IssueModel { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/IssueModel" + pattern: "projects/{project}/locations/{location}/issueModels/{issue_model}" + }; + + // Configs for the input data used to create the issue model. + message InputDataConfig { + // Medium of conversations used in training data. This field is being + // deprecated. To specify the medium to be used in training a new issue + // model, set the `medium` field on `filter`. + Conversation.Medium medium = 1 [deprecated = true]; + + // Output only. Number of conversations used in training. Output only. + int64 training_conversations_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A filter to reduce the conversations used for training the model to a + // specific subset. + string filter = 3; + } + + // State of the model. + enum State { + // Unspecified. + STATE_UNSPECIFIED = 0; + + // Model is not deployed but is ready to deploy. + UNDEPLOYED = 1; + + // Model is being deployed. + DEPLOYING = 2; + + // Model is deployed and is ready to be used. A model can only be used in + // analysis if it's in this state. + DEPLOYED = 3; + + // Model is being undeployed. + UNDEPLOYING = 4; + + // Model is being deleted. + DELETING = 5; + } + + // Immutable. The resource name of the issue model. + // Format: + // projects/{project}/locations/{location}/issueModels/{issue_model} + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The representative name for the issue model. + string display_name = 2; + + // Output only. The time at which this issue model was created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time at which the issue model was updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. State of the model. + State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Configs for the input data that used to create the issue model. + InputDataConfig input_data_config = 6; + + // Output only. Immutable. The issue model's label statistics on its training data. + IssueModelLabelStats training_stats = 7 [ + (google.api.field_behavior) = OUTPUT_ONLY, + (google.api.field_behavior) = IMMUTABLE + ]; +} + +// The issue resource. +message Issue { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/Issue" + pattern: "projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue}" + }; + + // Immutable. The resource name of the issue. + // Format: + // projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue} + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // The representative name for the issue. + string display_name = 2; + + // Output only. The time at which this issue was created. + google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The most recent time that this issue was updated. + google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// Aggregated statistics about an issue model. +message IssueModelLabelStats { + // Aggregated statistics about an issue. + message IssueStats { + // Issue resource. + // Format: + // projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue} + string issue = 1; + + // Number of conversations attached to the issue at this point in time. + int64 labeled_conversations_count = 2; + + // Display name of the issue. + string display_name = 3; + } + + // Number of conversations the issue model has analyzed at this point in time. + int64 analyzed_conversations_count = 1; + + // Number of analyzed conversations for which no issue was applicable at this + // point in time. + int64 unclassified_conversations_count = 2; + + // Statistics on each issue. Key is the issue's resource name. + map issue_stats = 3; +} + +// The phrase matcher resource. +message PhraseMatcher { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/PhraseMatcher" + pattern: "projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher}" + }; + + // Specifies how to combine each phrase match rule group to determine whether + // there is a match. + enum PhraseMatcherType { + // Unspecified. + PHRASE_MATCHER_TYPE_UNSPECIFIED = 0; + + // Must meet all phrase match rule groups or there is no match. + ALL_OF = 1; + + // If any of the phrase match rule groups are met, there is a match. + ANY_OF = 2; + } + + // The resource name of the phrase matcher. + // Format: + // projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher} + string name = 1; + + // Output only. Immutable. The revision ID of the phrase matcher. + // A new revision is committed whenever the matcher is changed, except when it + // is activated or deactivated. A server generated random ID will be used. + // Example: locations/global/phraseMatchers/my-first-matcher@1234567 + string revision_id = 2 [ + (google.api.field_behavior) = IMMUTABLE, + (google.api.field_behavior) = OUTPUT_ONLY + ]; + + // The customized version tag to use for the phrase matcher. If not specified, + // it will default to `revision_id`. + string version_tag = 3; + + // Output only. The timestamp of when the revision was created. It is also the create time + // when a new matcher is added. + google.protobuf.Timestamp revision_create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The human-readable name of the phrase matcher. + string display_name = 5; + + // Required. The type of this phrase matcher. + PhraseMatcherType type = 6 [(google.api.field_behavior) = REQUIRED]; + + // Applies the phrase matcher only when it is active. + bool active = 7; + + // A list of phase match rule groups that are included in this matcher. + repeated PhraseMatchRuleGroup phrase_match_rule_groups = 8; + + // Output only. The most recent time at which the activation status was updated. + google.protobuf.Timestamp activation_update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // The role whose utterances the phrase matcher should be matched + // against. If the role is ROLE_UNSPECIFIED it will be matched against any + // utterances in the transcript. + ConversationParticipant.Role role_match = 10; + + // Output only. The most recent time at which the phrase matcher was updated. + google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; +} + +// A message representing a rule in the phrase matcher. +message PhraseMatchRuleGroup { + // Specifies how to combine each phrase match rule for whether there is a + // match. + enum PhraseMatchRuleGroupType { + // Unspecified. + PHRASE_MATCH_RULE_GROUP_TYPE_UNSPECIFIED = 0; + + // Must meet all phrase match rules or there is no match. + ALL_OF = 1; + + // If any of the phrase match rules are met, there is a match. + ANY_OF = 2; + } + + // Required. The type of this phrase match rule group. + PhraseMatchRuleGroupType type = 1 [(google.api.field_behavior) = REQUIRED]; + + // A list of phase match rules that are included in this group. + repeated PhraseMatchRule phrase_match_rules = 2; +} + +// The data for a phrase match rule. +message PhraseMatchRule { + // Required. The phrase to be matched. + string query = 1 [(google.api.field_behavior) = REQUIRED]; + + // Specifies whether the phrase must be missing from the transcript segment or + // present in the transcript segment. + bool negated = 2; + + // Provides additional information about the rule that specifies how to apply + // the rule. + PhraseMatchRuleConfig config = 3; +} + +// Configuration information of a phrase match rule. +message PhraseMatchRuleConfig { + // The configuration of the phrase match rule. + oneof config { + // The configuration for the exact match rule. + ExactMatchConfig exact_match_config = 1; + } +} + +// Exact match configuration. +message ExactMatchConfig { + // Whether to consider case sensitivity when performing an exact match. + bool case_sensitive = 1; +} + +// The settings resource. +message Settings { + option (google.api.resource) = { + type: "contactcenterinsights.googleapis.com/Settings" + pattern: "projects/{project}/locations/{location}/settings" + }; + + // Default configuration when creating Analyses in Insights. + message AnalysisConfig { + // Percentage of conversations created using Dialogflow runtime integration + // to analyze automatically, between [0, 100]. + double runtime_integration_analysis_percentage = 1; + } + + // Immutable. The resource name of the settings resource. + // Format: + // projects/{project}/locations/{location}/settings + string name = 1 [(google.api.field_behavior) = IMMUTABLE]; + + // Output only. The time at which the settings was created. + google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // Output only. The time at which the settings were last updated. + google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; + + // A language code to be applied to each transcript segment unless the segment + // already specifies a language code. Language code defaults to "en-US" if it + // is neither specified on the segment nor here. + string language_code = 4; + + // The default TTL for newly-created conversations. If a conversation has a + // specified expiration, that value will be used instead. Changing this + // value will not change the expiration of existing conversations. + // Conversations with no expire time persist until they are deleted. + google.protobuf.Duration conversation_ttl = 5; + + // A map that maps a notification trigger to a Pub/Sub topic. Each time a + // specified trigger occurs, Insights will notify the corresponding Pub/Sub + // topic. + // + // Keys are notification triggers. Supported keys are: + // + // * "all-triggers": Notify each time any of the supported triggers occurs. + // * "create-analysis": Notify each time an analysis is created. + // * "create-conversation": Notify each time a conversation is created. + // * "export-insights-data": Notify each time an export is complete. + // * "update-conversation": Notify each time a conversation is updated via + // UpdateConversation. + // + // Values are Pub/Sub topics. The format of each Pub/Sub topic is: + // projects/{project}/topics/{topic} + map pubsub_notification_settings = 6; + + // Default analysis settings. + AnalysisConfig analysis_config = 7; +} + +// An annotation that was generated during the customer and agent interaction. +message RuntimeAnnotation { + // The data in the annotation. + oneof data { + // Agent Assist Article Suggestion data. + ArticleSuggestionData article_suggestion = 6; + + // Agent Assist FAQ answer data. + FaqAnswerData faq_answer = 7; + + // Agent Assist Smart Reply data. + SmartReplyData smart_reply = 8; + + // Agent Assist Smart Compose suggestion data. + SmartComposeSuggestionData smart_compose_suggestion = 9; + + // Dialogflow interaction data. + DialogflowInteractionData dialogflow_interaction = 10; + } + + // The unique identifier of the annotation. + // Format: + // projects/{project}/locations/{location}/conversationDatasets/{dataset}/conversationDataItems/{data_item}/conversationAnnotations/{annotation} + string annotation_id = 1; + + // The time at which this annotation was created. + google.protobuf.Timestamp create_time = 2; + + // The boundary in the conversation where the annotation starts, inclusive. + AnnotationBoundary start_boundary = 3; + + // The boundary in the conversation where the annotation ends, inclusive. + AnnotationBoundary end_boundary = 4; + + // The feedback that the customer has about the answer in `data`. + AnswerFeedback answer_feedback = 5; +} + +// The feedback that the customer has about a certain answer in the +// 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 an answer. + CorrectnessLevel correctness_level = 1; + + // Indicates whether an answer or item was clicked by the human agent. + bool clicked = 2; + + // Indicates whether an answer or item was displayed to the human agent in the + // agent desktop UI. + bool displayed = 3; +} + +// Agent Assist Article Suggestion data. +message ArticleSuggestionData { + // Article title. + string title = 1; + + // Article URI. + string uri = 2; + + // The system's confidence score that this article is a good match for this + // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely + // certain). + float confidence_score = 3; + + // Map that contains metadata about the Article Suggestion and the document + // that it originates from. + map metadata = 4; + + // Name of the query record. + // Format: + // projects/{project}/locations/{location}/queryRecords/{query_record} + string query_record = 5; + + // The knowledge document that this answer was extracted from. + // Format: + // projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} + string source = 6; +} + +// Agent Assist frequently-asked-question answer data. +message FaqAnswerData { + // The piece of text from the `source` knowledge base document. + string answer = 1; + + // The system's confidence score that this answer is a good match for this + // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely + // certain). + float confidence_score = 2; + + // The corresponding FAQ question. + string question = 3; + + // Map that contains metadata about the FAQ answer and the document that + // it originates from. + map metadata = 4; + + // Name of the query record. + // Format: + // projects/{project}/locations/{location}/queryRecords/{query_record}. + string query_record = 5; + + // The knowledge document that this answer was extracted from. + // Format: + // projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}. + string source = 6; +} + +// Agent Assist Smart Reply data. +message SmartReplyData { + // The content of the reply. + string reply = 1; + + // The system's confidence score that this reply is a good match for this + // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely + // certain). + double confidence_score = 2; + + // Map that contains metadata about the Smart Reply and the document from + // which it originates. + map metadata = 3; + + // Name of the query record. + // Format: + // projects/{project}/locations/{location}/queryRecords/{query_record} + string query_record = 4; +} + +// Agent Assist Smart Compose suggestion data. +message SmartComposeSuggestionData { + // The content of the suggestion. + string suggestion = 1; + + // The system's confidence score that this suggestion is a good match for this + // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely + // certain). + double confidence_score = 2; + + // Map that contains metadata about the Smart Compose suggestion and the + // document from which it originates. + map metadata = 3; + + // Name of the query record. + // Format: + // projects/{project}/locations/{location}/queryRecords/{query_record} + string query_record = 4; +} + +// Dialogflow interaction data. +message DialogflowInteractionData { + // The Dialogflow intent resource path. Format: + // projects/{project}/agent/{agent}/intents/{intent} + string dialogflow_intent_id = 1; + + // The confidence of the match ranging from 0.0 (completely uncertain) to 1.0 + // (completely certain). + float confidence = 2; +} + +// The call participant speaking for a given utterance. +message ConversationParticipant { + // The role of the participant. + enum Role { + // Participant's role is not set. + ROLE_UNSPECIFIED = 0; + + // Participant is a human agent. + HUMAN_AGENT = 1; + + // Participant is an automated agent. + AUTOMATED_AGENT = 2; + + // Participant is an end user who conversed with the contact center. + END_USER = 3; + + // Participant is either a human or automated agent. + ANY_AGENT = 4; + } + + oneof participant { + // The name of the participant provided by Dialogflow. Format: + // projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant} + string dialogflow_participant_name = 5 [(google.api.resource_reference) = { + type: "dialogflow.googleapis.com/Participant" + }]; + + // A user-specified ID representing the participant. + string user_id = 6; + } + + // Deprecated. Use `dialogflow_participant_name` instead. + // The name of the Dialogflow participant. Format: + // projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant} + string dialogflow_participant = 1 [deprecated = true]; + + // Obfuscated user ID from Dialogflow. + string obfuscated_external_user_id = 3; + + // The role of the participant. + Role role = 2; +} diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js new file mode 100644 index 0000000..fd1d9eb --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(issueModel) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The resource name of the issue model to query against. + */ + // const issueModel = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCalculateIssueModelStats() { + // Construct request + const request = { + issueModel, + }; + + // Run request + const response = await contactcenterinsightsClient.calculateIssueModelStats(request); + console.log(response); + } + + callCalculateIssueModelStats(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js new file mode 100644 index 0000000..1dffad3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js @@ -0,0 +1,58 @@ +// 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. + + +'use strict'; + +function main(location) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The location of the conversations. + */ + // const location = 'abc123' + /** + * A filter to reduce results to a specific subset. This field is useful for + * getting statistics about conversations with specific properties. + */ + // const filter = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCalculateStats() { + // Construct request + const request = { + location, + }; + + // Run request + const response = await contactcenterinsightsClient.calculateStats(request); + console.log(response); + } + + callCalculateStats(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js new file mode 100644 index 0000000..9b7ce4a --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js @@ -0,0 +1,59 @@ +// 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. + + +'use strict'; + +function main(parent, analysis) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the analysis. + */ + // const parent = 'abc123' + /** + * Required. The analysis to create. + */ + // const analysis = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCreateAnalysis() { + // Construct request + const request = { + parent, + analysis, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.createAnalysis(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateAnalysis(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js new file mode 100644 index 0000000..85c43f2 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js @@ -0,0 +1,66 @@ +// 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. + + +'use strict'; + +function main(parent, conversation) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the conversation. + */ + // const parent = 'abc123' + /** + * Required. The conversation resource to create. + */ + // const conversation = {} + /** + * A unique ID for the new conversation. This ID will become the final + * component of the conversation's resource name. If no ID is specified, a + * server-generated ID will be used. + * This value should be 4-64 characters and must match the regular + * expression `^[a-z0-9-]{4,64}$`. Valid characters are `[a-z][0-9]-` + */ + // const conversationId = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCreateConversation() { + // Construct request + const request = { + parent, + conversation, + }; + + // Run request + const response = await contactcenterinsightsClient.createConversation(request); + console.log(response); + } + + callCreateConversation(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js new file mode 100644 index 0000000..b9538d8 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js @@ -0,0 +1,59 @@ +// 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. + + +'use strict'; + +function main(parent, issueModel) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the issue model. + */ + // const parent = 'abc123' + /** + * Required. The issue model to create. + */ + // const issueModel = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCreateIssueModel() { + // Construct request + const request = { + parent, + issueModel, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.createIssueModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callCreateIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js new file mode 100644 index 0000000..5daf091 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js @@ -0,0 +1,61 @@ +// 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. + + +'use strict'; + +function main(parent, phraseMatcher) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the phrase matcher. Required. The location to create + * a phrase matcher for. + * Format: `projects//locations/` or + * `projects//locations/` + */ + // const parent = 'abc123' + /** + * Required. The phrase matcher resource to create. + */ + // const phraseMatcher = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callCreatePhraseMatcher() { + // Construct request + const request = { + parent, + phraseMatcher, + }; + + // Run request + const response = await contactcenterinsightsClient.createPhraseMatcher(request); + console.log(response); + } + + callCreatePhraseMatcher(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js new file mode 100644 index 0000000..35e148b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the analysis to delete. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callDeleteAnalysis() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.deleteAnalysis(request); + console.log(response); + } + + callDeleteAnalysis(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js new file mode 100644 index 0000000..8c5ae06 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js @@ -0,0 +1,59 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to delete. + */ + // const name = 'abc123' + /** + * If set to true, all of this conversation's analyses will also be deleted. + * Otherwise, the request will only succeed if the conversation has no + * analyses. + */ + // const force = true + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callDeleteConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.deleteConversation(request); + console.log(response); + } + + callDeleteConversation(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js new file mode 100644 index 0000000..5460941 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js @@ -0,0 +1,54 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the issue model to delete. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callDeleteIssueModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.deleteIssueModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeleteIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js new file mode 100644 index 0000000..ee88f8b --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the phrase matcher to delete. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callDeletePhraseMatcher() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.deletePhraseMatcher(request); + console.log(response); + } + + callDeletePhraseMatcher(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js new file mode 100644 index 0000000..9662aac --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js @@ -0,0 +1,54 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The issue model to deploy. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callDeployIssueModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.deployIssueModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callDeployIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js new file mode 100644 index 0000000..1adba45 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js @@ -0,0 +1,73 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Specified if sink is a BigQuery table. + */ + // const bigQueryDestination = {} + /** + * Required. The parent resource to export data from. + */ + // const parent = 'abc123' + /** + * A filter to reduce results to a specific subset. Useful for exporting + * conversations with specific properties. + */ + // const filter = 'abc123' + /** + * A fully qualified KMS key name for BigQuery tables protected by CMEK. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} + */ + // const kmsKey = 'abc123' + /** + * Options for what to do if the destination table already exists. + */ + // const writeDisposition = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callExportInsightsData() { + // Construct request + const request = { + parent, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.exportInsightsData(request); + const [response] = await operation.promise(); + console.log(response); + } + + callExportInsightsData(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js new file mode 100644 index 0000000..4e67ed9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the analysis to get. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetAnalysis() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getAnalysis(request); + console.log(response); + } + + callGetAnalysis(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js new file mode 100644 index 0000000..e1c30c1 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js @@ -0,0 +1,57 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the conversation to get. + */ + // const name = 'abc123' + /** + * The level of details of the conversation. Default is `FULL`. + */ + // const view = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetConversation() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getConversation(request); + console.log(response); + } + + callGetConversation(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js new file mode 100644 index 0000000..4fda155 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the issue to get. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetIssue() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getIssue(request); + console.log(response); + } + + callGetIssue(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js new file mode 100644 index 0000000..5324b99 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the issue model to get. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetIssueModel() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getIssueModel(request); + console.log(response); + } + + callGetIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js new file mode 100644 index 0000000..3080a91 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the phrase matcher to get. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetPhraseMatcher() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getPhraseMatcher(request); + console.log(response); + } + + callGetPhraseMatcher(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js new file mode 100644 index 0000000..98d7200 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The name of the settings resource to get. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callGetSettings() { + // Construct request + const request = { + name, + }; + + // Run request + const response = await contactcenterinsightsClient.getSettings(request); + console.log(response); + } + + callGetSettings(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js new file mode 100644 index 0000000..7182520 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js @@ -0,0 +1,73 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the analyses. + */ + // const parent = 'abc123' + /** + * The maximum number of analyses to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + */ + // const pageSize = 1234 + /** + * The value returned by the last `ListAnalysesResponse`; indicates + * that this is a continuation of a prior `ListAnalyses` call and + * the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + */ + // const filter = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callListAnalyses() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await contactcenterinsightsClient.listAnalysesAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListAnalyses(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js new file mode 100644 index 0000000..1dc83a3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js @@ -0,0 +1,77 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the conversation. + */ + // const parent = 'abc123' + /** + * The maximum number of conversations to return in the response. A valid page + * size ranges from 0 to 1,000 inclusive. If the page size is zero or + * unspecified, a default page size of 100 will be chosen. Note that a call + * might return fewer results than the requested page size. + */ + // const pageSize = 1234 + /** + * The value returned by the last `ListConversationsResponse`. This value + * indicates that this is a continuation of a prior `ListConversations` call + * and that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + */ + // const filter = 'abc123' + /** + * The level of details of the conversation. Default is `BASIC`. + */ + // const view = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callListConversations() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await contactcenterinsightsClient.listConversationsAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListConversations(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js new file mode 100644 index 0000000..2f108f3 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the issue model. + */ + // const parent = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callListIssueModels() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await contactcenterinsightsClient.listIssueModels(request); + console.log(response); + } + + callListIssueModels(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js new file mode 100644 index 0000000..7ccfdaf --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js @@ -0,0 +1,53 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the issue. + */ + // const parent = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callListIssues() { + // Construct request + const request = { + parent, + }; + + // Run request + const response = await contactcenterinsightsClient.listIssues(request); + console.log(response); + } + + callListIssues(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js new file mode 100644 index 0000000..7929f1f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js @@ -0,0 +1,73 @@ +// 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. + + +'use strict'; + +function main(parent) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The parent resource of the phrase matcher. + */ + // const parent = 'abc123' + /** + * The maximum number of phrase matchers to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + */ + // const pageSize = 1234 + /** + * The value returned by the last `ListPhraseMatchersResponse`. This value + * indicates that this is a continuation of a prior `ListPhraseMatchers` call + * and that the system should return the next page of data. + */ + // const pageToken = 'abc123' + /** + * A filter to reduce results to a specific subset. Useful for querying + * phrase matchers with specific properties. + */ + // const filter = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callListPhraseMatchers() { + // Construct request + const request = { + parent, + }; + + // Run request + const iterable = await contactcenterinsightsClient.listPhraseMatchersAsync(request); + for await (const response of iterable) { + console.log(response); + } + } + + callListPhraseMatchers(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js new file mode 100644 index 0000000..8de50e0 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js @@ -0,0 +1,54 @@ +// 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. + + +'use strict'; + +function main(name) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The issue model to undeploy. + */ + // const name = 'abc123' + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUndeployIssueModel() { + // Construct request + const request = { + name, + }; + + // Run request + const [operation] = await contactcenterinsightsClient.undeployIssueModel(request); + const [response] = await operation.promise(); + console.log(response); + } + + callUndeployIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js new file mode 100644 index 0000000..69ad78f --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js @@ -0,0 +1,57 @@ +// 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. + + +'use strict'; + +function main(conversation) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the conversation. + */ + // const conversation = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUpdateConversation() { + // Construct request + const request = { + conversation, + }; + + // Run request + const response = await contactcenterinsightsClient.updateConversation(request); + console.log(response); + } + + callUpdateConversation(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js new file mode 100644 index 0000000..c788d85 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js @@ -0,0 +1,57 @@ +// 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. + + +'use strict'; + +function main(issue) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the issue. + */ + // const issue = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUpdateIssue() { + // Construct request + const request = { + issue, + }; + + // Run request + const response = await contactcenterinsightsClient.updateIssue(request); + console.log(response); + } + + callUpdateIssue(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js new file mode 100644 index 0000000..9e32460 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js @@ -0,0 +1,57 @@ +// 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. + + +'use strict'; + +function main(issueModel) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the issue model. + */ + // const issueModel = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUpdateIssueModel() { + // Construct request + const request = { + issueModel, + }; + + // Run request + const response = await contactcenterinsightsClient.updateIssueModel(request); + console.log(response); + } + + callUpdateIssueModel(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js new file mode 100644 index 0000000..b5ebdc9 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js @@ -0,0 +1,57 @@ +// 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. + + +'use strict'; + +function main(phraseMatcher) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new values for the phrase matcher. + */ + // const phraseMatcher = {} + /** + * The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUpdatePhraseMatcher() { + // Construct request + const request = { + phraseMatcher, + }; + + // Run request + const response = await contactcenterinsightsClient.updatePhraseMatcher(request); + console.log(response); + } + + callUpdatePhraseMatcher(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js new file mode 100644 index 0000000..a3fb740 --- /dev/null +++ b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js @@ -0,0 +1,58 @@ +// 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. + + +'use strict'; + +function main(settings, updateMask) { + // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async] + /** + * TODO(developer): Uncomment these variables before running the sample. + */ + /** + * Required. The new settings values. + */ + // const settings = {} + /** + * Required. The list of fields to be updated. + */ + // const updateMask = {} + + // Imports the Contactcenterinsights library + const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; + + // Instantiates a client + const contactcenterinsightsClient = new ContactCenterInsightsClient(); + + async function callUpdateSettings() { + // Construct request + const request = { + settings, + updateMask, + }; + + // Run request + const response = await contactcenterinsightsClient.updateSettings(request); + console.log(response); + } + + callUpdateSettings(); + // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async] +} + +process.on('unhandledRejection', err => { + console.error(err.message); + process.exitCode = 1; +}); +main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts new file mode 100644 index 0000000..fd1c879 --- /dev/null +++ b/owl-bot-staging/v1/src/index.ts @@ -0,0 +1,25 @@ +// 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. +// +// ** This file is automatically generated by gapic-generator-typescript. ** +// ** https://github.com/googleapis/gapic-generator-typescript ** +// ** All changes to this file may be overwritten. ** + +import * as v1 from './v1'; +const ContactCenterInsightsClient = v1.ContactCenterInsightsClient; +type ContactCenterInsightsClient = v1.ContactCenterInsightsClient; +export {v1, ContactCenterInsightsClient}; +export default {v1, ContactCenterInsightsClient}; +import * as protos from '../protos/protos'; +export {protos} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts b/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts new file mode 100644 index 0000000..8f47e09 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts @@ -0,0 +1,3362 @@ +// 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. +// +// ** 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 * as gax from 'google-gax'; +import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; + +import { Transform } from 'stream'; +import { RequestType } from 'google-gax/build/src/apitypes'; +import * as protos from '../../protos/protos'; +import jsonProtos = require('../../protos/protos.json'); +/** + * Client JSON configuration object, loaded from + * `src/v1/contact_center_insights_client_config.json`. + * This file defines retry strategy and timeouts for all API methods in this library. + */ +import * as gapicConfig from './contact_center_insights_client_config.json'; +import { operationsProtos } from 'google-gax'; +const version = require('../../../package.json').version; + +/** + * An API that lets users analyze and explore their business conversation data. + * @class + * @memberof v1 + */ +export class ContactCenterInsightsClient { + private _terminated = false; + private _opts: ClientOptions; + private _providedCustomServicePath: boolean; + private _gaxModule: typeof gax | typeof gax.fallback; + private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; + private _protos: {}; + private _defaults: {[method: string]: gax.CallSettings}; + auth: gax.GoogleAuth; + descriptors: Descriptors = { + page: {}, + stream: {}, + longrunning: {}, + batching: {}, + }; + warn: (code: string, message: string, warnType?: string) => void; + innerApiCalls: {[name: string]: Function}; + pathTemplates: {[name: string]: gax.PathTemplate}; + operationsClient: gax.OperationsClient; + contactCenterInsightsStub?: Promise<{[name: string]: Function}>; + + /** + * Construct an instance of ContactCenterInsightsClient. + * + * @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/master/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} [options.fallback] - Use HTTP fallback mode. + * In fallback mode, a special browser-compatible transport implementation is used + * instead of gRPC transport. In browser context (if the `window` object is defined) + * the fallback mode is enabled automatically; set `options.fallback` to `false` + * if you need to override this behavior. + */ + constructor(opts?: ClientOptions) { + // Ensure that options include all the required fields. + const staticMembers = this.constructor as typeof ContactCenterInsightsClient; + 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; + } + + // Choose either gRPC or proto-over-HTTP implementation of google-gax. + this._gaxModule = opts.fallback ? gax.fallback : gax; + + // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. + this._gaxGrpc = new this._gaxModule.GrpcClient(opts); + + // Save options to use in initialize() method. + this._opts = opts; + + // Save the auth object to the client, for use by other methods. + this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); + + // Set useJWTAccessWithScope on the auth object. + this.auth.useJWTAccessWithScope = true; + + // Set defaultServicePath on the auth object. + this.auth.defaultServicePath = staticMembers.servicePath; + + // Set the default scopes in auth client if needed. + if (servicePath === staticMembers.servicePath) { + this.auth.defaultScopes = staticMembers.scopes; + } + + // Determine the client header string. + const clientHeader = [ + `gax/${this._gaxModule.version}`, + `gapic/${version}`, + ]; + if (typeof process !== 'undefined' && 'versions' in process) { + clientHeader.push(`gl-node/${process.versions.node}`); + } else { + clientHeader.push(`gl-web/${this._gaxModule.version}`); + } + if (!opts.fallback) { + clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); + } else if (opts.fallback === 'rest' ) { + clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); + } + if (opts.libName && opts.libVersion) { + clientHeader.push(`${opts.libName}/${opts.libVersion}`); + } + // Load the applicable protos. + this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); + + // This API contains "path templates"; forward-slash-separated + // identifiers to uniquely identify resources within the API. + // Create useful helper objects for these. + this.pathTemplates = { + analysisPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis}' + ), + conversationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/conversations/{conversation}' + ), + issuePathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue}' + ), + issueModelPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/issueModels/{issue_model}' + ), + locationPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}' + ), + phraseMatcherPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher}' + ), + settingsPathTemplate: new this._gaxModule.PathTemplate( + 'projects/{project}/locations/{location}/settings' + ), + }; + + // 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'), + listAnalyses: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'analyses'), + listPhraseMatchers: + new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'phraseMatchers') + }; + + 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. + + this.operationsClient = this._gaxModule.lro({ + auth: this.auth, + grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined + }).operationsClient(opts); + const createAnalysisResponse = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.Analysis') as gax.protobuf.Type; + const createAnalysisMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.CreateAnalysisOperationMetadata') as gax.protobuf.Type; + const exportInsightsDataResponse = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse') as gax.protobuf.Type; + const exportInsightsDataMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.ExportInsightsDataMetadata') as gax.protobuf.Type; + const createIssueModelResponse = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.IssueModel') as gax.protobuf.Type; + const createIssueModelMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.CreateIssueModelMetadata') as gax.protobuf.Type; + const deleteIssueModelResponse = protoFilesRoot.lookup( + '.google.protobuf.Empty') as gax.protobuf.Type; + const deleteIssueModelMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.DeleteIssueModelMetadata') as gax.protobuf.Type; + const deployIssueModelResponse = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse') as gax.protobuf.Type; + const deployIssueModelMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.DeployIssueModelMetadata') as gax.protobuf.Type; + const undeployIssueModelResponse = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse') as gax.protobuf.Type; + const undeployIssueModelMetadata = protoFilesRoot.lookup( + '.google.cloud.contactcenterinsights.v1.UndeployIssueModelMetadata') as gax.protobuf.Type; + + this.descriptors.longrunning = { + createAnalysis: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createAnalysisResponse.decode.bind(createAnalysisResponse), + createAnalysisMetadata.decode.bind(createAnalysisMetadata)), + exportInsightsData: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + exportInsightsDataResponse.decode.bind(exportInsightsDataResponse), + exportInsightsDataMetadata.decode.bind(exportInsightsDataMetadata)), + createIssueModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + createIssueModelResponse.decode.bind(createIssueModelResponse), + createIssueModelMetadata.decode.bind(createIssueModelMetadata)), + deleteIssueModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deleteIssueModelResponse.decode.bind(deleteIssueModelResponse), + deleteIssueModelMetadata.decode.bind(deleteIssueModelMetadata)), + deployIssueModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + deployIssueModelResponse.decode.bind(deployIssueModelResponse), + deployIssueModelMetadata.decode.bind(deployIssueModelMetadata)), + undeployIssueModel: new this._gaxModule.LongrunningDescriptor( + this.operationsClient, + undeployIssueModelResponse.decode.bind(undeployIssueModelResponse), + undeployIssueModelMetadata.decode.bind(undeployIssueModelMetadata)) + }; + + // Put together the default options sent with requests. + this._defaults = this._gaxGrpc.constructSettings( + 'google.cloud.contactcenterinsights.v1.ContactCenterInsights', 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 = gax.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.contactCenterInsightsStub) { + return this.contactCenterInsightsStub; + } + + // Put together the "service stub" for + // google.cloud.contactcenterinsights.v1.ContactCenterInsights. + this.contactCenterInsightsStub = this._gaxGrpc.createStub( + this._opts.fallback ? + (this._protos as protobuf.Root).lookupService('google.cloud.contactcenterinsights.v1.ContactCenterInsights') : + // eslint-disable-next-line @typescript-eslint/no-explicit-any + (this._protos as any).google.cloud.contactcenterinsights.v1.ContactCenterInsights, + 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 contactCenterInsightsStubMethods = + ['createConversation', 'updateConversation', 'getConversation', 'listConversations', 'deleteConversation', 'createAnalysis', 'getAnalysis', 'listAnalyses', 'deleteAnalysis', 'exportInsightsData', 'createIssueModel', 'updateIssueModel', 'getIssueModel', 'listIssueModels', 'deleteIssueModel', 'deployIssueModel', 'undeployIssueModel', 'getIssue', 'listIssues', 'updateIssue', 'calculateIssueModelStats', 'createPhraseMatcher', 'getPhraseMatcher', 'listPhraseMatchers', 'deletePhraseMatcher', 'updatePhraseMatcher', 'calculateStats', 'getSettings', 'updateSettings']; + for (const methodName of contactCenterInsightsStubMethods) { + const callPromise = this.contactCenterInsightsStub.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.innerApiCalls[methodName] = apiCall; + } + + return this.contactCenterInsightsStub; + } + + /** + * The DNS address for this API service. + * @returns {string} The DNS address for this service. + */ + static get servicePath() { + return 'contactcenterinsights.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 'contactcenterinsights.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' + ]; + } + + 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 conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the conversation. + * @param {google.cloud.contactcenterinsights.v1.Conversation} request.conversation + * Required. The conversation resource to create. + * @param {string} request.conversationId + * A unique ID for the new conversation. This ID will become the final + * component of the conversation's resource name. If no ID is specified, a + * server-generated ID will be used. + * + * This value should be 4-64 characters and must match the regular + * expression `^{@link 0-9|a-z0-9-]{4,64}$`. Valid characters are `[a-z}-` + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.contactcenterinsights.v1.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/v1/contact_center_insights.create_conversation.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async + */ + createConversation( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|undefined, {}|undefined + ]>; + createConversation( + request: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; + createConversation( + request: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): void; + createConversation( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createConversation(request, options, callback); + } +/** + * Updates a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.Conversation} request.conversation + * Required. The new values for the conversation. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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 [Conversation]{@link google.cloud.contactcenterinsights.v1.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/v1/contact_center_insights.update_conversation.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async + */ + updateConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|undefined, {}|undefined + ]>; + updateConversation( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, + {}|null|undefined>): void; + updateConversation( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, + {}|null|undefined>): void; + updateConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|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' + ] = gax.routingHeader.fromParams({ + 'conversation.name': request.conversation!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateConversation(request, options, callback); + } +/** + * Gets a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation to get. + * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view + * The level of details of the conversation. Default is `FULL`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.contactcenterinsights.v1.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/v1/contact_center_insights.get_conversation.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async + */ + getConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|undefined, {}|undefined + ]>; + getConversation( + request: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; + getConversation( + request: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, + {}|null|undefined>): void; + getConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation, + protos.google.cloud.contactcenterinsights.v1.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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getConversation(request, options, callback); + } +/** + * Deletes a conversation. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the conversation to delete. + * @param {boolean} request.force + * If set to true, all of this conversation's analyses will also be deleted. + * Otherwise, the request will only succeed if the conversation has no + * analyses. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.delete_conversation.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async + */ + deleteConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|undefined, {}|undefined + ]>; + deleteConversation( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, + {}|null|undefined>): void; + deleteConversation( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, + {}|null|undefined>): void; + deleteConversation( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteConversation(request, options, callback); + } +/** + * Gets an analysis. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the analysis to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.get_analysis.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async + */ + getAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|undefined, {}|undefined + ]>; + getAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, + {}|null|undefined>): void; + getAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, + {}|null|undefined>): void; + getAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IAnalysis, + protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getAnalysis(request, options, callback); + } +/** + * Deletes an analysis. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the analysis to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.delete_analysis.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async + */ + deleteAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|undefined, {}|undefined + ]>; + deleteAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, + {}|null|undefined>): void; + deleteAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, + {}|null|undefined>): void; + deleteAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteAnalysis(request, options, callback); + } +/** + * Updates an issue model. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.IssueModel} request.issueModel + * Required. The new values for the issue model. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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 [IssueModel]{@link google.cloud.contactcenterinsights.v1.IssueModel}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.update_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async + */ + updateIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|undefined, {}|undefined + ]>; + updateIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, + {}|null|undefined>): void; + updateIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, + {}|null|undefined>): void; + updateIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|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' + ] = gax.routingHeader.fromParams({ + 'issue_model.name': request.issueModel!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIssueModel(request, options, callback); + } +/** + * Gets an issue model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the issue model to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [IssueModel]{@link google.cloud.contactcenterinsights.v1.IssueModel}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.get_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async + */ + getIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|undefined, {}|undefined + ]>; + getIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, + {}|null|undefined>): void; + getIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, + {}|null|undefined>): void; + getIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssueModel, + protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getIssueModel(request, options, callback); + } +/** + * Lists issue models. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the issue model. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListIssueModelsResponse]{@link google.cloud.contactcenterinsights.v1.ListIssueModelsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.list_issue_models.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async + */ + listIssueModels( + request?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|undefined, {}|undefined + ]>; + listIssueModels( + request: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, + {}|null|undefined>): void; + listIssueModels( + request: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, + {}|null|undefined>): void; + listIssueModels( + request?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listIssueModels(request, options, callback); + } +/** + * Gets an issue. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the issue to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Issue]{@link google.cloud.contactcenterinsights.v1.Issue}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.get_issue.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async + */ + getIssue( + request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|undefined, {}|undefined + ]>; + getIssue( + request: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, + {}|null|undefined>): void; + getIssue( + request: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, + {}|null|undefined>): void; + getIssue( + request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getIssue(request, options, callback); + } +/** + * Lists issues. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the issue. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [ListIssuesResponse]{@link google.cloud.contactcenterinsights.v1.ListIssuesResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.list_issues.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async + */ + listIssues( + request?: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|undefined, {}|undefined + ]>; + listIssues( + request: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, + {}|null|undefined>): void; + listIssues( + request: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, + {}|null|undefined>): void; + listIssues( + request?: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, + protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listIssues(request, options, callback); + } +/** + * Updates an issue. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.Issue} request.issue + * Required. The new values for the issue. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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 [Issue]{@link google.cloud.contactcenterinsights.v1.Issue}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.update_issue.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async + */ + updateIssue( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|undefined, {}|undefined + ]>; + updateIssue( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, + {}|null|undefined>): void; + updateIssue( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, + {}|null|undefined>): void; + updateIssue( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IIssue, + protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|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' + ] = gax.routingHeader.fromParams({ + 'issue.name': request.issue!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateIssue(request, options, callback); + } +/** + * Gets an issue model's statistics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.issueModel + * Required. The resource name of the issue model to query against. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CalculateIssueModelStatsResponse]{@link google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async + */ + calculateIssueModelStats( + request?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|undefined, {}|undefined + ]>; + calculateIssueModelStats( + request: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, + {}|null|undefined>): void; + calculateIssueModelStats( + request: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, + {}|null|undefined>): void; + calculateIssueModelStats( + request?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|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' + ] = gax.routingHeader.fromParams({ + 'issue_model': request.issueModel || '', + }); + this.initialize(); + return this.innerApiCalls.calculateIssueModelStats(request, options, callback); + } +/** + * Creates a phrase matcher. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the phrase matcher. Required. The location to create + * a phrase matcher for. + * Format: `projects//locations/` or + * `projects//locations/` + * @param {google.cloud.contactcenterinsights.v1.PhraseMatcher} request.phraseMatcher + * Required. The phrase matcher resource 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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.create_phrase_matcher.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async + */ + createPhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|undefined, {}|undefined + ]>; + createPhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + createPhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + createPhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createPhraseMatcher(request, options, callback); + } +/** + * Gets a phrase matcher. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the phrase matcher to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.get_phrase_matcher.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async + */ + getPhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|undefined, {}|undefined + ]>; + getPhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + getPhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + getPhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getPhraseMatcher(request, options, callback); + } +/** + * Deletes a phrase matcher. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the phrase matcher to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.delete_phrase_matcher.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async + */ + deletePhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, + options?: CallOptions): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|undefined, {}|undefined + ]>; + deletePhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, + options: CallOptions, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + deletePhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, + callback: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + deletePhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.protobuf.IEmpty, + protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deletePhraseMatcher(request, options, callback); + } +/** + * Updates a phrase matcher. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.PhraseMatcher} request.phraseMatcher + * Required. The new values for the phrase matcher. + * @param {google.protobuf.FieldMask} request.updateMask + * The list of fields to 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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.update_phrase_matcher.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async + */ + updatePhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|undefined, {}|undefined + ]>; + updatePhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + updatePhraseMatcher( + request: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): void; + updatePhraseMatcher( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, + protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|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' + ] = gax.routingHeader.fromParams({ + 'phrase_matcher.name': request.phraseMatcher!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updatePhraseMatcher(request, options, callback); + } +/** + * Gets conversation statistics. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.location + * Required. The location of the conversations. + * @param {string} request.filter + * A filter to reduce results to a specific subset. This field is useful for + * getting statistics about conversations with specific properties. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [CalculateStatsResponse]{@link google.cloud.contactcenterinsights.v1.CalculateStatsResponse}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.calculate_stats.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async + */ + calculateStats( + request?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|undefined, {}|undefined + ]>; + calculateStats( + request: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, + {}|null|undefined>): void; + calculateStats( + request: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, + {}|null|undefined>): void; + calculateStats( + request?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, + protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|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' + ] = gax.routingHeader.fromParams({ + 'location': request.location || '', + }); + this.initialize(); + return this.innerApiCalls.calculateStats(request, options, callback); + } +/** + * Gets project-level settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the settings resource to get. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing [Settings]{@link google.cloud.contactcenterinsights.v1.Settings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.get_settings.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async + */ + getSettings( + request?: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|undefined, {}|undefined + ]>; + getSettings( + request: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): void; + getSettings( + request?: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.getSettings(request, options, callback); + } +/** + * Updates project-level settings. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.Settings} request.settings + * Required. The new settings values. + * @param {google.protobuf.FieldMask} request.updateMask + * Required. The list of fields to 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 [Settings]{@link google.cloud.contactcenterinsights.v1.Settings}. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.update_settings.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async + */ + updateSettings( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|undefined, {}|undefined + ]>; + updateSettings( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, + options: CallOptions, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, + callback: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): void; + updateSettings( + request?: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, + optionsOrCallback?: CallOptions|Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>, + callback?: Callback< + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, + {}|null|undefined>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.ISettings, + protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|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' + ] = gax.routingHeader.fromParams({ + 'settings.name': request.settings!.name || '', + }); + this.initialize(); + return this.innerApiCalls.updateSettings(request, options, callback); + } + +/** + * Creates an analysis. The long running operation is done when the analysis + * has completed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the analysis. + * @param {google.cloud.contactcenterinsights.v1.Analysis} request.analysis + * Required. The analysis 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/v1/contact_center_insights.create_analysis.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async + */ + createAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAnalysis( + request: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createAnalysis( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createAnalysis(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createAnalysis()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.create_analysis.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async + */ + async checkCreateAnalysisProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createAnalysis, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Export insights data to a destination defined in the request body. + * + * @param {Object} request + * The request object that will be sent. + * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.BigQueryDestination} request.bigQueryDestination + * Specified if sink is a BigQuery table. + * @param {string} request.parent + * Required. The parent resource to export data from. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for exporting + * conversations with specific properties. + * @param {string} request.kmsKey + * A fully qualified KMS key name for BigQuery tables protected by CMEK. + * Format: + * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} + * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} request.writeDisposition + * Options for what to do if the destination table already exists. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.export_insights_data.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async + */ + exportInsightsData( + request?: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + exportInsightsData( + request: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportInsightsData( + request: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + exportInsightsData( + request?: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.exportInsightsData(request, options, callback); + } +/** + * Check the status of the long running operation returned by `exportInsightsData()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.export_insights_data.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async + */ + async checkExportInsightsDataProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportInsightsData, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Creates an issue model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the issue model. + * @param {google.cloud.contactcenterinsights.v1.IssueModel} request.issueModel + * Required. The issue 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/v1/contact_center_insights.create_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async + */ + createIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + createIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + createIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.createIssueModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `createIssueModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.create_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async + */ + async checkCreateIssueModelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createIssueModel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deletes an issue model. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The name of the issue model to delete. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.delete_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async + */ + deleteIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deleteIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deleteIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deleteIssueModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deleteIssueModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.delete_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async + */ + async checkDeleteIssueModelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteIssueModel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Deploys an issue model. Returns an error if a model is already deployed. + * An issue model can only be used in analysis after it has been deployed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The issue model to deploy. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.deploy_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async + */ + deployIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + deployIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deployIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + deployIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.deployIssueModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `deployIssueModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.deploy_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async + */ + async checkDeployIssueModelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deployIssueModel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } +/** + * Undeploys an issue model. + * An issue model can not be used in analysis after it has been undeployed. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.name + * Required. The issue model to undeploy. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. + * @returns {Promise} - The promise which resolves to an array. + * The first element of the array is an object representing + * a long running operation. Its `promise()` method returns a promise + * you can `await` for. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.undeploy_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async + */ + undeployIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, + options?: CallOptions): + Promise<[ + LROperation, + protos.google.longrunning.IOperation|undefined, {}|undefined + ]>; + undeployIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, + options: CallOptions, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeployIssueModel( + request: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, + callback: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): void; + undeployIssueModel( + request?: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, + optionsOrCallback?: CallOptions|Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>, + callback?: Callback< + LROperation, + protos.google.longrunning.IOperation|null|undefined, + {}|null|undefined>): + Promise<[ + LROperation, + 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' + ] = gax.routingHeader.fromParams({ + 'name': request.name || '', + }); + this.initialize(); + return this.innerApiCalls.undeployIssueModel(request, options, callback); + } +/** + * Check the status of the long running operation returned by `undeployIssueModel()`. + * @param {String} name + * The operation name that will be passed. + * @returns {Promise} - The promise which resolves to an object. + * The decoded operation object has result and metadata field to get information from. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.undeploy_issue_model.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async + */ + async checkUndeployIssueModelProgress(name: string): Promise>{ + const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); + const [operation] = await this.operationsClient.getOperation(request); + const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.undeployIssueModel, gax.createDefaultBackoffSettings()); + return decodeOperation as LROperation; + } + /** + * Lists conversations. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the conversation. + * @param {number} request.pageSize + * The maximum number of conversations to return in the response. A valid page + * size ranges from 0 to 1,000 inclusive. If the page size is zero or + * unspecified, a default page size of 100 will be chosen. Note that a call + * might return fewer results than the requested page size. + * @param {string} request.pageToken + * The value returned by the last `ListConversationsResponse`. This value + * indicates that this is a continuation of a prior `ListConversations` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view + * The level of details of the conversation. Default is `BASIC`. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.contactcenterinsights.v1.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.contactcenterinsights.v1.IListConversationsRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation[], + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest|null, + protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse + ]>; + listConversations( + request: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IConversation>): void; + listConversations( + request: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IConversation>): void; + listConversations( + request?: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IConversation>, + callback?: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, + protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IConversation>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IConversation[], + protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest|null, + protos.google.cloud.contactcenterinsights.v1.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' + ] = gax.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 parent resource of the conversation. + * @param {number} request.pageSize + * The maximum number of conversations to return in the response. A valid page + * size ranges from 0 to 1,000 inclusive. If the page size is zero or + * unspecified, a default page size of 100 will be chosen. Note that a call + * might return fewer results than the requested page size. + * @param {string} request.pageToken + * The value returned by the last `ListConversationsResponse`. This value + * indicates that this is a continuation of a prior `ListConversations` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view + * The level of details of the conversation. Default is `BASIC`. + * @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.contactcenterinsights.v1.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.contactcenterinsights.v1.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' + ] = gax.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 gax.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 parent resource of the conversation. + * @param {number} request.pageSize + * The maximum number of conversations to return in the response. A valid page + * size ranges from 0 to 1,000 inclusive. If the page size is zero or + * unspecified, a default page size of 100 will be chosen. Note that a call + * might return fewer results than the requested page size. + * @param {string} request.pageToken + * The value returned by the last `ListConversationsResponse`. This value + * indicates that this is a continuation of a prior `ListConversations` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view + * The level of details of the conversation. Default is `BASIC`. + * @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.contactcenterinsights.v1.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/v1/contact_center_insights.list_conversations.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async + */ + listConversationsAsync( + request?: protos.google.cloud.contactcenterinsights.v1.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' + ] = gax.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 unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists analyses. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the analyses. + * @param {number} request.pageSize + * The maximum number of analyses to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListAnalysesResponse`; indicates + * that this is a continuation of a prior `ListAnalyses` call and + * the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. + * 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 `listAnalysesAsync()` + * 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. + */ + listAnalyses( + request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IAnalysis[], + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest|null, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse + ]>; + listAnalyses( + request: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IAnalysis>): void; + listAnalyses( + request: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IAnalysis>): void; + listAnalyses( + request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IAnalysis>, + callback?: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IAnalysis>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IAnalysis[], + protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest|null, + protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listAnalyses(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 parent resource of the analyses. + * @param {number} request.pageSize + * The maximum number of analyses to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListAnalysesResponse`; indicates + * that this is a continuation of a prior `ListAnalyses` call and + * the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @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 [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis} 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 `listAnalysesAsync()` + * 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. + */ + listAnalysesStream( + request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAnalyses']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnalyses.createStream( + this.innerApiCalls.listAnalyses as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listAnalyses`, 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 parent resource of the analyses. + * @param {number} request.pageSize + * The maximum number of analyses to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListAnalysesResponse`; indicates + * that this is a continuation of a prior `ListAnalyses` call and + * the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * conversations with specific properties. + * @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 + * [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.list_analyses.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async + */ + listAnalysesAsync( + request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listAnalyses']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listAnalyses.asyncIterate( + this.innerApiCalls['listAnalyses'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + /** + * Lists phrase matchers. + * + * @param {Object} request + * The request object that will be sent. + * @param {string} request.parent + * Required. The parent resource of the phrase matcher. + * @param {number} request.pageSize + * The maximum number of phrase matchers to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListPhraseMatchersResponse`. This value + * indicates that this is a continuation of a prior `ListPhraseMatchers` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * phrase matchers with specific properties. + * @param {object} [options] + * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. + * 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 `listPhraseMatchersAsync()` + * 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. + */ + listPhraseMatchers( + request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + options?: CallOptions): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[], + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest|null, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse + ]>; + listPhraseMatchers( + request: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + options: CallOptions, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): void; + listPhraseMatchers( + request: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + callback: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): void; + listPhraseMatchers( + request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + optionsOrCallback?: CallOptions|PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>, + callback?: PaginationCallback< + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): + Promise<[ + protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[], + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest|null, + protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse + ]>|void { + request = request || {}; + let options: CallOptions; + if (typeof 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' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + this.initialize(); + return this.innerApiCalls.listPhraseMatchers(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 parent resource of the phrase matcher. + * @param {number} request.pageSize + * The maximum number of phrase matchers to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListPhraseMatchersResponse`. This value + * indicates that this is a continuation of a prior `ListPhraseMatchers` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * phrase matchers with specific properties. + * @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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher} 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 `listPhraseMatchersAsync()` + * 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. + */ + listPhraseMatchersStream( + request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + options?: CallOptions): + Transform{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listPhraseMatchers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPhraseMatchers.createStream( + this.innerApiCalls.listPhraseMatchers as gax.GaxCall, + request, + callSettings + ); + } + +/** + * Equivalent to `listPhraseMatchers`, 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 parent resource of the phrase matcher. + * @param {number} request.pageSize + * The maximum number of phrase matchers to return in the response. If this + * value is zero, the service will select a default size. A call might return + * fewer objects than requested. A non-empty `next_page_token` in the response + * indicates that more data is available. + * @param {string} request.pageToken + * The value returned by the last `ListPhraseMatchersResponse`. This value + * indicates that this is a continuation of a prior `ListPhraseMatchers` call + * and that the system should return the next page of data. + * @param {string} request.filter + * A filter to reduce results to a specific subset. Useful for querying + * phrase matchers with specific properties. + * @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 + * [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. The API will be called under the hood as needed, once per the page, + * so you can stop the iteration when you don't need more results. + * Please see the + * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) + * for more details and examples. + * @example include:samples/generated/v1/contact_center_insights.list_phrase_matchers.js + * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async + */ + listPhraseMatchersAsync( + request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, + options?: CallOptions): + AsyncIterable{ + request = request || {}; + options = options || {}; + options.otherArgs = options.otherArgs || {}; + options.otherArgs.headers = options.otherArgs.headers || {}; + options.otherArgs.headers[ + 'x-goog-request-params' + ] = gax.routingHeader.fromParams({ + 'parent': request.parent || '', + }); + const defaultCallSettings = this._defaults['listPhraseMatchers']; + const callSettings = defaultCallSettings.merge(options); + this.initialize(); + return this.descriptors.page.listPhraseMatchers.asyncIterate( + this.innerApiCalls['listPhraseMatchers'] as GaxCall, + request as unknown as RequestType, + callSettings + ) as AsyncIterable; + } + // -------------------- + // -- Path templates -- + // -------------------- + + /** + * Return a fully-qualified analysis resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @param {string} analysis + * @returns {string} Resource name string. + */ + analysisPath(project:string,location:string,conversation:string,analysis:string) { + return this.pathTemplates.analysisPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + analysis: analysis, + }); + } + + /** + * Parse the project from Analysis resource. + * + * @param {string} analysisName + * A fully-qualified path representing Analysis resource. + * @returns {string} A string representing the project. + */ + matchProjectFromAnalysisName(analysisName: string) { + return this.pathTemplates.analysisPathTemplate.match(analysisName).project; + } + + /** + * Parse the location from Analysis resource. + * + * @param {string} analysisName + * A fully-qualified path representing Analysis resource. + * @returns {string} A string representing the location. + */ + matchLocationFromAnalysisName(analysisName: string) { + return this.pathTemplates.analysisPathTemplate.match(analysisName).location; + } + + /** + * Parse the conversation from Analysis resource. + * + * @param {string} analysisName + * A fully-qualified path representing Analysis resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromAnalysisName(analysisName: string) { + return this.pathTemplates.analysisPathTemplate.match(analysisName).conversation; + } + + /** + * Parse the analysis from Analysis resource. + * + * @param {string} analysisName + * A fully-qualified path representing Analysis resource. + * @returns {string} A string representing the analysis. + */ + matchAnalysisFromAnalysisName(analysisName: string) { + return this.pathTemplates.analysisPathTemplate.match(analysisName).analysis; + } + + /** + * Return a fully-qualified conversation resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} conversation + * @returns {string} Resource name string. + */ + conversationPath(project:string,location:string,conversation:string) { + return this.pathTemplates.conversationPathTemplate.render({ + project: project, + location: location, + conversation: conversation, + }); + } + + /** + * Parse the project from Conversation resource. + * + * @param {string} conversationName + * A fully-qualified path representing Conversation resource. + * @returns {string} A string representing the project. + */ + matchProjectFromConversationName(conversationName: string) { + return this.pathTemplates.conversationPathTemplate.match(conversationName).project; + } + + /** + * Parse the location from Conversation resource. + * + * @param {string} conversationName + * A fully-qualified path representing Conversation resource. + * @returns {string} A string representing the location. + */ + matchLocationFromConversationName(conversationName: string) { + return this.pathTemplates.conversationPathTemplate.match(conversationName).location; + } + + /** + * Parse the conversation from Conversation resource. + * + * @param {string} conversationName + * A fully-qualified path representing Conversation resource. + * @returns {string} A string representing the conversation. + */ + matchConversationFromConversationName(conversationName: string) { + return this.pathTemplates.conversationPathTemplate.match(conversationName).conversation; + } + + /** + * Return a fully-qualified issue resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} issue_model + * @param {string} issue + * @returns {string} Resource name string. + */ + issuePath(project:string,location:string,issueModel:string,issue:string) { + return this.pathTemplates.issuePathTemplate.render({ + project: project, + location: location, + issue_model: issueModel, + issue: issue, + }); + } + + /** + * Parse the project from Issue resource. + * + * @param {string} issueName + * A fully-qualified path representing Issue resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIssueName(issueName: string) { + return this.pathTemplates.issuePathTemplate.match(issueName).project; + } + + /** + * Parse the location from Issue resource. + * + * @param {string} issueName + * A fully-qualified path representing Issue resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIssueName(issueName: string) { + return this.pathTemplates.issuePathTemplate.match(issueName).location; + } + + /** + * Parse the issue_model from Issue resource. + * + * @param {string} issueName + * A fully-qualified path representing Issue resource. + * @returns {string} A string representing the issue_model. + */ + matchIssueModelFromIssueName(issueName: string) { + return this.pathTemplates.issuePathTemplate.match(issueName).issue_model; + } + + /** + * Parse the issue from Issue resource. + * + * @param {string} issueName + * A fully-qualified path representing Issue resource. + * @returns {string} A string representing the issue. + */ + matchIssueFromIssueName(issueName: string) { + return this.pathTemplates.issuePathTemplate.match(issueName).issue; + } + + /** + * Return a fully-qualified issueModel resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} issue_model + * @returns {string} Resource name string. + */ + issueModelPath(project:string,location:string,issueModel:string) { + return this.pathTemplates.issueModelPathTemplate.render({ + project: project, + location: location, + issue_model: issueModel, + }); + } + + /** + * Parse the project from IssueModel resource. + * + * @param {string} issueModelName + * A fully-qualified path representing IssueModel resource. + * @returns {string} A string representing the project. + */ + matchProjectFromIssueModelName(issueModelName: string) { + return this.pathTemplates.issueModelPathTemplate.match(issueModelName).project; + } + + /** + * Parse the location from IssueModel resource. + * + * @param {string} issueModelName + * A fully-qualified path representing IssueModel resource. + * @returns {string} A string representing the location. + */ + matchLocationFromIssueModelName(issueModelName: string) { + return this.pathTemplates.issueModelPathTemplate.match(issueModelName).location; + } + + /** + * Parse the issue_model from IssueModel resource. + * + * @param {string} issueModelName + * A fully-qualified path representing IssueModel resource. + * @returns {string} A string representing the issue_model. + */ + matchIssueModelFromIssueModelName(issueModelName: string) { + return this.pathTemplates.issueModelPathTemplate.match(issueModelName).issue_model; + } + + /** + * 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 phraseMatcher resource name string. + * + * @param {string} project + * @param {string} location + * @param {string} phrase_matcher + * @returns {string} Resource name string. + */ + phraseMatcherPath(project:string,location:string,phraseMatcher:string) { + return this.pathTemplates.phraseMatcherPathTemplate.render({ + project: project, + location: location, + phrase_matcher: phraseMatcher, + }); + } + + /** + * Parse the project from PhraseMatcher resource. + * + * @param {string} phraseMatcherName + * A fully-qualified path representing PhraseMatcher resource. + * @returns {string} A string representing the project. + */ + matchProjectFromPhraseMatcherName(phraseMatcherName: string) { + return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).project; + } + + /** + * Parse the location from PhraseMatcher resource. + * + * @param {string} phraseMatcherName + * A fully-qualified path representing PhraseMatcher resource. + * @returns {string} A string representing the location. + */ + matchLocationFromPhraseMatcherName(phraseMatcherName: string) { + return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).location; + } + + /** + * Parse the phrase_matcher from PhraseMatcher resource. + * + * @param {string} phraseMatcherName + * A fully-qualified path representing PhraseMatcher resource. + * @returns {string} A string representing the phrase_matcher. + */ + matchPhraseMatcherFromPhraseMatcherName(phraseMatcherName: string) { + return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).phrase_matcher; + } + + /** + * Return a fully-qualified settings resource name string. + * + * @param {string} project + * @param {string} location + * @returns {string} Resource name string. + */ + settingsPath(project:string,location:string) { + return this.pathTemplates.settingsPathTemplate.render({ + project: project, + location: location, + }); + } + + /** + * Parse the project from Settings resource. + * + * @param {string} settingsName + * A fully-qualified path representing Settings resource. + * @returns {string} A string representing the project. + */ + matchProjectFromSettingsName(settingsName: string) { + return this.pathTemplates.settingsPathTemplate.match(settingsName).project; + } + + /** + * Parse the location from Settings resource. + * + * @param {string} settingsName + * A fully-qualified path representing Settings resource. + * @returns {string} A string representing the location. + */ + matchLocationFromSettingsName(settingsName: string) { + return this.pathTemplates.settingsPathTemplate.match(settingsName).location; + } + + /** + * 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 { + this.initialize(); + if (!this._terminated) { + return this.contactCenterInsightsStub!.then(stub => { + this._terminated = true; + stub.close(); + this.operationsClient.close(); + }); + } + return Promise.resolve(); + } +} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json b/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json new file mode 100644 index 0000000..1c9d282 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json @@ -0,0 +1,183 @@ +{ + "interfaces": { + "google.cloud.contactcenterinsights.v1.ContactCenterInsights": { + "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 + }, + "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { + "initial_retry_delay_millis": 1000, + "retry_delay_multiplier": 1.3, + "max_retry_delay_millis": 10000, + "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": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListConversations": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteConversation": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateAnalysis": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetAnalysis": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListAnalyses": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteAnalysis": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ExportInsightsData": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreateIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListIssueModels": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeleteIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeployIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UndeployIssueModel": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetIssue": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListIssues": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateIssue": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CalculateIssueModelStats": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CreatePhraseMatcher": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetPhraseMatcher": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "ListPhraseMatchers": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "DeletePhraseMatcher": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdatePhraseMatcher": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "CalculateStats": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "GetSettings": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + }, + "UpdateSettings": { + "timeout_millis": 60000, + "retry_codes_name": "unavailable", + "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json b/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json new file mode 100644 index 0000000..a3a2efb --- /dev/null +++ b/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json @@ -0,0 +1,4 @@ +[ + "../../protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto", + "../../protos/google/cloud/contactcenterinsights/v1/resources.proto" +] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json new file mode 100644 index 0000000..a2b4ec4 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/gapic_metadata.json @@ -0,0 +1,325 @@ +{ + "schema": "1.0", + "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", + "language": "typescript", + "protoPackage": "google.cloud.contactcenterinsights.v1", + "libraryPackage": "@google-cloud/contact-center-insights", + "services": { + "ContactCenterInsights": { + "clients": { + "grpc": { + "libraryClient": "ContactCenterInsightsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "UpdateConversation": { + "methods": [ + "updateConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "DeleteConversation": { + "methods": [ + "deleteConversation" + ] + }, + "GetAnalysis": { + "methods": [ + "getAnalysis" + ] + }, + "DeleteAnalysis": { + "methods": [ + "deleteAnalysis" + ] + }, + "UpdateIssueModel": { + "methods": [ + "updateIssueModel" + ] + }, + "GetIssueModel": { + "methods": [ + "getIssueModel" + ] + }, + "ListIssueModels": { + "methods": [ + "listIssueModels" + ] + }, + "GetIssue": { + "methods": [ + "getIssue" + ] + }, + "ListIssues": { + "methods": [ + "listIssues" + ] + }, + "UpdateIssue": { + "methods": [ + "updateIssue" + ] + }, + "CalculateIssueModelStats": { + "methods": [ + "calculateIssueModelStats" + ] + }, + "CreatePhraseMatcher": { + "methods": [ + "createPhraseMatcher" + ] + }, + "GetPhraseMatcher": { + "methods": [ + "getPhraseMatcher" + ] + }, + "DeletePhraseMatcher": { + "methods": [ + "deletePhraseMatcher" + ] + }, + "UpdatePhraseMatcher": { + "methods": [ + "updatePhraseMatcher" + ] + }, + "CalculateStats": { + "methods": [ + "calculateStats" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateAnalysis": { + "methods": [ + "createAnalysis" + ] + }, + "ExportInsightsData": { + "methods": [ + "exportInsightsData" + ] + }, + "CreateIssueModel": { + "methods": [ + "createIssueModel" + ] + }, + "DeleteIssueModel": { + "methods": [ + "deleteIssueModel" + ] + }, + "DeployIssueModel": { + "methods": [ + "deployIssueModel" + ] + }, + "UndeployIssueModel": { + "methods": [ + "undeployIssueModel" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListAnalyses": { + "methods": [ + "listAnalyses", + "listAnalysesStream", + "listAnalysesAsync" + ] + }, + "ListPhraseMatchers": { + "methods": [ + "listPhraseMatchers", + "listPhraseMatchersStream", + "listPhraseMatchersAsync" + ] + } + } + }, + "grpc-fallback": { + "libraryClient": "ContactCenterInsightsClient", + "rpcs": { + "CreateConversation": { + "methods": [ + "createConversation" + ] + }, + "UpdateConversation": { + "methods": [ + "updateConversation" + ] + }, + "GetConversation": { + "methods": [ + "getConversation" + ] + }, + "DeleteConversation": { + "methods": [ + "deleteConversation" + ] + }, + "GetAnalysis": { + "methods": [ + "getAnalysis" + ] + }, + "DeleteAnalysis": { + "methods": [ + "deleteAnalysis" + ] + }, + "UpdateIssueModel": { + "methods": [ + "updateIssueModel" + ] + }, + "GetIssueModel": { + "methods": [ + "getIssueModel" + ] + }, + "ListIssueModels": { + "methods": [ + "listIssueModels" + ] + }, + "GetIssue": { + "methods": [ + "getIssue" + ] + }, + "ListIssues": { + "methods": [ + "listIssues" + ] + }, + "UpdateIssue": { + "methods": [ + "updateIssue" + ] + }, + "CalculateIssueModelStats": { + "methods": [ + "calculateIssueModelStats" + ] + }, + "CreatePhraseMatcher": { + "methods": [ + "createPhraseMatcher" + ] + }, + "GetPhraseMatcher": { + "methods": [ + "getPhraseMatcher" + ] + }, + "DeletePhraseMatcher": { + "methods": [ + "deletePhraseMatcher" + ] + }, + "UpdatePhraseMatcher": { + "methods": [ + "updatePhraseMatcher" + ] + }, + "CalculateStats": { + "methods": [ + "calculateStats" + ] + }, + "GetSettings": { + "methods": [ + "getSettings" + ] + }, + "UpdateSettings": { + "methods": [ + "updateSettings" + ] + }, + "CreateAnalysis": { + "methods": [ + "createAnalysis" + ] + }, + "ExportInsightsData": { + "methods": [ + "exportInsightsData" + ] + }, + "CreateIssueModel": { + "methods": [ + "createIssueModel" + ] + }, + "DeleteIssueModel": { + "methods": [ + "deleteIssueModel" + ] + }, + "DeployIssueModel": { + "methods": [ + "deployIssueModel" + ] + }, + "UndeployIssueModel": { + "methods": [ + "undeployIssueModel" + ] + }, + "ListConversations": { + "methods": [ + "listConversations", + "listConversationsStream", + "listConversationsAsync" + ] + }, + "ListAnalyses": { + "methods": [ + "listAnalyses", + "listAnalysesStream", + "listAnalysesAsync" + ] + }, + "ListPhraseMatchers": { + "methods": [ + "listPhraseMatchers", + "listPhraseMatchersStream", + "listPhraseMatchersAsync" + ] + } + } + } + } + } + } +} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts new file mode 100644 index 0000000..a5c34c3 --- /dev/null +++ b/owl-bot-staging/v1/src/v1/index.ts @@ -0,0 +1,19 @@ +// 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. +// +// ** 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 {ContactCenterInsightsClient} from './contact_center_insights_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js new file mode 100644 index 0000000..3d35f02 --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js @@ -0,0 +1,27 @@ +// 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. +// +// ** 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 contactcenterinsights = require('@google-cloud/contact-center-insights'); + +function main() { + const contactCenterInsightsClient = new contactcenterinsights.ContactCenterInsightsClient(); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts new file mode 100644 index 0000000..6945bae --- /dev/null +++ b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts @@ -0,0 +1,32 @@ +// 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. +// +// ** 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 {ContactCenterInsightsClient} from '@google-cloud/contact-center-insights'; + +// check that the client class type name can be used +function doStuffWithContactCenterInsightsClient(client: ContactCenterInsightsClient) { + client.close(); +} + +function main() { + // check that the client instance can be created + const contactCenterInsightsClient = new ContactCenterInsightsClient(); + doStuffWithContactCenterInsightsClient(contactCenterInsightsClient); +} + +main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts new file mode 100644 index 0000000..1f850b5 --- /dev/null +++ b/owl-bot-staging/v1/system-test/install.ts @@ -0,0 +1,49 @@ +// 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. +// +// ** 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/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts b/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts new file mode 100644 index 0000000..edf8569 --- /dev/null +++ b/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts @@ -0,0 +1,3736 @@ +// 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. +// +// ** 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 contactcenterinsightsModule from '../src'; + +import {PassThrough} from 'stream'; + +import {protobuf, LROperation, operationsProtos} from 'google-gax'; + +function generateSampleMessage(instance: T) { + const filledObject = (instance.constructor as typeof protobuf.Message) + .toObject(instance as protobuf.Message, {defaults: true}); + return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; +} + +function stubSimpleCall(response?: ResponseType, error?: Error) { + return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); +} + +function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { + return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); +} + +function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); +} + +function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { + const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); + const mockOperation = { + promise: innerStub, + }; + return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); +} + +function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { + const pagingStub = sinon.stub(); + if (responses) { + for (let i = 0; i < responses.length; ++i) { + pagingStub.onCall(i).callsArgWith(2, null, responses[i]); + } + } + const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; + const mockStream = new PassThrough({ + objectMode: true, + transform: transformStub, + }); + // trigger as many responses as needed + if (responses) { + for (let i = 0; i < responses.length; ++i) { + setImmediate(() => { mockStream.write({}); }); + } + setImmediate(() => { mockStream.end(); }); + } else { + setImmediate(() => { mockStream.write({}); }); + setImmediate(() => { mockStream.end(); }); + } + return sinon.stub().returns(mockStream); +} + +function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { + let counter = 0; + const asyncIterable = { + [Symbol.asyncIterator]() { + return { + async next() { + if (error) { + return Promise.reject(error); + } + if (counter >= responses!.length) { + return Promise.resolve({done: true, value: undefined}); + } + return Promise.resolve({done: false, value: responses![counter++]}); + } + }; + } + }; + return sinon.stub().returns(asyncIterable); +} + +describe('v1.ContactCenterInsightsClient', () => { + it('has servicePath', () => { + const servicePath = contactcenterinsightsModule.v1.ContactCenterInsightsClient.servicePath; + assert(servicePath); + }); + + it('has apiEndpoint', () => { + const apiEndpoint = contactcenterinsightsModule.v1.ContactCenterInsightsClient.apiEndpoint; + assert(apiEndpoint); + }); + + it('has port', () => { + const port = contactcenterinsightsModule.v1.ContactCenterInsightsClient.port; + assert(port); + assert(typeof port === 'number'); + }); + + it('should create a client with no option', () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient(); + assert(client); + }); + + it('should create a client with gRPC fallback', () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + fallback: true, + }); + assert(client); + }); + + it('has initialize method and supports deferred initialization', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + assert.strictEqual(client.contactCenterInsightsStub, undefined); + await client.initialize(); + assert(client.contactCenterInsightsStub); + }); + + it('has close method', () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.close(); + }); + + it('has getProjectId method', async () => { + const fakeProjectId = 'fake-project-id'; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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 contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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 contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); + const [response] = await client.createConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createConversation without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createConversation( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createConversation with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createConversation(request), expectedError); + assert((client.innerApiCalls.createConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateConversation', () => { + it('invokes updateConversation without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); + request.conversation = {}; + request.conversation.name = ''; + const expectedHeaderRequestParams = "conversation.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.updateConversation = stubSimpleCall(expectedResponse); + const [response] = await client.updateConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateConversation without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); + request.conversation = {}; + request.conversation.name = ''; + const expectedHeaderRequestParams = "conversation.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.updateConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateConversation( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateConversation with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); + request.conversation = {}; + request.conversation.name = ''; + const expectedHeaderRequestParams = "conversation.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateConversation(request), expectedError); + assert((client.innerApiCalls.updateConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getConversation', () => { + it('invokes getConversation without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); + const [response] = await client.getConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getConversation without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); + client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getConversation( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getConversation with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getConversation(request), expectedError); + assert((client.innerApiCalls.getConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteConversation', () => { + it('invokes deleteConversation without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversation = stubSimpleCall(expectedResponse); + const [response] = await client.deleteConversation(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteConversation without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteConversation = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteConversation( + 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); + assert((client.innerApiCalls.deleteConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteConversation with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteConversation = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteConversation(request), expectedError); + assert((client.innerApiCalls.deleteConversation as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getAnalysis', () => { + it('invokes getAnalysis without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()); + client.innerApiCalls.getAnalysis = stubSimpleCall(expectedResponse); + const [response] = await client.getAnalysis(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getAnalysis without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()); + client.innerApiCalls.getAnalysis = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getAnalysis( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IAnalysis|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getAnalysis with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getAnalysis = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getAnalysis(request), expectedError); + assert((client.innerApiCalls.getAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deleteAnalysis', () => { + it('invokes deleteAnalysis without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAnalysis = stubSimpleCall(expectedResponse); + const [response] = await client.deleteAnalysis(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteAnalysis without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deleteAnalysis = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteAnalysis( + 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); + assert((client.innerApiCalls.deleteAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteAnalysis with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteAnalysis = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deleteAnalysis(request), expectedError); + assert((client.innerApiCalls.deleteAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateIssueModel', () => { + it('invokes updateIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); + request.issueModel = {}; + request.issueModel.name = ''; + const expectedHeaderRequestParams = "issue_model.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); + client.innerApiCalls.updateIssueModel = stubSimpleCall(expectedResponse); + const [response] = await client.updateIssueModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); + request.issueModel = {}; + request.issueModel.name = ''; + const expectedHeaderRequestParams = "issue_model.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); + client.innerApiCalls.updateIssueModel = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIssueModel( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssueModel|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateIssueModel with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); + request.issueModel = {}; + request.issueModel.name = ''; + const expectedHeaderRequestParams = "issue_model.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIssueModel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIssueModel(request), expectedError); + assert((client.innerApiCalls.updateIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIssueModel', () => { + it('invokes getIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); + client.innerApiCalls.getIssueModel = stubSimpleCall(expectedResponse); + const [response] = await client.getIssueModel(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); + client.innerApiCalls.getIssueModel = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIssueModel( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssueModel|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIssueModel with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIssueModel = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIssueModel(request), expectedError); + assert((client.innerApiCalls.getIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listIssueModels', () => { + it('invokes listIssueModels without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse()); + client.innerApiCalls.listIssueModels = stubSimpleCall(expectedResponse); + const [response] = await client.listIssueModels(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIssueModels as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIssueModels without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse()); + client.innerApiCalls.listIssueModels = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIssueModels( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIssueModels as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listIssueModels with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIssueModels = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIssueModels(request), expectedError); + assert((client.innerApiCalls.listIssueModels as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getIssue', () => { + it('invokes getIssue without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); + client.innerApiCalls.getIssue = stubSimpleCall(expectedResponse); + const [response] = await client.getIssue(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getIssue without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); + client.innerApiCalls.getIssue = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getIssue( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssue|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getIssue with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getIssue = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getIssue(request), expectedError); + assert((client.innerApiCalls.getIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('listIssues', () => { + it('invokes listIssues without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesResponse()); + client.innerApiCalls.listIssues = stubSimpleCall(expectedResponse); + const [response] = await client.listIssues(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIssues as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listIssues without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesResponse()); + client.innerApiCalls.listIssues = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listIssues( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listIssues as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listIssues with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listIssues = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listIssues(request), expectedError); + assert((client.innerApiCalls.listIssues as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateIssue', () => { + it('invokes updateIssue without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); + request.issue = {}; + request.issue.name = ''; + const expectedHeaderRequestParams = "issue.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); + client.innerApiCalls.updateIssue = stubSimpleCall(expectedResponse); + const [response] = await client.updateIssue(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateIssue without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); + request.issue = {}; + request.issue.name = ''; + const expectedHeaderRequestParams = "issue.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); + client.innerApiCalls.updateIssue = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateIssue( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssue|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateIssue with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); + request.issue = {}; + request.issue.name = ''; + const expectedHeaderRequestParams = "issue.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateIssue = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateIssue(request), expectedError); + assert((client.innerApiCalls.updateIssue as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('calculateIssueModelStats', () => { + it('invokes calculateIssueModelStats without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); + request.issueModel = ''; + const expectedHeaderRequestParams = "issue_model="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse()); + client.innerApiCalls.calculateIssueModelStats = stubSimpleCall(expectedResponse); + const [response] = await client.calculateIssueModelStats(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes calculateIssueModelStats without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); + request.issueModel = ''; + const expectedHeaderRequestParams = "issue_model="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse()); + client.innerApiCalls.calculateIssueModelStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.calculateIssueModelStats( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes calculateIssueModelStats with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); + request.issueModel = ''; + const expectedHeaderRequestParams = "issue_model="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.calculateIssueModelStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.calculateIssueModelStats(request), expectedError); + assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createPhraseMatcher', () => { + it('invokes createPhraseMatcher without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.createPhraseMatcher = stubSimpleCall(expectedResponse); + const [response] = await client.createPhraseMatcher(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createPhraseMatcher without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.createPhraseMatcher = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createPhraseMatcher( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createPhraseMatcher with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createPhraseMatcher = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.createPhraseMatcher(request), expectedError); + assert((client.innerApiCalls.createPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getPhraseMatcher', () => { + it('invokes getPhraseMatcher without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.getPhraseMatcher = stubSimpleCall(expectedResponse); + const [response] = await client.getPhraseMatcher(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getPhraseMatcher without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.getPhraseMatcher = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getPhraseMatcher( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getPhraseMatcher with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getPhraseMatcher = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getPhraseMatcher(request), expectedError); + assert((client.innerApiCalls.getPhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('deletePhraseMatcher', () => { + it('invokes deletePhraseMatcher without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deletePhraseMatcher = stubSimpleCall(expectedResponse); + const [response] = await client.deletePhraseMatcher(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deletePhraseMatcher without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); + client.innerApiCalls.deletePhraseMatcher = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deletePhraseMatcher( + 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); + assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deletePhraseMatcher with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deletePhraseMatcher = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.deletePhraseMatcher(request), expectedError); + assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updatePhraseMatcher', () => { + it('invokes updatePhraseMatcher without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); + request.phraseMatcher = {}; + request.phraseMatcher.name = ''; + const expectedHeaderRequestParams = "phrase_matcher.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.updatePhraseMatcher = stubSimpleCall(expectedResponse); + const [response] = await client.updatePhraseMatcher(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updatePhraseMatcher without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); + request.phraseMatcher = {}; + request.phraseMatcher.name = ''; + const expectedHeaderRequestParams = "phrase_matcher.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); + client.innerApiCalls.updatePhraseMatcher = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updatePhraseMatcher( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updatePhraseMatcher with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); + request.phraseMatcher = {}; + request.phraseMatcher.name = ''; + const expectedHeaderRequestParams = "phrase_matcher.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updatePhraseMatcher = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updatePhraseMatcher(request), expectedError); + assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('calculateStats', () => { + it('invokes calculateStats without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsResponse()); + client.innerApiCalls.calculateStats = stubSimpleCall(expectedResponse); + const [response] = await client.calculateStats(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.calculateStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes calculateStats without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsResponse()); + client.innerApiCalls.calculateStats = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.calculateStats( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.calculateStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes calculateStats with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); + request.location = ''; + const expectedHeaderRequestParams = "location="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.calculateStats = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.calculateStats(request), expectedError); + assert((client.innerApiCalls.calculateStats as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('getSettings', () => { + it('invokes getSettings without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); + client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); + const [response] = await client.getSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes getSettings without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); + client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.getSettings( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.getSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes getSettings with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.getSettings(request), expectedError); + assert((client.innerApiCalls.getSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('updateSettings', () => { + it('invokes updateSettings without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); + request.settings = {}; + request.settings.name = ''; + const expectedHeaderRequestParams = "settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); + client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); + const [response] = await client.updateSettings(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes updateSettings without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); + request.settings = {}; + request.settings.name = ''; + const expectedHeaderRequestParams = "settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); + client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.updateSettings( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ISettings|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes updateSettings with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); + request.settings = {}; + request.settings.name = ''; + const expectedHeaderRequestParams = "settings.name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.updateSettings(request), expectedError); + assert((client.innerApiCalls.updateSettings as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + }); + + describe('createAnalysis', () => { + it('invokes createAnalysis without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createAnalysis = stubLongRunningCall(expectedResponse); + const [operation] = await client.createAnalysis(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAnalysis without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createAnalysis = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createAnalysis( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createAnalysis with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createAnalysis(request), expectedError); + assert((client.innerApiCalls.createAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createAnalysis with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createAnalysis(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createAnalysis as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateAnalysisProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkCreateAnalysisProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateAnalysisProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkCreateAnalysisProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('exportInsightsData', () => { + it('invokes exportInsightsData without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportInsightsData = stubLongRunningCall(expectedResponse); + const [operation] = await client.exportInsightsData(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportInsightsData as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportInsightsData without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.exportInsightsData = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.exportInsightsData( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.exportInsightsData as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes exportInsightsData with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportInsightsData = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.exportInsightsData(request), expectedError); + assert((client.innerApiCalls.exportInsightsData as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes exportInsightsData with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.exportInsightsData = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.exportInsightsData(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.exportInsightsData as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkExportInsightsDataProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkExportInsightsDataProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkExportInsightsDataProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkExportInsightsDataProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('createIssueModel', () => { + it('invokes createIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createIssueModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.createIssueModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.createIssueModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.createIssueModel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.createIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes createIssueModel with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIssueModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.createIssueModel(request), expectedError); + assert((client.innerApiCalls.createIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes createIssueModel with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.createIssueModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.createIssueModel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.createIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkCreateIssueModelProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkCreateIssueModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkCreateIssueModelProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkCreateIssueModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deleteIssueModel', () => { + it('invokes deleteIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteIssueModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deleteIssueModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deleteIssueModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deleteIssueModel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deleteIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deleteIssueModel with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIssueModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deleteIssueModel(request), expectedError); + assert((client.innerApiCalls.deleteIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deleteIssueModel with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deleteIssueModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deleteIssueModel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deleteIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeleteIssueModelProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkDeleteIssueModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeleteIssueModelProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkDeleteIssueModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('deployIssueModel', () => { + it('invokes deployIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deployIssueModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.deployIssueModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deployIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.deployIssueModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.deployIssueModel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.deployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes deployIssueModel with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployIssueModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.deployIssueModel(request), expectedError); + assert((client.innerApiCalls.deployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes deployIssueModel with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.deployIssueModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.deployIssueModel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.deployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkDeployIssueModelProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkDeployIssueModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkDeployIssueModelProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkDeployIssueModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('undeployIssueModel', () => { + it('invokes undeployIssueModel without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeployIssueModel = stubLongRunningCall(expectedResponse); + const [operation] = await client.undeployIssueModel(request); + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeployIssueModel without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); + client.innerApiCalls.undeployIssueModel = stubLongRunningCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.undeployIssueModel( + request, + (err?: Error|null, + result?: LROperation|null + ) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const operation = await promise as LROperation; + const [response] = await operation.promise(); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.undeployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes undeployIssueModel with call error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployIssueModel = stubLongRunningCall(undefined, expectedError); + await assert.rejects(client.undeployIssueModel(request), expectedError); + assert((client.innerApiCalls.undeployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes undeployIssueModel with LRO error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); + request.name = ''; + const expectedHeaderRequestParams = "name="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.undeployIssueModel = stubLongRunningCall(undefined, undefined, expectedError); + const [operation] = await client.undeployIssueModel(request); + await assert.rejects(operation.promise(), expectedError); + assert((client.innerApiCalls.undeployIssueModel as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes checkUndeployIssueModelProgress without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkUndeployIssueModelProgress(expectedResponse.name); + assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); + assert(decodedOperation.metadata); + assert((client.operationsClient.getOperation as SinonStub).getCall(0)); + }); + + it('invokes checkUndeployIssueModelProgress with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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.checkUndeployIssueModelProgress(''), expectedError); + assert((client.operationsClient.getOperation as SinonStub) + .getCall(0)); + }); + }); + + describe('listConversations', () => { + it('invokes listConversations without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); + const [response] = await client.listConversations(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversations without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + ]; + client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listConversations( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listConversations with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listConversations(request), expectedError); + assert((client.innerApiCalls.listConversations as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listConversationsStream without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + ]; + client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listConversationsStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.contactcenterinsights.v1.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listConversationsStream with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + 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.contactcenterinsights.v1.Conversation[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( + (client.descriptors.page.listConversations.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), + ]; + client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listConversations with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";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.contactcenterinsights.v1.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.strictEqual( + (client.descriptors.page.listConversations.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listAnalyses', () => { + it('invokes listAnalyses without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + ]; + client.innerApiCalls.listAnalyses = stubSimpleCall(expectedResponse); + const [response] = await client.listAnalyses(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnalyses as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnalyses without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + ]; + client.innerApiCalls.listAnalyses = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listAnalyses( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IAnalysis[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listAnalyses as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listAnalyses with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listAnalyses = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listAnalyses(request), expectedError); + assert((client.innerApiCalls.listAnalyses as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listAnalysesStream without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + ]; + client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listAnalysesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.contactcenterinsights.v1.Analysis[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.Analysis) => { + 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.listAnalyses.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); + assert.strictEqual( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listAnalysesStream with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listAnalysesStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.contactcenterinsights.v1.Analysis[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.Analysis) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); + assert.strictEqual( + (client.descriptors.page.listAnalyses.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnalyses without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), + ]; + client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.contactcenterinsights.v1.IAnalysis[] = []; + const iterable = client.listAnalysesAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listAnalyses with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listAnalysesAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.contactcenterinsights.v1.IAnalysis[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('listPhraseMatchers', () => { + it('invokes listPhraseMatchers without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + ]; + client.innerApiCalls.listPhraseMatchers = stubSimpleCall(expectedResponse); + const [response] = await client.listPhraseMatchers(request); + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listPhraseMatchers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listPhraseMatchers without error using callback', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + ]; + client.innerApiCalls.listPhraseMatchers = stubSimpleCallWithCallback(expectedResponse); + const promise = new Promise((resolve, reject) => { + client.listPhraseMatchers( + request, + (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[]|null) => { + if (err) { + reject(err); + } else { + resolve(result); + } + }); + }); + const response = await promise; + assert.deepStrictEqual(response, expectedResponse); + assert((client.innerApiCalls.listPhraseMatchers as SinonStub) + .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); + }); + + it('invokes listPhraseMatchers with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedOptions = { + otherArgs: { + headers: { + 'x-goog-request-params': expectedHeaderRequestParams, + }, + }, + }; + const expectedError = new Error('expected'); + client.innerApiCalls.listPhraseMatchers = stubSimpleCall(undefined, expectedError); + await assert.rejects(client.listPhraseMatchers(request), expectedError); + assert((client.innerApiCalls.listPhraseMatchers as SinonStub) + .getCall(0).calledWith(request, expectedOptions, undefined)); + }); + + it('invokes listPhraseMatchersStream without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + ]; + client.descriptors.page.listPhraseMatchers.createStream = stubPageStreamingCall(expectedResponse); + const stream = client.listPhraseMatchersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher) => { + 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.listPhraseMatchers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPhraseMatchers, request)); + assert.strictEqual( + (client.descriptors.page.listPhraseMatchers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('invokes listPhraseMatchersStream with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedError = new Error('expected'); + client.descriptors.page.listPhraseMatchers.createStream = stubPageStreamingCall(undefined, expectedError); + const stream = client.listPhraseMatchersStream(request); + const promise = new Promise((resolve, reject) => { + const responses: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher[] = []; + stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher) => { + responses.push(response); + }); + stream.on('end', () => { + resolve(responses); + }); + stream.on('error', (err: Error) => { + reject(err); + }); + }); + await assert.rejects(promise, expectedError); + assert((client.descriptors.page.listPhraseMatchers.createStream as SinonStub) + .getCall(0).calledWith(client.innerApiCalls.listPhraseMatchers, request)); + assert.strictEqual( + (client.descriptors.page.listPhraseMatchers.createStream as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listPhraseMatchers without error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent="; + const expectedResponse = [ + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), + ]; + client.descriptors.page.listPhraseMatchers.asyncIterate = stubAsyncIterationCall(expectedResponse); + const responses: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[] = []; + const iterable = client.listPhraseMatchersAsync(request); + for await (const resource of iterable) { + responses.push(resource!); + } + assert.deepStrictEqual(responses, expectedResponse); + assert.deepStrictEqual( + (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + + it('uses async iteration with listPhraseMatchers with error', async () => { + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); + request.parent = ''; + const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); + client.descriptors.page.listPhraseMatchers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); + const iterable = client.listPhraseMatchersAsync(request); + await assert.rejects(async () => { + const responses: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[] = []; + for await (const resource of iterable) { + responses.push(resource!); + } + }); + assert.deepStrictEqual( + (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) + .getCall(0).args[1], request); + assert.strictEqual( + (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) + .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], + expectedHeaderRequestParams + ); + }); + }); + + describe('Path templates', () => { + + describe('analysis', () => { + const fakePath = "/rendered/path/analysis"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + analysis: "analysisValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.analysisPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.analysisPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('analysisPath', () => { + const result = client.analysisPath("projectValue", "locationValue", "conversationValue", "analysisValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromAnalysisName', () => { + const result = client.matchProjectFromAnalysisName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromAnalysisName', () => { + const result = client.matchLocationFromAnalysisName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromAnalysisName', () => { + const result = client.matchConversationFromAnalysisName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchAnalysisFromAnalysisName', () => { + const result = client.matchAnalysisFromAnalysisName(fakePath); + assert.strictEqual(result, "analysisValue"); + assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('conversation', () => { + const fakePath = "/rendered/path/conversation"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + conversation: "conversationValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.conversationPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.conversationPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('conversationPath', () => { + const result = client.conversationPath("projectValue", "locationValue", "conversationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.conversationPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromConversationName', () => { + const result = client.matchProjectFromConversationName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromConversationName', () => { + const result = client.matchLocationFromConversationName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchConversationFromConversationName', () => { + const result = client.matchConversationFromConversationName(fakePath); + assert.strictEqual(result, "conversationValue"); + assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('issue', () => { + const fakePath = "/rendered/path/issue"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + issue_model: "issueModelValue", + issue: "issueValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.issuePathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.issuePathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('issuePath', () => { + const result = client.issuePath("projectValue", "locationValue", "issueModelValue", "issueValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.issuePathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromIssueName', () => { + const result = client.matchProjectFromIssueName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.issuePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromIssueName', () => { + const result = client.matchLocationFromIssueName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.issuePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIssueModelFromIssueName', () => { + const result = client.matchIssueModelFromIssueName(fakePath); + assert.strictEqual(result, "issueModelValue"); + assert((client.pathTemplates.issuePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIssueFromIssueName', () => { + const result = client.matchIssueFromIssueName(fakePath); + assert.strictEqual(result, "issueValue"); + assert((client.pathTemplates.issuePathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('issueModel', () => { + const fakePath = "/rendered/path/issueModel"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + issue_model: "issueModelValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.issueModelPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.issueModelPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('issueModelPath', () => { + const result = client.issueModelPath("projectValue", "locationValue", "issueModelValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.issueModelPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromIssueModelName', () => { + const result = client.matchProjectFromIssueModelName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromIssueModelName', () => { + const result = client.matchLocationFromIssueModelName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchIssueModelFromIssueModelName', () => { + const result = client.matchIssueModelFromIssueModelName(fakePath); + assert.strictEqual(result, "issueModelValue"); + assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('location', () => { + const fakePath = "/rendered/path/location"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + 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('phraseMatcher', () => { + const fakePath = "/rendered/path/phraseMatcher"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + phrase_matcher: "phraseMatcherValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.phraseMatcherPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.phraseMatcherPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('phraseMatcherPath', () => { + const result = client.phraseMatcherPath("projectValue", "locationValue", "phraseMatcherValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.phraseMatcherPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromPhraseMatcherName', () => { + const result = client.matchProjectFromPhraseMatcherName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromPhraseMatcherName', () => { + const result = client.matchLocationFromPhraseMatcherName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchPhraseMatcherFromPhraseMatcherName', () => { + const result = client.matchPhraseMatcherFromPhraseMatcherName(fakePath); + assert.strictEqual(result, "phraseMatcherValue"); + assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + + describe('settings', () => { + const fakePath = "/rendered/path/settings"; + const expectedParameters = { + project: "projectValue", + location: "locationValue", + }; + const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ + credentials: {client_email: 'bogus', private_key: 'bogus'}, + projectId: 'bogus', + }); + client.initialize(); + client.pathTemplates.settingsPathTemplate.render = + sinon.stub().returns(fakePath); + client.pathTemplates.settingsPathTemplate.match = + sinon.stub().returns(expectedParameters); + + it('settingsPath', () => { + const result = client.settingsPath("projectValue", "locationValue"); + assert.strictEqual(result, fakePath); + assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) + .getCall(-1).calledWith(expectedParameters)); + }); + + it('matchProjectFromSettingsName', () => { + const result = client.matchProjectFromSettingsName(fakePath); + assert.strictEqual(result, "projectValue"); + assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + + it('matchLocationFromSettingsName', () => { + const result = client.matchLocationFromSettingsName(fakePath); + assert.strictEqual(result, "locationValue"); + assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) + .getCall(-1).calledWith(fakePath)); + }); + }); + }); +}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json new file mode 100644 index 0000000..c78f1c8 --- /dev/null +++ b/owl-bot-staging/v1/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/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js new file mode 100644 index 0000000..97e7287 --- /dev/null +++ b/owl-bot-staging/v1/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: 'ContactCenterInsights', + filename: './contact-center-insights.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', +}; From 817edf92496aa700ec3e0588a211ed7a86eb072e Mon Sep 17 00:00:00 2001 From: Owl Bot Date: Fri, 3 Dec 2021 17:51:35 +0000 Subject: [PATCH 2/2] =?UTF-8?q?=F0=9F=A6=89=20Updates=20from=20OwlBot?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/googleapis/repo-automation-bots/blob/main/packages/owl-bot/README.md --- owl-bot-staging/v1/.eslintignore | 7 - owl-bot-staging/v1/.eslintrc.json | 3 - owl-bot-staging/v1/.gitignore | 14 - owl-bot-staging/v1/.jsdoc.js | 55 - owl-bot-staging/v1/.mocharc.js | 33 - owl-bot-staging/v1/.prettierrc.js | 22 - owl-bot-staging/v1/README.md | 1 - owl-bot-staging/v1/linkinator.config.json | 10 - owl-bot-staging/v1/package.json | 64 - .../v1/contact_center_insights.proto | 970 ----- .../contactcenterinsights/v1/resources.proto | 1086 ----- ...er_insights.calculate_issue_model_stats.js | 53 - ...contact_center_insights.calculate_stats.js | 58 - ...contact_center_insights.create_analysis.js | 59 - ...act_center_insights.create_conversation.js | 66 - ...tact_center_insights.create_issue_model.js | 59 - ...t_center_insights.create_phrase_matcher.js | 61 - ...contact_center_insights.delete_analysis.js | 53 - ...act_center_insights.delete_conversation.js | 59 - ...tact_center_insights.delete_issue_model.js | 54 - ...t_center_insights.delete_phrase_matcher.js | 53 - ...tact_center_insights.deploy_issue_model.js | 54 - ...ct_center_insights.export_insights_data.js | 73 - .../contact_center_insights.get_analysis.js | 53 - ...ontact_center_insights.get_conversation.js | 57 - .../v1/contact_center_insights.get_issue.js | 53 - ...contact_center_insights.get_issue_model.js | 53 - ...tact_center_insights.get_phrase_matcher.js | 53 - .../contact_center_insights.get_settings.js | 53 - .../contact_center_insights.list_analyses.js | 73 - ...tact_center_insights.list_conversations.js | 77 - ...ntact_center_insights.list_issue_models.js | 53 - .../v1/contact_center_insights.list_issues.js | 53 - ...ct_center_insights.list_phrase_matchers.js | 73 - ...ct_center_insights.undeploy_issue_model.js | 54 - ...act_center_insights.update_conversation.js | 57 - .../contact_center_insights.update_issue.js | 57 - ...tact_center_insights.update_issue_model.js | 57 - ...t_center_insights.update_phrase_matcher.js | 57 - ...contact_center_insights.update_settings.js | 58 - owl-bot-staging/v1/src/index.ts | 25 - .../src/v1/contact_center_insights_client.ts | 3362 --------------- ...contact_center_insights_client_config.json | 183 - .../contact_center_insights_proto_list.json | 4 - owl-bot-staging/v1/src/v1/gapic_metadata.json | 325 -- owl-bot-staging/v1/src/v1/index.ts | 19 - .../system-test/fixtures/sample/src/index.js | 27 - .../system-test/fixtures/sample/src/index.ts | 32 - owl-bot-staging/v1/system-test/install.ts | 49 - .../test/gapic_contact_center_insights_v1.ts | 3736 ----------------- owl-bot-staging/v1/tsconfig.json | 19 - owl-bot-staging/v1/webpack.config.js | 64 - .../v1/contact_center_insights.proto | 16 + protos/protos.d.ts | 13 + protos/protos.js | 56 + protos/protos.json | 11 + ...ct_center_insights.export_insights_data.js | 4 + src/v1/contact_center_insights_client.ts | 2 + 58 files changed, 102 insertions(+), 11803 deletions(-) delete mode 100644 owl-bot-staging/v1/.eslintignore delete mode 100644 owl-bot-staging/v1/.eslintrc.json delete mode 100644 owl-bot-staging/v1/.gitignore delete mode 100644 owl-bot-staging/v1/.jsdoc.js delete mode 100644 owl-bot-staging/v1/.mocharc.js delete mode 100644 owl-bot-staging/v1/.prettierrc.js delete mode 100644 owl-bot-staging/v1/README.md delete mode 100644 owl-bot-staging/v1/linkinator.config.json delete mode 100644 owl-bot-staging/v1/package.json delete mode 100644 owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto delete mode 100644 owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js delete mode 100644 owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js delete mode 100644 owl-bot-staging/v1/src/index.ts delete mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_client.ts delete mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json delete mode 100644 owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json delete mode 100644 owl-bot-staging/v1/src/v1/gapic_metadata.json delete mode 100644 owl-bot-staging/v1/src/v1/index.ts delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.js delete mode 100644 owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts delete mode 100644 owl-bot-staging/v1/system-test/install.ts delete mode 100644 owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts delete mode 100644 owl-bot-staging/v1/tsconfig.json delete mode 100644 owl-bot-staging/v1/webpack.config.js diff --git a/owl-bot-staging/v1/.eslintignore b/owl-bot-staging/v1/.eslintignore deleted file mode 100644 index cfc348e..0000000 --- a/owl-bot-staging/v1/.eslintignore +++ /dev/null @@ -1,7 +0,0 @@ -**/node_modules -**/.coverage -build/ -docs/ -protos/ -system-test/ -samples/generated/ diff --git a/owl-bot-staging/v1/.eslintrc.json b/owl-bot-staging/v1/.eslintrc.json deleted file mode 100644 index 7821534..0000000 --- a/owl-bot-staging/v1/.eslintrc.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "extends": "./node_modules/gts" -} diff --git a/owl-bot-staging/v1/.gitignore b/owl-bot-staging/v1/.gitignore deleted file mode 100644 index 5d32b23..0000000 --- a/owl-bot-staging/v1/.gitignore +++ /dev/null @@ -1,14 +0,0 @@ -**/*.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/owl-bot-staging/v1/.jsdoc.js b/owl-bot-staging/v1/.jsdoc.js deleted file mode 100644 index 84ce5a5..0000000 --- a/owl-bot-staging/v1/.jsdoc.js +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file 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 2021 Google LLC', - includeDate: false, - sourceFiles: false, - systemName: '@google-cloud/contact-center-insights', - theme: 'lumen', - default: { - outputSourceFiles: false - } - }, - markdown: { - idInHeadings: true - } -}; diff --git a/owl-bot-staging/v1/.mocharc.js b/owl-bot-staging/v1/.mocharc.js deleted file mode 100644 index 50bc7f7..0000000 --- a/owl-bot-staging/v1/.mocharc.js +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -const config = { - "enable-source-maps": true, - "throw-deprecation": true, - "timeout": 10000 -} -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/owl-bot-staging/v1/.prettierrc.js b/owl-bot-staging/v1/.prettierrc.js deleted file mode 100644 index 84f4713..0000000 --- a/owl-bot-staging/v1/.prettierrc.js +++ /dev/null @@ -1,22 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - - -module.exports = { - ...require('gts/.prettierrc.json') -} diff --git a/owl-bot-staging/v1/README.md b/owl-bot-staging/v1/README.md deleted file mode 100644 index eabc434..0000000 --- a/owl-bot-staging/v1/README.md +++ /dev/null @@ -1 +0,0 @@ -Contactcenterinsights: Nodejs Client diff --git a/owl-bot-staging/v1/linkinator.config.json b/owl-bot-staging/v1/linkinator.config.json deleted file mode 100644 index 0121dfa..0000000 --- a/owl-bot-staging/v1/linkinator.config.json +++ /dev/null @@ -1,10 +0,0 @@ -{ - "recurse": true, - "skip": [ - "https://codecov.io/gh/googleapis/", - "www.googleapis.com", - "img.shields.io" - ], - "silent": true, - "concurrency": 5 -} diff --git a/owl-bot-staging/v1/package.json b/owl-bot-staging/v1/package.json deleted file mode 100644 index bcd35c1..0000000 --- a/owl-bot-staging/v1/package.json +++ /dev/null @@ -1,64 +0,0 @@ -{ - "name": "@google-cloud/contact-center-insights", - "version": "0.1.0", - "description": "Contactcenterinsights client for Node.js", - "repository": "googleapis/nodejs-contactcenterinsights", - "license": "Apache-2.0", - "author": "Google LLC", - "main": "build/src/index.js", - "files": [ - "build/src", - "build/protos" - ], - "keywords": [ - "google apis client", - "google api client", - "google apis", - "google api", - "google", - "google cloud platform", - "google cloud", - "cloud", - "google contactcenterinsights", - "contactcenterinsights", - "contact center insights" - ], - "scripts": { - "clean": "gts clean", - "compile": "tsc -p . && cp -r protos build/", - "compile-protos": "compileProtos src", - "docs": "jsdoc -c .jsdoc.js", - "predocs-test": "npm run docs", - "docs-test": "linkinator docs", - "fix": "gts fix", - "lint": "gts check", - "prepare": "npm run compile-protos && npm run compile", - "system-test": "c8 mocha build/system-test", - "test": "c8 mocha build/test" - }, - "dependencies": { - "google-gax": "^2.28.0" - }, - "devDependencies": { - "@types/mocha": "^9.0.0", - "@types/node": "^14.17.32", - "@types/sinon": "^10.0.6", - "c8": "^7.10.0", - "gts": "^3.1.0", - "jsdoc": "^3.6.7", - "jsdoc-fresh": "^1.1.1", - "jsdoc-region-tag": "^1.3.1", - "linkinator": "^2.14.5", - "mocha": "^9.1.3", - "null-loader": "^4.0.1", - "pack-n-play": "^1.0.0-2", - "sinon": "^11.1.2", - "ts-loader": "^9.2.6", - "typescript": "^4.4.4", - "webpack": "^5.62.1", - "webpack-cli": "^4.9.1" - }, - "engines": { - "node": ">=v10.24.0" - } -} diff --git a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto deleted file mode 100644 index 922219b..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto +++ /dev/null @@ -1,970 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.contactcenterinsights.v1; - -import "google/api/annotations.proto"; -import "google/api/client.proto"; -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/cloud/contactcenterinsights/v1/resources.proto"; -import "google/longrunning/operations.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/empty.proto"; -import "google/protobuf/field_mask.proto"; -import "google/protobuf/timestamp.proto"; -import "google/rpc/status.proto"; - -option csharp_namespace = "Google.Cloud.ContactCenterInsights.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1;contactcenterinsights"; -option java_multiple_files = true; -option java_outer_classname = "ContactCenterInsightsProto"; -option java_package = "com.google.cloud.contactcenterinsights.v1"; -option php_namespace = "Google\\Cloud\\ContactCenterInsights\\V1"; -option ruby_package = "Google::Cloud::ContactCenterInsights::V1"; - -// An API that lets users analyze and explore their business conversation data. -service ContactCenterInsights { - option (google.api.default_host) = "contactcenterinsights.googleapis.com"; - option (google.api.oauth_scopes) = "https://www.googleapis.com/auth/cloud-platform"; - - // Creates a conversation. - rpc CreateConversation(CreateConversationRequest) returns (Conversation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/conversations" - body: "conversation" - }; - option (google.api.method_signature) = "parent,conversation,conversation_id"; - } - - // Updates a conversation. - rpc UpdateConversation(UpdateConversationRequest) returns (Conversation) { - option (google.api.http) = { - patch: "/v1/{conversation.name=projects/*/locations/*/conversations/*}" - body: "conversation" - }; - option (google.api.method_signature) = "conversation,update_mask"; - } - - // Gets a conversation. - rpc GetConversation(GetConversationRequest) returns (Conversation) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/conversations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists conversations. - rpc ListConversations(ListConversationsRequest) returns (ListConversationsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/conversations" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a conversation. - rpc DeleteConversation(DeleteConversationRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/conversations/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Creates an analysis. The long running operation is done when the analysis - // has completed. - rpc CreateAnalysis(CreateAnalysisRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*/conversations/*}/analyses" - body: "analysis" - }; - option (google.api.method_signature) = "parent,analysis"; - option (google.longrunning.operation_info) = { - response_type: "Analysis" - metadata_type: "CreateAnalysisOperationMetadata" - }; - } - - // Gets an analysis. - rpc GetAnalysis(GetAnalysisRequest) returns (Analysis) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists analyses. - rpc ListAnalyses(ListAnalysesRequest) returns (ListAnalysesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/conversations/*}/analyses" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an analysis. - rpc DeleteAnalysis(DeleteAnalysisRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/conversations/*/analyses/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Export insights data to a destination defined in the request body. - rpc ExportInsightsData(ExportInsightsDataRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/insightsdata:export" - body: "*" - }; - option (google.api.method_signature) = "parent"; - option (google.longrunning.operation_info) = { - response_type: "ExportInsightsDataResponse" - metadata_type: "ExportInsightsDataMetadata" - }; - } - - // Creates an issue model. - rpc CreateIssueModel(CreateIssueModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/issueModels" - body: "issue_model" - }; - option (google.api.method_signature) = "parent,issue_model"; - option (google.longrunning.operation_info) = { - response_type: "IssueModel" - metadata_type: "CreateIssueModelMetadata" - }; - } - - // Updates an issue model. - rpc UpdateIssueModel(UpdateIssueModelRequest) returns (IssueModel) { - option (google.api.http) = { - patch: "/v1/{issue_model.name=projects/*/locations/*/issueModels/*}" - body: "issue_model" - }; - option (google.api.method_signature) = "issue_model,update_mask"; - } - - // Gets an issue model. - rpc GetIssueModel(GetIssueModelRequest) returns (IssueModel) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/issueModels/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists issue models. - rpc ListIssueModels(ListIssueModelsRequest) returns (ListIssueModelsResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/issueModels" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes an issue model. - rpc DeleteIssueModel(DeleteIssueModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/issueModels/*}" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "google.protobuf.Empty" - metadata_type: "DeleteIssueModelMetadata" - }; - } - - // Deploys an issue model. Returns an error if a model is already deployed. - // An issue model can only be used in analysis after it has been deployed. - rpc DeployIssueModel(DeployIssueModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/issueModels/*}:deploy" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "DeployIssueModelResponse" - metadata_type: "DeployIssueModelMetadata" - }; - } - - // Undeploys an issue model. - // An issue model can not be used in analysis after it has been undeployed. - rpc UndeployIssueModel(UndeployIssueModelRequest) returns (google.longrunning.Operation) { - option (google.api.http) = { - post: "/v1/{name=projects/*/locations/*/issueModels/*}:undeploy" - body: "*" - }; - option (google.api.method_signature) = "name"; - option (google.longrunning.operation_info) = { - response_type: "UndeployIssueModelResponse" - metadata_type: "UndeployIssueModelMetadata" - }; - } - - // Gets an issue. - rpc GetIssue(GetIssueRequest) returns (Issue) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/issueModels/*/issues/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists issues. - rpc ListIssues(ListIssuesRequest) returns (ListIssuesResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*/issueModels/*}/issues" - }; - option (google.api.method_signature) = "parent"; - } - - // Updates an issue. - rpc UpdateIssue(UpdateIssueRequest) returns (Issue) { - option (google.api.http) = { - patch: "/v1/{issue.name=projects/*/locations/*/issueModels/*/issues/*}" - body: "issue" - }; - option (google.api.method_signature) = "issue,update_mask"; - } - - // Gets an issue model's statistics. - rpc CalculateIssueModelStats(CalculateIssueModelStatsRequest) returns (CalculateIssueModelStatsResponse) { - option (google.api.http) = { - get: "/v1/{issue_model=projects/*/locations/*/issueModels/*}:calculateIssueModelStats" - }; - option (google.api.method_signature) = "issue_model"; - } - - // Creates a phrase matcher. - rpc CreatePhraseMatcher(CreatePhraseMatcherRequest) returns (PhraseMatcher) { - option (google.api.http) = { - post: "/v1/{parent=projects/*/locations/*}/phraseMatchers" - body: "phrase_matcher" - }; - option (google.api.method_signature) = "parent,phrase_matcher"; - } - - // Gets a phrase matcher. - rpc GetPhraseMatcher(GetPhraseMatcherRequest) returns (PhraseMatcher) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/phraseMatchers/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Lists phrase matchers. - rpc ListPhraseMatchers(ListPhraseMatchersRequest) returns (ListPhraseMatchersResponse) { - option (google.api.http) = { - get: "/v1/{parent=projects/*/locations/*}/phraseMatchers" - }; - option (google.api.method_signature) = "parent"; - } - - // Deletes a phrase matcher. - rpc DeletePhraseMatcher(DeletePhraseMatcherRequest) returns (google.protobuf.Empty) { - option (google.api.http) = { - delete: "/v1/{name=projects/*/locations/*/phraseMatchers/*}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates a phrase matcher. - rpc UpdatePhraseMatcher(UpdatePhraseMatcherRequest) returns (PhraseMatcher) { - option (google.api.http) = { - patch: "/v1/{phrase_matcher.name=projects/*/locations/*/phraseMatchers/*}" - body: "phrase_matcher" - }; - option (google.api.method_signature) = "phrase_matcher,update_mask"; - } - - // Gets conversation statistics. - rpc CalculateStats(CalculateStatsRequest) returns (CalculateStatsResponse) { - option (google.api.http) = { - get: "/v1/{location=projects/*/locations/*}/conversations:calculateStats" - }; - option (google.api.method_signature) = "location"; - } - - // Gets project-level settings. - rpc GetSettings(GetSettingsRequest) returns (Settings) { - option (google.api.http) = { - get: "/v1/{name=projects/*/locations/*/settings}" - }; - option (google.api.method_signature) = "name"; - } - - // Updates project-level settings. - rpc UpdateSettings(UpdateSettingsRequest) returns (Settings) { - option (google.api.http) = { - patch: "/v1/{settings.name=projects/*/locations/*/settings}" - body: "settings" - }; - option (google.api.method_signature) = "settings,update_mask"; - } -} - -// The request for calculating conversation statistics. -message CalculateStatsRequest { - // Required. The location of the conversations. - string location = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // A filter to reduce results to a specific subset. This field is useful for - // getting statistics about conversations with specific properties. - string filter = 2; -} - -// Represents the options for views of a conversation. -enum ConversationView { - // Not specified. Defaults to FULL on GetConversationRequest and BASIC for - // ListConversationsRequest. - CONVERSATION_VIEW_UNSPECIFIED = 0; - - // Transcript field is not populated in the response. - BASIC = 1; - - // All fields are populated. - FULL = 2; -} - -// The response for calculating conversation statistics. -message CalculateStatsResponse { - // A time series representing conversations over time. - message TimeSeries { - // A single interval in a time series. - message Interval { - // The start time of this interval. - google.protobuf.Timestamp start_time = 1; - - // The number of conversations created in this interval. - int32 conversation_count = 2; - } - - // The duration of each interval. - google.protobuf.Duration interval_duration = 1; - - // An ordered list of intervals from earliest to latest, where each interval - // represents the number of conversations that transpired during the time - // window. - repeated Interval points = 2; - } - - // The average duration of all conversations. The average is calculated using - // only conversations that have a time duration. - google.protobuf.Duration average_duration = 1; - - // The average number of turns per conversation. - int32 average_turn_count = 2; - - // The total number of conversations. - int32 conversation_count = 3; - - // A map associating each smart highlighter display name with its respective - // number of matches in the set of conversations. - map smart_highlighter_matches = 4; - - // A map associating each custom highlighter resource name with its respective - // number of matches in the set of conversations. - map custom_highlighter_matches = 5; - - // A map associating each issue resource name with its respective number of - // matches in the set of conversations. Key has the format: - // `projects//locations//issueModels//issues/` - // Deprecated, use `issue_matches_stats` field instead. - map issue_matches = 6 [deprecated = true]; - - // A map associating each issue resource name with its respective number of - // matches in the set of conversations. Key has the format: - // `projects//locations//issueModels//issues/` - map issue_matches_stats = 8; - - // A time series representing the count of conversations created over time - // that match that requested filter criteria. - TimeSeries conversation_count_time_series = 7; -} - -// Metadata for a create analysis operation. -message CreateAnalysisOperationMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The Conversation that this Analysis Operation belongs to. - string conversation = 3 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Conversation" - } - ]; -} - -// Request to create a conversation. -message CreateConversationRequest { - // Required. The parent resource of the conversation. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The conversation resource to create. - Conversation conversation = 2 [(google.api.field_behavior) = REQUIRED]; - - // A unique ID for the new conversation. This ID will become the final - // component of the conversation's resource name. If no ID is specified, a - // server-generated ID will be used. - // - // This value should be 4-64 characters and must match the regular - // expression `^[a-z0-9-]{4,64}$`. Valid characters are `[a-z][0-9]-` - string conversation_id = 3; -} - -// Request to list conversations. -message ListConversationsRequest { - // Required. The parent resource of the conversation. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of conversations to return in the response. A valid page - // size ranges from 0 to 1,000 inclusive. If the page size is zero or - // unspecified, a default page size of 100 will be chosen. Note that a call - // might return fewer results than the requested page size. - int32 page_size = 2; - - // The value returned by the last `ListConversationsResponse`. This value - // indicates that this is a continuation of a prior `ListConversations` call - // and that the system should return the next page of data. - string page_token = 3; - - // A filter to reduce results to a specific subset. Useful for querying - // conversations with specific properties. - string filter = 4; - - // The level of details of the conversation. Default is `BASIC`. - ConversationView view = 5; -} - -// The response of listing conversations. -message ListConversationsResponse { - // The conversations that match the request. - repeated Conversation conversations = 1; - - // A token which can be sent as `page_token` to retrieve the next page. If - // this field is set, it means there is another page available. If it is not - // set, it means no other pages are available. - string next_page_token = 2; -} - -// The request to get a conversation. -message GetConversationRequest { - // Required. The name of the conversation to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Conversation" - } - ]; - - // The level of details of the conversation. Default is `FULL`. - ConversationView view = 2; -} - -// The request to update a conversation. -message UpdateConversationRequest { - // Required. The new values for the conversation. - Conversation conversation = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request to delete a conversation. -message DeleteConversationRequest { - // Required. The name of the conversation to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Conversation" - } - ]; - - // If set to true, all of this conversation's analyses will also be deleted. - // Otherwise, the request will only succeed if the conversation has no - // analyses. - bool force = 2; -} - -// The request to create an analysis. -message CreateAnalysisRequest { - // Required. The parent resource of the analysis. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Conversation" - } - ]; - - // Required. The analysis to create. - Analysis analysis = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// The request to list analyses. -message ListAnalysesRequest { - // Required. The parent resource of the analyses. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Conversation" - } - ]; - - // The maximum number of analyses to return in the response. If this - // value is zero, the service will select a default size. A call might return - // fewer objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 2; - - // The value returned by the last `ListAnalysesResponse`; indicates - // that this is a continuation of a prior `ListAnalyses` call and - // the system should return the next page of data. - string page_token = 3; - - // A filter to reduce results to a specific subset. Useful for querying - // conversations with specific properties. - string filter = 4; -} - -// The response to list analyses. -message ListAnalysesResponse { - // The analyses that match the request. - repeated Analysis analyses = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// The request to get an analysis. -message GetAnalysisRequest { - // Required. The name of the analysis to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Analysis" - } - ]; -} - -// The request to delete an analysis. -message DeleteAnalysisRequest { - // Required. The name of the analysis to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Analysis" - } - ]; -} - -// The request to export insights. -message ExportInsightsDataRequest { - // A BigQuery Table Reference. - message BigQueryDestination { - // A project ID or number. If specified, then export will attempt to - // write data to this project instead of the resource project. Otherwise, - // the resource project will be used. - string project_id = 3; - - // Required. The name of the BigQuery dataset that the snapshot result should be - // exported to. If this dataset does not exist, the export call returns an - // INVALID_ARGUMENT error. - string dataset = 1 [(google.api.field_behavior) = REQUIRED]; - - // The BigQuery table name to which the insights data should be written. - // If this table does not exist, the export call returns an INVALID_ARGUMENT - // error. - string table = 2; - } - - // Specifies the action that occurs if the destination table already exists. - enum WriteDisposition { - // Write disposition is not specified. Defaults to WRITE_TRUNCATE. - WRITE_DISPOSITION_UNSPECIFIED = 0; - - // If the table already exists, BigQuery will overwrite the table data and - // use the schema from the load. - WRITE_TRUNCATE = 1; - - // If the table already exists, BigQuery will append data to the table. - WRITE_APPEND = 2; - } - - // Exporter destination. - oneof destination { - // Specified if sink is a BigQuery table. - BigQueryDestination big_query_destination = 2; - } - - // Required. The parent resource to export data from. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // A filter to reduce results to a specific subset. Useful for exporting - // conversations with specific properties. - string filter = 3; - - // A fully qualified KMS key name for BigQuery tables protected by CMEK. - // Format: - // projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} - string kms_key = 4; - - // Options for what to do if the destination table already exists. - WriteDisposition write_disposition = 5; -} - -// Metadata for an export insights operation. -message ExportInsightsDataMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original request for export. - ExportInsightsDataRequest request = 3; - - // Partial errors during export operation that might cause the operation - // output to be incomplete. - repeated google.rpc.Status partial_errors = 4; -} - -// Response for an export insights operation. -message ExportInsightsDataResponse { - -} - -// The request to create an issue model. -message CreateIssueModelRequest { - // Required. The parent resource of the issue model. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The issue model to create. - IssueModel issue_model = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Metadata for creating an issue model. -message CreateIssueModelMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original request for creation. - CreateIssueModelRequest request = 3; -} - -// The request to update an issue model. -message UpdateIssueModelRequest { - // Required. The new values for the issue model. - IssueModel issue_model = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request to list issue models. -message ListIssueModelsRequest { - // Required. The parent resource of the issue model. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; -} - -// The response of listing issue models. -message ListIssueModelsResponse { - // The issue models that match the request. - repeated IssueModel issue_models = 1; -} - -// The request to get an issue model. -message GetIssueModelRequest { - // Required. The name of the issue model to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// The request to delete an issue model. -message DeleteIssueModelRequest { - // Required. The name of the issue model to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// Metadata for deleting an issue model. -message DeleteIssueModelMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original request for deletion. - DeleteIssueModelRequest request = 3; -} - -// The request to deploy an issue model. -message DeployIssueModelRequest { - // Required. The issue model to deploy. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// The response to deploy an issue model. -message DeployIssueModelResponse { - -} - -// Metadata for deploying an issue model. -message DeployIssueModelMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original request for deployment. - DeployIssueModelRequest request = 3; -} - -// The request to undeploy an issue model. -message UndeployIssueModelRequest { - // Required. The issue model to undeploy. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// The response to undeploy an issue model. -message UndeployIssueModelResponse { - -} - -// Metadata for undeploying an issue model. -message UndeployIssueModelMetadata { - // Output only. The time the operation was created. - google.protobuf.Timestamp create_time = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time the operation finished running. - google.protobuf.Timestamp end_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The original request for undeployment. - UndeployIssueModelRequest request = 3; -} - -// The request to get an issue. -message GetIssueRequest { - // Required. The name of the issue to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Issue" - } - ]; -} - -// Request to list issues. -message ListIssuesRequest { - // Required. The parent resource of the issue. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// The response of listing issues. -message ListIssuesResponse { - // The issues that match the request. - repeated Issue issues = 1; -} - -// The request to update an issue. -message UpdateIssueRequest { - // Required. The new values for the issue. - Issue issue = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// Request to get statistics of an issue model. -message CalculateIssueModelStatsRequest { - // Required. The resource name of the issue model to query against. - string issue_model = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - } - ]; -} - -// Response of querying an issue model's statistics. -message CalculateIssueModelStatsResponse { - // The latest label statistics for the queried issue model. Includes results - // on both training data and data labeled after deployment. - IssueModelLabelStats current_stats = 4; -} - -// Request to create a phrase matcher. -message CreatePhraseMatcherRequest { - // Required. The parent resource of the phrase matcher. Required. The location to create - // a phrase matcher for. - // Format: `projects//locations/` or - // `projects//locations/` - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // Required. The phrase matcher resource to create. - PhraseMatcher phrase_matcher = 2 [(google.api.field_behavior) = REQUIRED]; -} - -// Request to list phrase matchers. -message ListPhraseMatchersRequest { - // Required. The parent resource of the phrase matcher. - string parent = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "locations.googleapis.com/Location" - } - ]; - - // The maximum number of phrase matchers to return in the response. If this - // value is zero, the service will select a default size. A call might return - // fewer objects than requested. A non-empty `next_page_token` in the response - // indicates that more data is available. - int32 page_size = 2; - - // The value returned by the last `ListPhraseMatchersResponse`. This value - // indicates that this is a continuation of a prior `ListPhraseMatchers` call - // and that the system should return the next page of data. - string page_token = 3; - - // A filter to reduce results to a specific subset. Useful for querying - // phrase matchers with specific properties. - string filter = 4; -} - -// The response of listing phrase matchers. -message ListPhraseMatchersResponse { - // The phrase matchers that match the request. - repeated PhraseMatcher phrase_matchers = 1; - - // A token, which can be sent as `page_token` to retrieve the next page. - // If this field is omitted, there are no subsequent pages. - string next_page_token = 2; -} - -// The request to get a a phrase matcher. -message GetPhraseMatcherRequest { - // Required. The name of the phrase matcher to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/PhraseMatcher" - } - ]; -} - -// The request to delete a phrase matcher. -message DeletePhraseMatcherRequest { - // Required. The name of the phrase matcher to delete. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/PhraseMatcher" - } - ]; -} - -// The request to update a phrase matcher. -message UpdatePhraseMatcherRequest { - // Required. The new values for the phrase matcher. - PhraseMatcher phrase_matcher = 1 [(google.api.field_behavior) = REQUIRED]; - - // The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2; -} - -// The request to get project-level settings. -message GetSettingsRequest { - // Required. The name of the settings resource to get. - string name = 1 [ - (google.api.field_behavior) = REQUIRED, - (google.api.resource_reference) = { - type: "contactcenterinsights.googleapis.com/Settings" - } - ]; -} - -// The request to update project-level settings. -message UpdateSettingsRequest { - // Required. The new settings values. - Settings settings = 1 [(google.api.field_behavior) = REQUIRED]; - - // Required. The list of fields to be updated. - google.protobuf.FieldMask update_mask = 2 [(google.api.field_behavior) = REQUIRED]; -} diff --git a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto b/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto deleted file mode 100644 index 491106c..0000000 --- a/owl-bot-staging/v1/protos/google/cloud/contactcenterinsights/v1/resources.proto +++ /dev/null @@ -1,1086 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// 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.contactcenterinsights.v1; - -import "google/api/field_behavior.proto"; -import "google/api/resource.proto"; -import "google/protobuf/duration.proto"; -import "google/protobuf/timestamp.proto"; -import "google/api/annotations.proto"; - -option csharp_namespace = "Google.Cloud.ContactCenterInsights.V1"; -option go_package = "google.golang.org/genproto/googleapis/cloud/contactcenterinsights/v1;contactcenterinsights"; -option java_multiple_files = true; -option java_outer_classname = "ResourcesProto"; -option java_package = "com.google.cloud.contactcenterinsights.v1"; -option php_namespace = "Google\\Cloud\\ContactCenterInsights\\V1"; -option ruby_package = "Google::Cloud::ContactCenterInsights::V1"; -option (google.api.resource_definition) = { - type: "dialogflow.googleapis.com/Participant" - pattern: "projects/{project}/conversations/{conversation}/participants/{participant}" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant}" -}; - -// The conversation resource. -message Conversation { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/Conversation" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}" - }; - - // Call-specific metadata. - message CallMetadata { - // The audio channel that contains the customer. - int32 customer_channel = 1; - - // The audio channel that contains the agent. - int32 agent_channel = 2; - } - - // A message representing the transcript of a conversation. - message Transcript { - // A segment of a full transcript. - message TranscriptSegment { - // Word-level info for words in a transcript. - message WordInfo { - // Time offset of the start of this word relative to the beginning of - // the total conversation. - google.protobuf.Duration start_offset = 1; - - // Time offset of the end of this word relative to the beginning of the - // total conversation. - google.protobuf.Duration end_offset = 2; - - // The word itself. Includes punctuation marks that surround the word. - string word = 3; - - // A confidence estimate between 0.0 and 1.0 of the fidelity of this - // word. A default value of 0.0 indicates that the value is unset. - float confidence = 4; - } - - // Metadata from Dialogflow relating to the current transcript segment. - message DialogflowSegmentMetadata { - // Whether the transcript segment was covered under the configured smart - // reply allowlist in Agent Assist. - bool smart_reply_allowlist_covered = 1; - } - - // The time that the message occurred, if provided. - google.protobuf.Timestamp message_time = 6; - - // The text of this segment. - string text = 1; - - // A confidence estimate between 0.0 and 1.0 of the fidelity of this - // segment. A default value of 0.0 indicates that the value is unset. - float confidence = 2; - - // A list of the word-specific information for each word in the segment. - repeated WordInfo words = 3; - - // The language code of this segment as a - // [BCP-47](https://www.rfc-editor.org/rfc/bcp/bcp47.txt) language tag. - // Example: "en-US". - string language_code = 4; - - // For conversations derived from multi-channel audio, this is the channel - // number corresponding to the audio from that channel. For - // audioChannelCount = N, its output values can range from '1' to 'N'. A - // channel tag of 0 indicates that the audio is mono. - int32 channel_tag = 5; - - // The participant of this segment. - ConversationParticipant segment_participant = 9; - - // CCAI metadata relating to the current transcript segment. - DialogflowSegmentMetadata dialogflow_segment_metadata = 10; - - // The sentiment for this transcript segment. - SentimentData sentiment = 11; - } - - // A list of sequential transcript segments that comprise the conversation. - repeated TranscriptSegment transcript_segments = 1; - } - - // Possible media for the conversation. - enum Medium { - // Default value, if unspecified will default to PHONE_CALL. - MEDIUM_UNSPECIFIED = 0; - - // The format for conversations that took place over the phone. - PHONE_CALL = 1; - - // The format for conversations that took place over chat. - CHAT = 2; - } - - // Metadata that applies to the conversation. - oneof metadata { - // Call-specific metadata. - CallMetadata call_metadata = 7; - } - - // A time to live expiration setting, can be either a specified timestamp or a - // duration from the time that the conversation creation request was received. - // Conversations with an expiration set will be removed up to 24 hours after - // the specified time. - oneof expiration { - // The time at which this conversation should expire. After this time, the - // conversation data and any associated analyses will be deleted. - google.protobuf.Timestamp expire_time = 15; - - // Input only. The TTL for this resource. If specified, then this TTL will - // be used to calculate the expire time. - google.protobuf.Duration ttl = 16 [(google.api.field_behavior) = INPUT_ONLY]; - } - - // Immutable. The resource name of the conversation. - // Format: - // projects/{project}/locations/{location}/conversations/{conversation} - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The source of the audio and transcription for the conversation. - ConversationDataSource data_source = 2; - - // Output only. The time at which the conversation was created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the conversation was updated. - google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The time at which the conversation started. - google.protobuf.Timestamp start_time = 17; - - // A user-specified language code for the conversation. - string language_code = 14; - - // An opaque, user-specified string representing the human agent who handled - // the conversation. - string agent_id = 5; - - // A map for the user to specify any custom fields. A maximum of 20 labels per - // conversation is allowed, with a maximum of 256 characters per entry. - map labels = 6; - - // Output only. The conversation transcript. - Transcript transcript = 8 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Immutable. The conversation medium, if unspecified will default to PHONE_CALL. - Medium medium = 9 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The duration of the conversation. - google.protobuf.Duration duration = 10 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The number of turns in the conversation. - int32 turn_count = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The conversation's latest analysis, if one exists. - Analysis latest_analysis = 12 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The annotations that were generated during the customer and agent - // interaction. - repeated RuntimeAnnotation runtime_annotations = 13 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. All the matched Dialogflow intents in the call. The key corresponds to a - // Dialogflow intent, format: - // projects/{project}/agent/{agent}/intents/{intent} - map dialogflow_intents = 18 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The analysis resource. -message Analysis { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/Analysis" - pattern: "projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis}" - }; - - // Immutable. The resource name of the analysis. - // Format: - // projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis} - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time at which the analysis was requested. - google.protobuf.Timestamp request_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which the analysis was created, which occurs when the - // long-running operation completes. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The result of the analysis, which is populated when the analysis - // finishes. - AnalysisResult analysis_result = 7 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// The conversation source, which is a combination of transcript and audio. -message ConversationDataSource { - // The source of the conversation. - oneof source { - // A Cloud Storage location specification for the audio and transcript. - GcsSource gcs_source = 1; - - // The source when the conversation comes from Dialogflow. - DialogflowSource dialogflow_source = 3; - } -} - -// A Cloud Storage source of conversation data. -message GcsSource { - // Cloud Storage URI that points to a file that contains the conversation - // audio. - string audio_uri = 1; - - // Immutable. Cloud Storage URI that points to a file that contains the conversation - // transcript. - string transcript_uri = 2 [(google.api.field_behavior) = IMMUTABLE]; -} - -// A Dialogflow source of conversation data. -message DialogflowSource { - // Output only. The name of the Dialogflow conversation that this conversation - // resource is derived from. Format: - // projects/{project}/locations/{location}/conversations/{conversation} - string dialogflow_conversation = 1 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Cloud Storage URI that points to a file that contains the conversation - // audio. - string audio_uri = 3; -} - -// The result of an analysis. -message AnalysisResult { - // Call-specific metadata created during analysis. - message CallAnalysisMetadata { - // A list of call annotations that apply to this call. - repeated CallAnnotation annotations = 2; - - // All the entities in the call. - map entities = 3; - - // Overall conversation-level sentiment for each channel of the call. - repeated ConversationLevelSentiment sentiments = 4; - - // All the matched intents in the call. - map intents = 6; - - // All the matched phrase matchers in the call. - map phrase_matchers = 7; - - // Overall conversation-level issue modeling result. - IssueModelResult issue_model_result = 8; - } - - // Metadata discovered during analysis. - oneof metadata { - // Call-specific metadata created by the analysis. - CallAnalysisMetadata call_analysis_metadata = 2; - } - - // The time at which the analysis ended. - google.protobuf.Timestamp end_time = 1; -} - -// Issue Modeling result on a conversation. -message IssueModelResult { - // Issue model that generates the result. - string issue_model = 1; - - // All the matched issues. - repeated IssueAssignment issues = 2; -} - -// One channel of conversation-level sentiment data. -message ConversationLevelSentiment { - // The channel of the audio that the data applies to. - int32 channel_tag = 1; - - // Data specifying sentiment. - SentimentData sentiment_data = 2; -} - -// Information about the issue. -message IssueAssignment { - // Resource name of the assigned issue. - string issue = 1; - - // Score indicating the likelihood of the issue assignment. - // currently bounded on [0,1]. - double score = 2; - - // Immutable. Display name of the assigned issue. This field is set at time of analyis - // and immutable since then. - string display_name = 3 [(google.api.field_behavior) = IMMUTABLE]; -} - -// A piece of metadata that applies to a window of a call. -message CallAnnotation { - // The data in the annotation. - oneof data { - // Data specifying an interruption. - InterruptionData interruption_data = 10; - - // Data specifying sentiment. - SentimentData sentiment_data = 11; - - // Data specifying silence. - SilenceData silence_data = 12; - - // Data specifying a hold. - HoldData hold_data = 13; - - // Data specifying an entity mention. - EntityMentionData entity_mention_data = 15; - - // Data specifying an intent match. - IntentMatchData intent_match_data = 16; - - // Data specifying a phrase match. - PhraseMatchData phrase_match_data = 17; - } - - // The channel of the audio where the annotation occurs. For single-channel - // audio, this field is not populated. - int32 channel_tag = 1; - - // The boundary in the conversation where the annotation starts, inclusive. - AnnotationBoundary annotation_start_boundary = 4; - - // The boundary in the conversation where the annotation ends, inclusive. - AnnotationBoundary annotation_end_boundary = 5; -} - -// A point in a conversation that marks the start or the end of an annotation. -message AnnotationBoundary { - // A detailed boundary, which describes a more specific point. - oneof detailed_boundary { - // The word index of this boundary with respect to the first word in the - // transcript piece. This index starts at zero. - int32 word_index = 3; - } - - // The index in the sequence of transcribed pieces of the conversation where - // the boundary is located. This index starts at zero. - int32 transcript_index = 1; -} - -// The data for an entity annotation. -// Represents a phrase in the conversation that is a known entity, such -// as a person, an organization, or location. -message Entity { - // The type of the entity. For most entity types, the associated metadata is a - // Wikipedia URL (`wikipedia_url`) and Knowledge Graph MID (`mid`). The table - // below lists the associated fields for entities that have different - // metadata. - enum Type { - // Unspecified. - TYPE_UNSPECIFIED = 0; - - // Person. - PERSON = 1; - - // Location. - LOCATION = 2; - - // Organization. - ORGANIZATION = 3; - - // Event. - EVENT = 4; - - // Artwork. - WORK_OF_ART = 5; - - // Consumer product. - CONSUMER_GOOD = 6; - - // Other types of entities. - OTHER = 7; - - // Phone number. - // - // The metadata lists the phone number (formatted according to local - // convention), plus whichever additional elements appear in the text: - // - // * `number` - The actual number, broken down into sections according to - // local convention. - // * `national_prefix` - Country code, if detected. - // * `area_code` - Region or area code, if detected. - // * `extension` - Phone extension (to be dialed after connection), if - // detected. - PHONE_NUMBER = 9; - - // Address. - // - // The metadata identifies the street number and locality plus whichever - // additional elements appear in the text: - // - // * `street_number` - Street number. - // * `locality` - City or town. - // * `street_name` - Street/route name, if detected. - // * `postal_code` - Postal code, if detected. - // * `country` - Country, if detected. - // * `broad_region` - Administrative area, such as the state, if detected. - // * `narrow_region` - Smaller administrative area, such as county, if - // detected. - // * `sublocality` - Used in Asian addresses to demark a district within a - // city, if detected. - ADDRESS = 10; - - // Date. - // - // The metadata identifies the components of the date: - // - // * `year` - Four digit year, if detected. - // * `month` - Two digit month number, if detected. - // * `day` - Two digit day number, if detected. - DATE = 11; - - // Number. - // - // The metadata is the number itself. - NUMBER = 12; - - // Price. - // - // The metadata identifies the `value` and `currency`. - PRICE = 13; - } - - // The representative name for the entity. - string display_name = 1; - - // The entity type. - Type type = 2; - - // Metadata associated with the entity. - // - // For most entity types, the metadata is a Wikipedia URL (`wikipedia_url`) - // and Knowledge Graph MID (`mid`), if they are available. For the metadata - // associated with other entity types, see the Type table below. - map metadata = 3; - - // The salience score associated with the entity in the [0, 1.0] range. - // - // The salience score for an entity provides information about the - // importance or centrality of that entity to the entire document text. - // Scores closer to 0 are less salient, while scores closer to 1.0 are highly - // salient. - float salience = 4; - - // The aggregate sentiment expressed for this entity in the conversation. - SentimentData sentiment = 5; -} - -// The data for an intent. -// Represents a detected intent in the conversation, for example MAKES_PROMISE. -message Intent { - // The unique identifier of the intent. - string id = 1; - - // The human-readable name of the intent. - string display_name = 2; -} - -// The data for a matched phrase matcher. -// Represents information identifying a phrase matcher for a given match. -message PhraseMatchData { - // The unique identifier (the resource name) of the phrase matcher. - string phrase_matcher = 1; - - // The human-readable name of the phrase matcher. - string display_name = 2; -} - -// The data for a Dialogflow intent. -// Represents a detected intent in the conversation, e.g. MAKES_PROMISE. -message DialogflowIntent { - // The human-readable name of the intent. - string display_name = 1; -} - -// The data for an interruption annotation. -message InterruptionData { - -} - -// The data for a silence annotation. -message SilenceData { - -} - -// The data for a hold annotation. -message HoldData { - -} - -// The data for an entity mention annotation. -// This represents a mention of an `Entity` in the conversation. -message EntityMentionData { - // The supported types of mentions. - enum MentionType { - // Unspecified. - MENTION_TYPE_UNSPECIFIED = 0; - - // Proper noun. - PROPER = 1; - - // Common noun (or noun compound). - COMMON = 2; - } - - // The key of this entity in conversation entities. - // Can be used to retrieve the exact `Entity` this mention is attached to. - string entity_unique_id = 1; - - // The type of the entity mention. - MentionType type = 2; - - // Sentiment expressed for this mention of the entity. - SentimentData sentiment = 3; -} - -// The data for an intent match. -// Represents an intent match for a text segment in the conversation. A text -// segment can be part of a sentence, a complete sentence, or an utterance -// with multiple sentences. -message IntentMatchData { - // The id of the matched intent. - // Can be used to retrieve the corresponding intent information. - string intent_unique_id = 1; -} - -// The data for a sentiment annotation. -message SentimentData { - // A non-negative number from 0 to infinity which represents the abolute - // magnitude of sentiment regardless of score. - float magnitude = 1; - - // The sentiment score between -1.0 (negative) and 1.0 (positive). - float score = 2; -} - -// The issue model resource. -message IssueModel { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/IssueModel" - pattern: "projects/{project}/locations/{location}/issueModels/{issue_model}" - }; - - // Configs for the input data used to create the issue model. - message InputDataConfig { - // Medium of conversations used in training data. This field is being - // deprecated. To specify the medium to be used in training a new issue - // model, set the `medium` field on `filter`. - Conversation.Medium medium = 1 [deprecated = true]; - - // Output only. Number of conversations used in training. Output only. - int64 training_conversations_count = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A filter to reduce the conversations used for training the model to a - // specific subset. - string filter = 3; - } - - // State of the model. - enum State { - // Unspecified. - STATE_UNSPECIFIED = 0; - - // Model is not deployed but is ready to deploy. - UNDEPLOYED = 1; - - // Model is being deployed. - DEPLOYING = 2; - - // Model is deployed and is ready to be used. A model can only be used in - // analysis if it's in this state. - DEPLOYED = 3; - - // Model is being undeployed. - UNDEPLOYING = 4; - - // Model is being deleted. - DELETING = 5; - } - - // Immutable. The resource name of the issue model. - // Format: - // projects/{project}/locations/{location}/issueModels/{issue_model} - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The representative name for the issue model. - string display_name = 2; - - // Output only. The time at which this issue model was created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time at which the issue model was updated. - google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. State of the model. - State state = 5 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Configs for the input data that used to create the issue model. - InputDataConfig input_data_config = 6; - - // Output only. Immutable. The issue model's label statistics on its training data. - IssueModelLabelStats training_stats = 7 [ - (google.api.field_behavior) = OUTPUT_ONLY, - (google.api.field_behavior) = IMMUTABLE - ]; -} - -// The issue resource. -message Issue { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/Issue" - pattern: "projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue}" - }; - - // Immutable. The resource name of the issue. - // Format: - // projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue} - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // The representative name for the issue. - string display_name = 2; - - // Output only. The time at which this issue was created. - google.protobuf.Timestamp create_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The most recent time that this issue was updated. - google.protobuf.Timestamp update_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// Aggregated statistics about an issue model. -message IssueModelLabelStats { - // Aggregated statistics about an issue. - message IssueStats { - // Issue resource. - // Format: - // projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue} - string issue = 1; - - // Number of conversations attached to the issue at this point in time. - int64 labeled_conversations_count = 2; - - // Display name of the issue. - string display_name = 3; - } - - // Number of conversations the issue model has analyzed at this point in time. - int64 analyzed_conversations_count = 1; - - // Number of analyzed conversations for which no issue was applicable at this - // point in time. - int64 unclassified_conversations_count = 2; - - // Statistics on each issue. Key is the issue's resource name. - map issue_stats = 3; -} - -// The phrase matcher resource. -message PhraseMatcher { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/PhraseMatcher" - pattern: "projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher}" - }; - - // Specifies how to combine each phrase match rule group to determine whether - // there is a match. - enum PhraseMatcherType { - // Unspecified. - PHRASE_MATCHER_TYPE_UNSPECIFIED = 0; - - // Must meet all phrase match rule groups or there is no match. - ALL_OF = 1; - - // If any of the phrase match rule groups are met, there is a match. - ANY_OF = 2; - } - - // The resource name of the phrase matcher. - // Format: - // projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher} - string name = 1; - - // Output only. Immutable. The revision ID of the phrase matcher. - // A new revision is committed whenever the matcher is changed, except when it - // is activated or deactivated. A server generated random ID will be used. - // Example: locations/global/phraseMatchers/my-first-matcher@1234567 - string revision_id = 2 [ - (google.api.field_behavior) = IMMUTABLE, - (google.api.field_behavior) = OUTPUT_ONLY - ]; - - // The customized version tag to use for the phrase matcher. If not specified, - // it will default to `revision_id`. - string version_tag = 3; - - // Output only. The timestamp of when the revision was created. It is also the create time - // when a new matcher is added. - google.protobuf.Timestamp revision_create_time = 4 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The human-readable name of the phrase matcher. - string display_name = 5; - - // Required. The type of this phrase matcher. - PhraseMatcherType type = 6 [(google.api.field_behavior) = REQUIRED]; - - // Applies the phrase matcher only when it is active. - bool active = 7; - - // A list of phase match rule groups that are included in this matcher. - repeated PhraseMatchRuleGroup phrase_match_rule_groups = 8; - - // Output only. The most recent time at which the activation status was updated. - google.protobuf.Timestamp activation_update_time = 9 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // The role whose utterances the phrase matcher should be matched - // against. If the role is ROLE_UNSPECIFIED it will be matched against any - // utterances in the transcript. - ConversationParticipant.Role role_match = 10; - - // Output only. The most recent time at which the phrase matcher was updated. - google.protobuf.Timestamp update_time = 11 [(google.api.field_behavior) = OUTPUT_ONLY]; -} - -// A message representing a rule in the phrase matcher. -message PhraseMatchRuleGroup { - // Specifies how to combine each phrase match rule for whether there is a - // match. - enum PhraseMatchRuleGroupType { - // Unspecified. - PHRASE_MATCH_RULE_GROUP_TYPE_UNSPECIFIED = 0; - - // Must meet all phrase match rules or there is no match. - ALL_OF = 1; - - // If any of the phrase match rules are met, there is a match. - ANY_OF = 2; - } - - // Required. The type of this phrase match rule group. - PhraseMatchRuleGroupType type = 1 [(google.api.field_behavior) = REQUIRED]; - - // A list of phase match rules that are included in this group. - repeated PhraseMatchRule phrase_match_rules = 2; -} - -// The data for a phrase match rule. -message PhraseMatchRule { - // Required. The phrase to be matched. - string query = 1 [(google.api.field_behavior) = REQUIRED]; - - // Specifies whether the phrase must be missing from the transcript segment or - // present in the transcript segment. - bool negated = 2; - - // Provides additional information about the rule that specifies how to apply - // the rule. - PhraseMatchRuleConfig config = 3; -} - -// Configuration information of a phrase match rule. -message PhraseMatchRuleConfig { - // The configuration of the phrase match rule. - oneof config { - // The configuration for the exact match rule. - ExactMatchConfig exact_match_config = 1; - } -} - -// Exact match configuration. -message ExactMatchConfig { - // Whether to consider case sensitivity when performing an exact match. - bool case_sensitive = 1; -} - -// The settings resource. -message Settings { - option (google.api.resource) = { - type: "contactcenterinsights.googleapis.com/Settings" - pattern: "projects/{project}/locations/{location}/settings" - }; - - // Default configuration when creating Analyses in Insights. - message AnalysisConfig { - // Percentage of conversations created using Dialogflow runtime integration - // to analyze automatically, between [0, 100]. - double runtime_integration_analysis_percentage = 1; - } - - // Immutable. The resource name of the settings resource. - // Format: - // projects/{project}/locations/{location}/settings - string name = 1 [(google.api.field_behavior) = IMMUTABLE]; - - // Output only. The time at which the settings was created. - google.protobuf.Timestamp create_time = 2 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // Output only. The time at which the settings were last updated. - google.protobuf.Timestamp update_time = 3 [(google.api.field_behavior) = OUTPUT_ONLY]; - - // A language code to be applied to each transcript segment unless the segment - // already specifies a language code. Language code defaults to "en-US" if it - // is neither specified on the segment nor here. - string language_code = 4; - - // The default TTL for newly-created conversations. If a conversation has a - // specified expiration, that value will be used instead. Changing this - // value will not change the expiration of existing conversations. - // Conversations with no expire time persist until they are deleted. - google.protobuf.Duration conversation_ttl = 5; - - // A map that maps a notification trigger to a Pub/Sub topic. Each time a - // specified trigger occurs, Insights will notify the corresponding Pub/Sub - // topic. - // - // Keys are notification triggers. Supported keys are: - // - // * "all-triggers": Notify each time any of the supported triggers occurs. - // * "create-analysis": Notify each time an analysis is created. - // * "create-conversation": Notify each time a conversation is created. - // * "export-insights-data": Notify each time an export is complete. - // * "update-conversation": Notify each time a conversation is updated via - // UpdateConversation. - // - // Values are Pub/Sub topics. The format of each Pub/Sub topic is: - // projects/{project}/topics/{topic} - map pubsub_notification_settings = 6; - - // Default analysis settings. - AnalysisConfig analysis_config = 7; -} - -// An annotation that was generated during the customer and agent interaction. -message RuntimeAnnotation { - // The data in the annotation. - oneof data { - // Agent Assist Article Suggestion data. - ArticleSuggestionData article_suggestion = 6; - - // Agent Assist FAQ answer data. - FaqAnswerData faq_answer = 7; - - // Agent Assist Smart Reply data. - SmartReplyData smart_reply = 8; - - // Agent Assist Smart Compose suggestion data. - SmartComposeSuggestionData smart_compose_suggestion = 9; - - // Dialogflow interaction data. - DialogflowInteractionData dialogflow_interaction = 10; - } - - // The unique identifier of the annotation. - // Format: - // projects/{project}/locations/{location}/conversationDatasets/{dataset}/conversationDataItems/{data_item}/conversationAnnotations/{annotation} - string annotation_id = 1; - - // The time at which this annotation was created. - google.protobuf.Timestamp create_time = 2; - - // The boundary in the conversation where the annotation starts, inclusive. - AnnotationBoundary start_boundary = 3; - - // The boundary in the conversation where the annotation ends, inclusive. - AnnotationBoundary end_boundary = 4; - - // The feedback that the customer has about the answer in `data`. - AnswerFeedback answer_feedback = 5; -} - -// The feedback that the customer has about a certain answer in the -// 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 an answer. - CorrectnessLevel correctness_level = 1; - - // Indicates whether an answer or item was clicked by the human agent. - bool clicked = 2; - - // Indicates whether an answer or item was displayed to the human agent in the - // agent desktop UI. - bool displayed = 3; -} - -// Agent Assist Article Suggestion data. -message ArticleSuggestionData { - // Article title. - string title = 1; - - // Article URI. - string uri = 2; - - // The system's confidence score that this article is a good match for this - // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely - // certain). - float confidence_score = 3; - - // Map that contains metadata about the Article Suggestion and the document - // that it originates from. - map metadata = 4; - - // Name of the query record. - // Format: - // projects/{project}/locations/{location}/queryRecords/{query_record} - string query_record = 5; - - // The knowledge document that this answer was extracted from. - // Format: - // projects/{project}/knowledgeBases/{knowledge_base}/documents/{document} - string source = 6; -} - -// Agent Assist frequently-asked-question answer data. -message FaqAnswerData { - // The piece of text from the `source` knowledge base document. - string answer = 1; - - // The system's confidence score that this answer is a good match for this - // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely - // certain). - float confidence_score = 2; - - // The corresponding FAQ question. - string question = 3; - - // Map that contains metadata about the FAQ answer and the document that - // it originates from. - map metadata = 4; - - // Name of the query record. - // Format: - // projects/{project}/locations/{location}/queryRecords/{query_record}. - string query_record = 5; - - // The knowledge document that this answer was extracted from. - // Format: - // projects/{project}/knowledgeBases/{knowledge_base}/documents/{document}. - string source = 6; -} - -// Agent Assist Smart Reply data. -message SmartReplyData { - // The content of the reply. - string reply = 1; - - // The system's confidence score that this reply is a good match for this - // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely - // certain). - double confidence_score = 2; - - // Map that contains metadata about the Smart Reply and the document from - // which it originates. - map metadata = 3; - - // Name of the query record. - // Format: - // projects/{project}/locations/{location}/queryRecords/{query_record} - string query_record = 4; -} - -// Agent Assist Smart Compose suggestion data. -message SmartComposeSuggestionData { - // The content of the suggestion. - string suggestion = 1; - - // The system's confidence score that this suggestion is a good match for this - // conversation, ranging from 0.0 (completely uncertain) to 1.0 (completely - // certain). - double confidence_score = 2; - - // Map that contains metadata about the Smart Compose suggestion and the - // document from which it originates. - map metadata = 3; - - // Name of the query record. - // Format: - // projects/{project}/locations/{location}/queryRecords/{query_record} - string query_record = 4; -} - -// Dialogflow interaction data. -message DialogflowInteractionData { - // The Dialogflow intent resource path. Format: - // projects/{project}/agent/{agent}/intents/{intent} - string dialogflow_intent_id = 1; - - // The confidence of the match ranging from 0.0 (completely uncertain) to 1.0 - // (completely certain). - float confidence = 2; -} - -// The call participant speaking for a given utterance. -message ConversationParticipant { - // The role of the participant. - enum Role { - // Participant's role is not set. - ROLE_UNSPECIFIED = 0; - - // Participant is a human agent. - HUMAN_AGENT = 1; - - // Participant is an automated agent. - AUTOMATED_AGENT = 2; - - // Participant is an end user who conversed with the contact center. - END_USER = 3; - - // Participant is either a human or automated agent. - ANY_AGENT = 4; - } - - oneof participant { - // The name of the participant provided by Dialogflow. Format: - // projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant} - string dialogflow_participant_name = 5 [(google.api.resource_reference) = { - type: "dialogflow.googleapis.com/Participant" - }]; - - // A user-specified ID representing the participant. - string user_id = 6; - } - - // Deprecated. Use `dialogflow_participant_name` instead. - // The name of the Dialogflow participant. Format: - // projects/{project}/locations/{location}/conversations/{conversation}/participants/{participant} - string dialogflow_participant = 1 [deprecated = true]; - - // Obfuscated user ID from Dialogflow. - string obfuscated_external_user_id = 3; - - // The role of the participant. - Role role = 2; -} diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js deleted file mode 100644 index fd1d9eb..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(issueModel) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The resource name of the issue model to query against. - */ - // const issueModel = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCalculateIssueModelStats() { - // Construct request - const request = { - issueModel, - }; - - // Run request - const response = await contactcenterinsightsClient.calculateIssueModelStats(request); - console.log(response); - } - - callCalculateIssueModelStats(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js deleted file mode 100644 index 1dffad3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.calculate_stats.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(location) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The location of the conversations. - */ - // const location = 'abc123' - /** - * A filter to reduce results to a specific subset. This field is useful for - * getting statistics about conversations with specific properties. - */ - // const filter = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCalculateStats() { - // Construct request - const request = { - location, - }; - - // Run request - const response = await contactcenterinsightsClient.calculateStats(request); - console.log(response); - } - - callCalculateStats(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js deleted file mode 100644 index 9b7ce4a..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_analysis.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, analysis) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the analysis. - */ - // const parent = 'abc123' - /** - * Required. The analysis to create. - */ - // const analysis = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCreateAnalysis() { - // Construct request - const request = { - parent, - analysis, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.createAnalysis(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateAnalysis(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js deleted file mode 100644 index 85c43f2..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_conversation.js +++ /dev/null @@ -1,66 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, conversation) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the conversation. - */ - // const parent = 'abc123' - /** - * Required. The conversation resource to create. - */ - // const conversation = {} - /** - * A unique ID for the new conversation. This ID will become the final - * component of the conversation's resource name. If no ID is specified, a - * server-generated ID will be used. - * This value should be 4-64 characters and must match the regular - * expression `^[a-z0-9-]{4,64}$`. Valid characters are `[a-z][0-9]-` - */ - // const conversationId = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCreateConversation() { - // Construct request - const request = { - parent, - conversation, - }; - - // Run request - const response = await contactcenterinsightsClient.createConversation(request); - console.log(response); - } - - callCreateConversation(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js deleted file mode 100644 index b9538d8..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_issue_model.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, issueModel) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the issue model. - */ - // const parent = 'abc123' - /** - * Required. The issue model to create. - */ - // const issueModel = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCreateIssueModel() { - // Construct request - const request = { - parent, - issueModel, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.createIssueModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callCreateIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js deleted file mode 100644 index 5daf091..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.create_phrase_matcher.js +++ /dev/null @@ -1,61 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent, phraseMatcher) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the phrase matcher. Required. The location to create - * a phrase matcher for. - * Format: `projects//locations/` or - * `projects//locations/` - */ - // const parent = 'abc123' - /** - * Required. The phrase matcher resource to create. - */ - // const phraseMatcher = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callCreatePhraseMatcher() { - // Construct request - const request = { - parent, - phraseMatcher, - }; - - // Run request - const response = await contactcenterinsightsClient.createPhraseMatcher(request); - console.log(response); - } - - callCreatePhraseMatcher(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js deleted file mode 100644 index 35e148b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_analysis.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the analysis to delete. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callDeleteAnalysis() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.deleteAnalysis(request); - console.log(response); - } - - callDeleteAnalysis(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js deleted file mode 100644 index 8c5ae06..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_conversation.js +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation to delete. - */ - // const name = 'abc123' - /** - * If set to true, all of this conversation's analyses will also be deleted. - * Otherwise, the request will only succeed if the conversation has no - * analyses. - */ - // const force = true - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callDeleteConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.deleteConversation(request); - console.log(response); - } - - callDeleteConversation(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js deleted file mode 100644 index 5460941..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_issue_model.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the issue model to delete. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callDeleteIssueModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.deleteIssueModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeleteIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js deleted file mode 100644 index ee88f8b..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.delete_phrase_matcher.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the phrase matcher to delete. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callDeletePhraseMatcher() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.deletePhraseMatcher(request); - console.log(response); - } - - callDeletePhraseMatcher(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js deleted file mode 100644 index 9662aac..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.deploy_issue_model.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The issue model to deploy. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callDeployIssueModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.deployIssueModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callDeployIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js deleted file mode 100644 index 1adba45..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.export_insights_data.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Specified if sink is a BigQuery table. - */ - // const bigQueryDestination = {} - /** - * Required. The parent resource to export data from. - */ - // const parent = 'abc123' - /** - * A filter to reduce results to a specific subset. Useful for exporting - * conversations with specific properties. - */ - // const filter = 'abc123' - /** - * A fully qualified KMS key name for BigQuery tables protected by CMEK. - * Format: - * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} - */ - // const kmsKey = 'abc123' - /** - * Options for what to do if the destination table already exists. - */ - // const writeDisposition = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callExportInsightsData() { - // Construct request - const request = { - parent, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.exportInsightsData(request); - const [response] = await operation.promise(); - console.log(response); - } - - callExportInsightsData(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js deleted file mode 100644 index 4e67ed9..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_analysis.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the analysis to get. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetAnalysis() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getAnalysis(request); - console.log(response); - } - - callGetAnalysis(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js deleted file mode 100644 index e1c30c1..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_conversation.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the conversation to get. - */ - // const name = 'abc123' - /** - * The level of details of the conversation. Default is `FULL`. - */ - // const view = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetConversation() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getConversation(request); - console.log(response); - } - - callGetConversation(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js deleted file mode 100644 index 4fda155..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the issue to get. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetIssue() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getIssue(request); - console.log(response); - } - - callGetIssue(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js deleted file mode 100644 index 5324b99..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_issue_model.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the issue model to get. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetIssueModel() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getIssueModel(request); - console.log(response); - } - - callGetIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js deleted file mode 100644 index 3080a91..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_phrase_matcher.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the phrase matcher to get. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetPhraseMatcher() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getPhraseMatcher(request); - console.log(response); - } - - callGetPhraseMatcher(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js deleted file mode 100644 index 98d7200..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.get_settings.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The name of the settings resource to get. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callGetSettings() { - // Construct request - const request = { - name, - }; - - // Run request - const response = await contactcenterinsightsClient.getSettings(request); - console.log(response); - } - - callGetSettings(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js deleted file mode 100644 index 7182520..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_analyses.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the analyses. - */ - // const parent = 'abc123' - /** - * The maximum number of analyses to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - */ - // const pageSize = 1234 - /** - * The value returned by the last `ListAnalysesResponse`; indicates - * that this is a continuation of a prior `ListAnalyses` call and - * the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - */ - // const filter = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callListAnalyses() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await contactcenterinsightsClient.listAnalysesAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListAnalyses(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js deleted file mode 100644 index 1dc83a3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_conversations.js +++ /dev/null @@ -1,77 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the conversation. - */ - // const parent = 'abc123' - /** - * The maximum number of conversations to return in the response. A valid page - * size ranges from 0 to 1,000 inclusive. If the page size is zero or - * unspecified, a default page size of 100 will be chosen. Note that a call - * might return fewer results than the requested page size. - */ - // const pageSize = 1234 - /** - * The value returned by the last `ListConversationsResponse`. This value - * indicates that this is a continuation of a prior `ListConversations` call - * and that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - */ - // const filter = 'abc123' - /** - * The level of details of the conversation. Default is `BASIC`. - */ - // const view = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callListConversations() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await contactcenterinsightsClient.listConversationsAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListConversations(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js deleted file mode 100644 index 2f108f3..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issue_models.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the issue model. - */ - // const parent = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callListIssueModels() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await contactcenterinsightsClient.listIssueModels(request); - console.log(response); - } - - callListIssueModels(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js deleted file mode 100644 index 7ccfdaf..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_issues.js +++ /dev/null @@ -1,53 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the issue. - */ - // const parent = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callListIssues() { - // Construct request - const request = { - parent, - }; - - // Run request - const response = await contactcenterinsightsClient.listIssues(request); - console.log(response); - } - - callListIssues(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js deleted file mode 100644 index 7929f1f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.list_phrase_matchers.js +++ /dev/null @@ -1,73 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(parent) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The parent resource of the phrase matcher. - */ - // const parent = 'abc123' - /** - * The maximum number of phrase matchers to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - */ - // const pageSize = 1234 - /** - * The value returned by the last `ListPhraseMatchersResponse`. This value - * indicates that this is a continuation of a prior `ListPhraseMatchers` call - * and that the system should return the next page of data. - */ - // const pageToken = 'abc123' - /** - * A filter to reduce results to a specific subset. Useful for querying - * phrase matchers with specific properties. - */ - // const filter = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callListPhraseMatchers() { - // Construct request - const request = { - parent, - }; - - // Run request - const iterable = await contactcenterinsightsClient.listPhraseMatchersAsync(request); - for await (const response of iterable) { - console.log(response); - } - } - - callListPhraseMatchers(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js deleted file mode 100644 index 8de50e0..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.undeploy_issue_model.js +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(name) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The issue model to undeploy. - */ - // const name = 'abc123' - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUndeployIssueModel() { - // Construct request - const request = { - name, - }; - - // Run request - const [operation] = await contactcenterinsightsClient.undeployIssueModel(request); - const [response] = await operation.promise(); - console.log(response); - } - - callUndeployIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js deleted file mode 100644 index 69ad78f..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_conversation.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(conversation) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the conversation. - */ - // const conversation = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUpdateConversation() { - // Construct request - const request = { - conversation, - }; - - // Run request - const response = await contactcenterinsightsClient.updateConversation(request); - console.log(response); - } - - callUpdateConversation(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js deleted file mode 100644 index c788d85..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(issue) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the issue. - */ - // const issue = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUpdateIssue() { - // Construct request - const request = { - issue, - }; - - // Run request - const response = await contactcenterinsightsClient.updateIssue(request); - console.log(response); - } - - callUpdateIssue(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js deleted file mode 100644 index 9e32460..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_issue_model.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(issueModel) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the issue model. - */ - // const issueModel = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUpdateIssueModel() { - // Construct request - const request = { - issueModel, - }; - - // Run request - const response = await contactcenterinsightsClient.updateIssueModel(request); - console.log(response); - } - - callUpdateIssueModel(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js deleted file mode 100644 index b5ebdc9..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_phrase_matcher.js +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(phraseMatcher) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new values for the phrase matcher. - */ - // const phraseMatcher = {} - /** - * The list of fields to be updated. - */ - // const updateMask = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUpdatePhraseMatcher() { - // Construct request - const request = { - phraseMatcher, - }; - - // Run request - const response = await contactcenterinsightsClient.updatePhraseMatcher(request); - console.log(response); - } - - callUpdatePhraseMatcher(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js b/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js deleted file mode 100644 index a3fb740..0000000 --- a/owl-bot-staging/v1/samples/generated/v1/contact_center_insights.update_settings.js +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// http://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - - -'use strict'; - -function main(settings, updateMask) { - // [START contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async] - /** - * TODO(developer): Uncomment these variables before running the sample. - */ - /** - * Required. The new settings values. - */ - // const settings = {} - /** - * Required. The list of fields to be updated. - */ - // const updateMask = {} - - // Imports the Contactcenterinsights library - const {ContactCenterInsightsClient} = require('@google-cloud/contact-center-insights').v1; - - // Instantiates a client - const contactcenterinsightsClient = new ContactCenterInsightsClient(); - - async function callUpdateSettings() { - // Construct request - const request = { - settings, - updateMask, - }; - - // Run request - const response = await contactcenterinsightsClient.updateSettings(request); - console.log(response); - } - - callUpdateSettings(); - // [END contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async] -} - -process.on('unhandledRejection', err => { - console.error(err.message); - process.exitCode = 1; -}); -main(...process.argv.slice(2)); diff --git a/owl-bot-staging/v1/src/index.ts b/owl-bot-staging/v1/src/index.ts deleted file mode 100644 index fd1c879..0000000 --- a/owl-bot-staging/v1/src/index.ts +++ /dev/null @@ -1,25 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** This file is automatically generated by gapic-generator-typescript. ** -// ** https://github.com/googleapis/gapic-generator-typescript ** -// ** All changes to this file may be overwritten. ** - -import * as v1 from './v1'; -const ContactCenterInsightsClient = v1.ContactCenterInsightsClient; -type ContactCenterInsightsClient = v1.ContactCenterInsightsClient; -export {v1, ContactCenterInsightsClient}; -export default {v1, ContactCenterInsightsClient}; -import * as protos from '../protos/protos'; -export {protos} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts b/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts deleted file mode 100644 index 8f47e09..0000000 --- a/owl-bot-staging/v1/src/v1/contact_center_insights_client.ts +++ /dev/null @@ -1,3362 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 * as gax from 'google-gax'; -import {Callback, CallOptions, Descriptors, ClientOptions, LROperation, PaginationCallback, GaxCall} from 'google-gax'; - -import { Transform } from 'stream'; -import { RequestType } from 'google-gax/build/src/apitypes'; -import * as protos from '../../protos/protos'; -import jsonProtos = require('../../protos/protos.json'); -/** - * Client JSON configuration object, loaded from - * `src/v1/contact_center_insights_client_config.json`. - * This file defines retry strategy and timeouts for all API methods in this library. - */ -import * as gapicConfig from './contact_center_insights_client_config.json'; -import { operationsProtos } from 'google-gax'; -const version = require('../../../package.json').version; - -/** - * An API that lets users analyze and explore their business conversation data. - * @class - * @memberof v1 - */ -export class ContactCenterInsightsClient { - private _terminated = false; - private _opts: ClientOptions; - private _providedCustomServicePath: boolean; - private _gaxModule: typeof gax | typeof gax.fallback; - private _gaxGrpc: gax.GrpcClient | gax.fallback.GrpcClient; - private _protos: {}; - private _defaults: {[method: string]: gax.CallSettings}; - auth: gax.GoogleAuth; - descriptors: Descriptors = { - page: {}, - stream: {}, - longrunning: {}, - batching: {}, - }; - warn: (code: string, message: string, warnType?: string) => void; - innerApiCalls: {[name: string]: Function}; - pathTemplates: {[name: string]: gax.PathTemplate}; - operationsClient: gax.OperationsClient; - contactCenterInsightsStub?: Promise<{[name: string]: Function}>; - - /** - * Construct an instance of ContactCenterInsightsClient. - * - * @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/master/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} [options.fallback] - Use HTTP fallback mode. - * In fallback mode, a special browser-compatible transport implementation is used - * instead of gRPC transport. In browser context (if the `window` object is defined) - * the fallback mode is enabled automatically; set `options.fallback` to `false` - * if you need to override this behavior. - */ - constructor(opts?: ClientOptions) { - // Ensure that options include all the required fields. - const staticMembers = this.constructor as typeof ContactCenterInsightsClient; - 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; - } - - // Choose either gRPC or proto-over-HTTP implementation of google-gax. - this._gaxModule = opts.fallback ? gax.fallback : gax; - - // Create a `gaxGrpc` object, with any grpc-specific options sent to the client. - this._gaxGrpc = new this._gaxModule.GrpcClient(opts); - - // Save options to use in initialize() method. - this._opts = opts; - - // Save the auth object to the client, for use by other methods. - this.auth = (this._gaxGrpc.auth as gax.GoogleAuth); - - // Set useJWTAccessWithScope on the auth object. - this.auth.useJWTAccessWithScope = true; - - // Set defaultServicePath on the auth object. - this.auth.defaultServicePath = staticMembers.servicePath; - - // Set the default scopes in auth client if needed. - if (servicePath === staticMembers.servicePath) { - this.auth.defaultScopes = staticMembers.scopes; - } - - // Determine the client header string. - const clientHeader = [ - `gax/${this._gaxModule.version}`, - `gapic/${version}`, - ]; - if (typeof process !== 'undefined' && 'versions' in process) { - clientHeader.push(`gl-node/${process.versions.node}`); - } else { - clientHeader.push(`gl-web/${this._gaxModule.version}`); - } - if (!opts.fallback) { - clientHeader.push(`grpc/${this._gaxGrpc.grpcVersion}`); - } else if (opts.fallback === 'rest' ) { - clientHeader.push(`rest/${this._gaxGrpc.grpcVersion}`); - } - if (opts.libName && opts.libVersion) { - clientHeader.push(`${opts.libName}/${opts.libVersion}`); - } - // Load the applicable protos. - this._protos = this._gaxGrpc.loadProtoJSON(jsonProtos); - - // This API contains "path templates"; forward-slash-separated - // identifiers to uniquely identify resources within the API. - // Create useful helper objects for these. - this.pathTemplates = { - analysisPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}/analyses/{analysis}' - ), - conversationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/conversations/{conversation}' - ), - issuePathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/issueModels/{issue_model}/issues/{issue}' - ), - issueModelPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/issueModels/{issue_model}' - ), - locationPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}' - ), - phraseMatcherPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/phraseMatchers/{phrase_matcher}' - ), - settingsPathTemplate: new this._gaxModule.PathTemplate( - 'projects/{project}/locations/{location}/settings' - ), - }; - - // 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'), - listAnalyses: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'analyses'), - listPhraseMatchers: - new this._gaxModule.PageDescriptor('pageToken', 'nextPageToken', 'phraseMatchers') - }; - - 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. - - this.operationsClient = this._gaxModule.lro({ - auth: this.auth, - grpc: 'grpc' in this._gaxGrpc ? this._gaxGrpc.grpc : undefined - }).operationsClient(opts); - const createAnalysisResponse = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.Analysis') as gax.protobuf.Type; - const createAnalysisMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.CreateAnalysisOperationMetadata') as gax.protobuf.Type; - const exportInsightsDataResponse = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.ExportInsightsDataResponse') as gax.protobuf.Type; - const exportInsightsDataMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.ExportInsightsDataMetadata') as gax.protobuf.Type; - const createIssueModelResponse = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.IssueModel') as gax.protobuf.Type; - const createIssueModelMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.CreateIssueModelMetadata') as gax.protobuf.Type; - const deleteIssueModelResponse = protoFilesRoot.lookup( - '.google.protobuf.Empty') as gax.protobuf.Type; - const deleteIssueModelMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.DeleteIssueModelMetadata') as gax.protobuf.Type; - const deployIssueModelResponse = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.DeployIssueModelResponse') as gax.protobuf.Type; - const deployIssueModelMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.DeployIssueModelMetadata') as gax.protobuf.Type; - const undeployIssueModelResponse = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.UndeployIssueModelResponse') as gax.protobuf.Type; - const undeployIssueModelMetadata = protoFilesRoot.lookup( - '.google.cloud.contactcenterinsights.v1.UndeployIssueModelMetadata') as gax.protobuf.Type; - - this.descriptors.longrunning = { - createAnalysis: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createAnalysisResponse.decode.bind(createAnalysisResponse), - createAnalysisMetadata.decode.bind(createAnalysisMetadata)), - exportInsightsData: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - exportInsightsDataResponse.decode.bind(exportInsightsDataResponse), - exportInsightsDataMetadata.decode.bind(exportInsightsDataMetadata)), - createIssueModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - createIssueModelResponse.decode.bind(createIssueModelResponse), - createIssueModelMetadata.decode.bind(createIssueModelMetadata)), - deleteIssueModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deleteIssueModelResponse.decode.bind(deleteIssueModelResponse), - deleteIssueModelMetadata.decode.bind(deleteIssueModelMetadata)), - deployIssueModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - deployIssueModelResponse.decode.bind(deployIssueModelResponse), - deployIssueModelMetadata.decode.bind(deployIssueModelMetadata)), - undeployIssueModel: new this._gaxModule.LongrunningDescriptor( - this.operationsClient, - undeployIssueModelResponse.decode.bind(undeployIssueModelResponse), - undeployIssueModelMetadata.decode.bind(undeployIssueModelMetadata)) - }; - - // Put together the default options sent with requests. - this._defaults = this._gaxGrpc.constructSettings( - 'google.cloud.contactcenterinsights.v1.ContactCenterInsights', 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 = gax.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.contactCenterInsightsStub) { - return this.contactCenterInsightsStub; - } - - // Put together the "service stub" for - // google.cloud.contactcenterinsights.v1.ContactCenterInsights. - this.contactCenterInsightsStub = this._gaxGrpc.createStub( - this._opts.fallback ? - (this._protos as protobuf.Root).lookupService('google.cloud.contactcenterinsights.v1.ContactCenterInsights') : - // eslint-disable-next-line @typescript-eslint/no-explicit-any - (this._protos as any).google.cloud.contactcenterinsights.v1.ContactCenterInsights, - 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 contactCenterInsightsStubMethods = - ['createConversation', 'updateConversation', 'getConversation', 'listConversations', 'deleteConversation', 'createAnalysis', 'getAnalysis', 'listAnalyses', 'deleteAnalysis', 'exportInsightsData', 'createIssueModel', 'updateIssueModel', 'getIssueModel', 'listIssueModels', 'deleteIssueModel', 'deployIssueModel', 'undeployIssueModel', 'getIssue', 'listIssues', 'updateIssue', 'calculateIssueModelStats', 'createPhraseMatcher', 'getPhraseMatcher', 'listPhraseMatchers', 'deletePhraseMatcher', 'updatePhraseMatcher', 'calculateStats', 'getSettings', 'updateSettings']; - for (const methodName of contactCenterInsightsStubMethods) { - const callPromise = this.contactCenterInsightsStub.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.innerApiCalls[methodName] = apiCall; - } - - return this.contactCenterInsightsStub; - } - - /** - * The DNS address for this API service. - * @returns {string} The DNS address for this service. - */ - static get servicePath() { - return 'contactcenterinsights.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 'contactcenterinsights.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' - ]; - } - - 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 conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the conversation. - * @param {google.cloud.contactcenterinsights.v1.Conversation} request.conversation - * Required. The conversation resource to create. - * @param {string} request.conversationId - * A unique ID for the new conversation. This ID will become the final - * component of the conversation's resource name. If no ID is specified, a - * server-generated ID will be used. - * - * This value should be 4-64 characters and must match the regular - * expression `^{@link 0-9|a-z0-9-]{4,64}$`. Valid characters are `[a-z}-` - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.contactcenterinsights.v1.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/v1/contact_center_insights.create_conversation.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateConversation_async - */ - createConversation( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|undefined, {}|undefined - ]>; - createConversation( - request: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; - createConversation( - request: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): void; - createConversation( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.ICreateConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createConversation(request, options, callback); - } -/** - * Updates a conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.Conversation} request.conversation - * Required. The new values for the conversation. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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 [Conversation]{@link google.cloud.contactcenterinsights.v1.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/v1/contact_center_insights.update_conversation.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateConversation_async - */ - updateConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|undefined, {}|undefined - ]>; - updateConversation( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, - {}|null|undefined>): void; - updateConversation( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, - {}|null|undefined>): void; - updateConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IUpdateConversationRequest|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' - ] = gax.routingHeader.fromParams({ - 'conversation.name': request.conversation!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateConversation(request, options, callback); - } -/** - * Gets a conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation to get. - * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view - * The level of details of the conversation. Default is `FULL`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.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.contactcenterinsights.v1.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/v1/contact_center_insights.get_conversation.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetConversation_async - */ - getConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|undefined, {}|undefined - ]>; - getConversation( - request: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; - getConversation( - request: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, - {}|null|undefined>): void; - getConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.IGetConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation, - protos.google.cloud.contactcenterinsights.v1.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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getConversation(request, options, callback); - } -/** - * Deletes a conversation. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the conversation to delete. - * @param {boolean} request.force - * If set to true, all of this conversation's analyses will also be deleted. - * Otherwise, the request will only succeed if the conversation has no - * analyses. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.delete_conversation.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteConversation_async - */ - deleteConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|undefined, {}|undefined - ]>; - deleteConversation( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, - {}|null|undefined>): void; - deleteConversation( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, - {}|null|undefined>): void; - deleteConversation( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteConversationRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteConversation(request, options, callback); - } -/** - * Gets an analysis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the analysis to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.get_analysis.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetAnalysis_async - */ - getAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|undefined, {}|undefined - ]>; - getAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): void; - getAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): void; - getAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IAnalysis, - protos.google.cloud.contactcenterinsights.v1.IGetAnalysisRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getAnalysis(request, options, callback); - } -/** - * Deletes an analysis. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the analysis to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.delete_analysis.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteAnalysis_async - */ - deleteAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|undefined, {}|undefined - ]>; - deleteAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, - {}|null|undefined>): void; - deleteAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, - {}|null|undefined>): void; - deleteAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeleteAnalysisRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteAnalysis(request, options, callback); - } -/** - * Updates an issue model. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.IssueModel} request.issueModel - * Required. The new values for the issue model. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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 [IssueModel]{@link google.cloud.contactcenterinsights.v1.IssueModel}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.update_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssueModel_async - */ - updateIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|undefined, {}|undefined - ]>; - updateIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, - {}|null|undefined>): void; - updateIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, - {}|null|undefined>): void; - updateIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueModelRequest|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' - ] = gax.routingHeader.fromParams({ - 'issue_model.name': request.issueModel!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateIssueModel(request, options, callback); - } -/** - * Gets an issue model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the issue model to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [IssueModel]{@link google.cloud.contactcenterinsights.v1.IssueModel}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.get_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetIssueModel_async - */ - getIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|undefined, {}|undefined - ]>; - getIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, - {}|null|undefined>): void; - getIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, - {}|null|undefined>): void; - getIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssueModel, - protos.google.cloud.contactcenterinsights.v1.IGetIssueModelRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getIssueModel(request, options, callback); - } -/** - * Lists issue models. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the issue model. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListIssueModelsResponse]{@link google.cloud.contactcenterinsights.v1.ListIssueModelsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.list_issue_models.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListIssueModels_async - */ - listIssueModels( - request?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|undefined, {}|undefined - ]>; - listIssueModels( - request: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, - {}|null|undefined>): void; - listIssueModels( - request: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, - {}|null|undefined>): void; - listIssueModels( - request?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssueModelsRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listIssueModels(request, options, callback); - } -/** - * Gets an issue. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the issue to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Issue]{@link google.cloud.contactcenterinsights.v1.Issue}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.get_issue.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetIssue_async - */ - getIssue( - request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|undefined, {}|undefined - ]>; - getIssue( - request: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, - {}|null|undefined>): void; - getIssue( - request: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, - {}|null|undefined>): void; - getIssue( - request?: protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IGetIssueRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getIssue(request, options, callback); - } -/** - * Lists issues. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the issue. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [ListIssuesResponse]{@link google.cloud.contactcenterinsights.v1.ListIssuesResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.list_issues.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListIssues_async - */ - listIssues( - request?: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|undefined, {}|undefined - ]>; - listIssues( - request: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, - {}|null|undefined>): void; - listIssues( - request: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, - {}|null|undefined>): void; - listIssues( - request?: protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse, - protos.google.cloud.contactcenterinsights.v1.IListIssuesRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listIssues(request, options, callback); - } -/** - * Updates an issue. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.Issue} request.issue - * Required. The new values for the issue. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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 [Issue]{@link google.cloud.contactcenterinsights.v1.Issue}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.update_issue.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateIssue_async - */ - updateIssue( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|undefined, {}|undefined - ]>; - updateIssue( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, - {}|null|undefined>): void; - updateIssue( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, - {}|null|undefined>): void; - updateIssue( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IIssue, - protos.google.cloud.contactcenterinsights.v1.IUpdateIssueRequest|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' - ] = gax.routingHeader.fromParams({ - 'issue.name': request.issue!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateIssue(request, options, callback); - } -/** - * Gets an issue model's statistics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.issueModel - * Required. The resource name of the issue model to query against. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CalculateIssueModelStatsResponse]{@link google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.calculate_issue_model_stats.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CalculateIssueModelStats_async - */ - calculateIssueModelStats( - request?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|undefined, {}|undefined - ]>; - calculateIssueModelStats( - request: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, - {}|null|undefined>): void; - calculateIssueModelStats( - request: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, - {}|null|undefined>): void; - calculateIssueModelStats( - request?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsRequest|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' - ] = gax.routingHeader.fromParams({ - 'issue_model': request.issueModel || '', - }); - this.initialize(); - return this.innerApiCalls.calculateIssueModelStats(request, options, callback); - } -/** - * Creates a phrase matcher. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the phrase matcher. Required. The location to create - * a phrase matcher for. - * Format: `projects//locations/` or - * `projects//locations/` - * @param {google.cloud.contactcenterinsights.v1.PhraseMatcher} request.phraseMatcher - * Required. The phrase matcher resource 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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.create_phrase_matcher.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreatePhraseMatcher_async - */ - createPhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|undefined, {}|undefined - ]>; - createPhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - createPhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - createPhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.ICreatePhraseMatcherRequest|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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createPhraseMatcher(request, options, callback); - } -/** - * Gets a phrase matcher. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the phrase matcher to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.get_phrase_matcher.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetPhraseMatcher_async - */ - getPhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|undefined, {}|undefined - ]>; - getPhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - getPhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - getPhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IGetPhraseMatcherRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getPhraseMatcher(request, options, callback); - } -/** - * Deletes a phrase matcher. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the phrase matcher to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Empty]{@link google.protobuf.Empty}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.delete_phrase_matcher.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeletePhraseMatcher_async - */ - deletePhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, - options?: CallOptions): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|undefined, {}|undefined - ]>; - deletePhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, - options: CallOptions, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - deletePhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, - callback: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - deletePhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.protobuf.IEmpty, - protos.google.cloud.contactcenterinsights.v1.IDeletePhraseMatcherRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deletePhraseMatcher(request, options, callback); - } -/** - * Updates a phrase matcher. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.PhraseMatcher} request.phraseMatcher - * Required. The new values for the phrase matcher. - * @param {google.protobuf.FieldMask} request.updateMask - * The list of fields to 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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.update_phrase_matcher.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdatePhraseMatcher_async - */ - updatePhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|undefined, {}|undefined - ]>; - updatePhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - updatePhraseMatcher( - request: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): void; - updatePhraseMatcher( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher, - protos.google.cloud.contactcenterinsights.v1.IUpdatePhraseMatcherRequest|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' - ] = gax.routingHeader.fromParams({ - 'phrase_matcher.name': request.phraseMatcher!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updatePhraseMatcher(request, options, callback); - } -/** - * Gets conversation statistics. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.location - * Required. The location of the conversations. - * @param {string} request.filter - * A filter to reduce results to a specific subset. This field is useful for - * getting statistics about conversations with specific properties. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [CalculateStatsResponse]{@link google.cloud.contactcenterinsights.v1.CalculateStatsResponse}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.calculate_stats.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CalculateStats_async - */ - calculateStats( - request?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|undefined, {}|undefined - ]>; - calculateStats( - request: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, - {}|null|undefined>): void; - calculateStats( - request: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, - {}|null|undefined>): void; - calculateStats( - request?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse, - protos.google.cloud.contactcenterinsights.v1.ICalculateStatsRequest|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' - ] = gax.routingHeader.fromParams({ - 'location': request.location || '', - }); - this.initialize(); - return this.innerApiCalls.calculateStats(request, options, callback); - } -/** - * Gets project-level settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the settings resource to get. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing [Settings]{@link google.cloud.contactcenterinsights.v1.Settings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.get_settings.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_GetSettings_async - */ - getSettings( - request?: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|undefined, {}|undefined - ]>; - getSettings( - request: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): void; - getSettings( - request?: protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IGetSettingsRequest|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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.getSettings(request, options, callback); - } -/** - * Updates project-level settings. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.Settings} request.settings - * Required. The new settings values. - * @param {google.protobuf.FieldMask} request.updateMask - * Required. The list of fields to 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 [Settings]{@link google.cloud.contactcenterinsights.v1.Settings}. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#regular-methods) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.update_settings.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UpdateSettings_async - */ - updateSettings( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|undefined, {}|undefined - ]>; - updateSettings( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, - options: CallOptions, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, - callback: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): void; - updateSettings( - request?: protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest, - optionsOrCallback?: CallOptions|Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>, - callback?: Callback< - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|null|undefined, - {}|null|undefined>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.ISettings, - protos.google.cloud.contactcenterinsights.v1.IUpdateSettingsRequest|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' - ] = gax.routingHeader.fromParams({ - 'settings.name': request.settings!.name || '', - }); - this.initialize(); - return this.innerApiCalls.updateSettings(request, options, callback); - } - -/** - * Creates an analysis. The long running operation is done when the analysis - * has completed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the analysis. - * @param {google.cloud.contactcenterinsights.v1.Analysis} request.analysis - * Required. The analysis 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/v1/contact_center_insights.create_analysis.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async - */ - createAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAnalysis( - request: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createAnalysis( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateAnalysisRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createAnalysis(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createAnalysis()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.create_analysis.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateAnalysis_async - */ - async checkCreateAnalysisProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createAnalysis, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Export insights data to a destination defined in the request body. - * - * @param {Object} request - * The request object that will be sent. - * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.BigQueryDestination} request.bigQueryDestination - * Specified if sink is a BigQuery table. - * @param {string} request.parent - * Required. The parent resource to export data from. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for exporting - * conversations with specific properties. - * @param {string} request.kmsKey - * A fully qualified KMS key name for BigQuery tables protected by CMEK. - * Format: - * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} - * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} request.writeDisposition - * Options for what to do if the destination table already exists. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.export_insights_data.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async - */ - exportInsightsData( - request?: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - exportInsightsData( - request: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInsightsData( - request: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - exportInsightsData( - request?: protos.google.cloud.contactcenterinsights.v1.IExportInsightsDataRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.exportInsightsData(request, options, callback); - } -/** - * Check the status of the long running operation returned by `exportInsightsData()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.export_insights_data.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ExportInsightsData_async - */ - async checkExportInsightsDataProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.exportInsightsData, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Creates an issue model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the issue model. - * @param {google.cloud.contactcenterinsights.v1.IssueModel} request.issueModel - * Required. The issue 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/v1/contact_center_insights.create_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async - */ - createIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - createIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - createIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.ICreateIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.createIssueModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `createIssueModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.create_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_CreateIssueModel_async - */ - async checkCreateIssueModelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.createIssueModel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deletes an issue model. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The name of the issue model to delete. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.delete_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async - */ - deleteIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deleteIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deleteIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IDeleteIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deleteIssueModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deleteIssueModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.delete_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeleteIssueModel_async - */ - async checkDeleteIssueModelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deleteIssueModel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Deploys an issue model. Returns an error if a model is already deployed. - * An issue model can only be used in analysis after it has been deployed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The issue model to deploy. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.deploy_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async - */ - deployIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - deployIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deployIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - deployIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IDeployIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.deployIssueModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `deployIssueModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.deploy_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_DeployIssueModel_async - */ - async checkDeployIssueModelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.deployIssueModel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } -/** - * Undeploys an issue model. - * An issue model can not be used in analysis after it has been undeployed. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.name - * Required. The issue model to undeploy. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. - * @returns {Promise} - The promise which resolves to an array. - * The first element of the array is an object representing - * a long running operation. Its `promise()` method returns a promise - * you can `await` for. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.undeploy_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async - */ - undeployIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, - options?: CallOptions): - Promise<[ - LROperation, - protos.google.longrunning.IOperation|undefined, {}|undefined - ]>; - undeployIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, - options: CallOptions, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeployIssueModel( - request: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, - callback: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): void; - undeployIssueModel( - request?: protos.google.cloud.contactcenterinsights.v1.IUndeployIssueModelRequest, - optionsOrCallback?: CallOptions|Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>, - callback?: Callback< - LROperation, - protos.google.longrunning.IOperation|null|undefined, - {}|null|undefined>): - Promise<[ - LROperation, - 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' - ] = gax.routingHeader.fromParams({ - 'name': request.name || '', - }); - this.initialize(); - return this.innerApiCalls.undeployIssueModel(request, options, callback); - } -/** - * Check the status of the long running operation returned by `undeployIssueModel()`. - * @param {String} name - * The operation name that will be passed. - * @returns {Promise} - The promise which resolves to an object. - * The decoded operation object has result and metadata field to get information from. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#long-running-operations) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.undeploy_issue_model.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_UndeployIssueModel_async - */ - async checkUndeployIssueModelProgress(name: string): Promise>{ - const request = new operationsProtos.google.longrunning.GetOperationRequest({name}); - const [operation] = await this.operationsClient.getOperation(request); - const decodeOperation = new gax.Operation(operation, this.descriptors.longrunning.undeployIssueModel, gax.createDefaultBackoffSettings()); - return decodeOperation as LROperation; - } - /** - * Lists conversations. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the conversation. - * @param {number} request.pageSize - * The maximum number of conversations to return in the response. A valid page - * size ranges from 0 to 1,000 inclusive. If the page size is zero or - * unspecified, a default page size of 100 will be chosen. Note that a call - * might return fewer results than the requested page size. - * @param {string} request.pageToken - * The value returned by the last `ListConversationsResponse`. This value - * indicates that this is a continuation of a prior `ListConversations` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view - * The level of details of the conversation. Default is `BASIC`. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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.contactcenterinsights.v1.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.contactcenterinsights.v1.IListConversationsRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation[], - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest|null, - protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse - ]>; - listConversations( - request: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IConversation>): void; - listConversations( - request: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IConversation>): void; - listConversations( - request?: protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IConversation>, - callback?: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest, - protos.google.cloud.contactcenterinsights.v1.IListConversationsResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IConversation>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IConversation[], - protos.google.cloud.contactcenterinsights.v1.IListConversationsRequest|null, - protos.google.cloud.contactcenterinsights.v1.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' - ] = gax.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 parent resource of the conversation. - * @param {number} request.pageSize - * The maximum number of conversations to return in the response. A valid page - * size ranges from 0 to 1,000 inclusive. If the page size is zero or - * unspecified, a default page size of 100 will be chosen. Note that a call - * might return fewer results than the requested page size. - * @param {string} request.pageToken - * The value returned by the last `ListConversationsResponse`. This value - * indicates that this is a continuation of a prior `ListConversations` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view - * The level of details of the conversation. Default is `BASIC`. - * @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.contactcenterinsights.v1.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.contactcenterinsights.v1.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' - ] = gax.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 gax.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 parent resource of the conversation. - * @param {number} request.pageSize - * The maximum number of conversations to return in the response. A valid page - * size ranges from 0 to 1,000 inclusive. If the page size is zero or - * unspecified, a default page size of 100 will be chosen. Note that a call - * might return fewer results than the requested page size. - * @param {string} request.pageToken - * The value returned by the last `ListConversationsResponse`. This value - * indicates that this is a continuation of a prior `ListConversations` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @param {google.cloud.contactcenterinsights.v1.ConversationView} request.view - * The level of details of the conversation. Default is `BASIC`. - * @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.contactcenterinsights.v1.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/v1/contact_center_insights.list_conversations.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListConversations_async - */ - listConversationsAsync( - request?: protos.google.cloud.contactcenterinsights.v1.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' - ] = gax.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 unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists analyses. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the analyses. - * @param {number} request.pageSize - * The maximum number of analyses to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListAnalysesResponse`; indicates - * that this is a continuation of a prior `ListAnalyses` call and - * the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. - * 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 `listAnalysesAsync()` - * 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. - */ - listAnalyses( - request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IAnalysis[], - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest|null, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse - ]>; - listAnalyses( - request: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IAnalysis>): void; - listAnalyses( - request: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IAnalysis>): void; - listAnalyses( - request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IAnalysis>, - callback?: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IAnalysis>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IAnalysis[], - protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest|null, - protos.google.cloud.contactcenterinsights.v1.IListAnalysesResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listAnalyses(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 parent resource of the analyses. - * @param {number} request.pageSize - * The maximum number of analyses to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListAnalysesResponse`; indicates - * that this is a continuation of a prior `ListAnalyses` call and - * the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @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 [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis} 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 `listAnalysesAsync()` - * 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. - */ - listAnalysesStream( - request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAnalyses']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnalyses.createStream( - this.innerApiCalls.listAnalyses as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listAnalyses`, 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 parent resource of the analyses. - * @param {number} request.pageSize - * The maximum number of analyses to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListAnalysesResponse`; indicates - * that this is a continuation of a prior `ListAnalyses` call and - * the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * conversations with specific properties. - * @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 - * [Analysis]{@link google.cloud.contactcenterinsights.v1.Analysis}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.list_analyses.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListAnalyses_async - */ - listAnalysesAsync( - request?: protos.google.cloud.contactcenterinsights.v1.IListAnalysesRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listAnalyses']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listAnalyses.asyncIterate( - this.innerApiCalls['listAnalyses'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - /** - * Lists phrase matchers. - * - * @param {Object} request - * The request object that will be sent. - * @param {string} request.parent - * Required. The parent resource of the phrase matcher. - * @param {number} request.pageSize - * The maximum number of phrase matchers to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListPhraseMatchersResponse`. This value - * indicates that this is a continuation of a prior `ListPhraseMatchers` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * phrase matchers with specific properties. - * @param {object} [options] - * Call options. See {@link https://googleapis.dev/nodejs/google-gax/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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. - * 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 `listPhraseMatchersAsync()` - * 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. - */ - listPhraseMatchers( - request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - options?: CallOptions): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[], - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest|null, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse - ]>; - listPhraseMatchers( - request: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - options: CallOptions, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): void; - listPhraseMatchers( - request: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - callback: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): void; - listPhraseMatchers( - request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - optionsOrCallback?: CallOptions|PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>, - callback?: PaginationCallback< - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse|null|undefined, - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher>): - Promise<[ - protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[], - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest|null, - protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersResponse - ]>|void { - request = request || {}; - let options: CallOptions; - if (typeof 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' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - this.initialize(); - return this.innerApiCalls.listPhraseMatchers(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 parent resource of the phrase matcher. - * @param {number} request.pageSize - * The maximum number of phrase matchers to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListPhraseMatchersResponse`. This value - * indicates that this is a continuation of a prior `ListPhraseMatchers` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * phrase matchers with specific properties. - * @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 [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher} 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 `listPhraseMatchersAsync()` - * 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. - */ - listPhraseMatchersStream( - request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - options?: CallOptions): - Transform{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listPhraseMatchers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPhraseMatchers.createStream( - this.innerApiCalls.listPhraseMatchers as gax.GaxCall, - request, - callSettings - ); - } - -/** - * Equivalent to `listPhraseMatchers`, 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 parent resource of the phrase matcher. - * @param {number} request.pageSize - * The maximum number of phrase matchers to return in the response. If this - * value is zero, the service will select a default size. A call might return - * fewer objects than requested. A non-empty `next_page_token` in the response - * indicates that more data is available. - * @param {string} request.pageToken - * The value returned by the last `ListPhraseMatchersResponse`. This value - * indicates that this is a continuation of a prior `ListPhraseMatchers` call - * and that the system should return the next page of data. - * @param {string} request.filter - * A filter to reduce results to a specific subset. Useful for querying - * phrase matchers with specific properties. - * @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 - * [PhraseMatcher]{@link google.cloud.contactcenterinsights.v1.PhraseMatcher}. The API will be called under the hood as needed, once per the page, - * so you can stop the iteration when you don't need more results. - * Please see the - * [documentation](https://github.com/googleapis/gax-nodejs/blob/master/client-libraries.md#auto-pagination) - * for more details and examples. - * @example include:samples/generated/v1/contact_center_insights.list_phrase_matchers.js - * region_tag:contactcenterinsights_v1_generated_ContactCenterInsights_ListPhraseMatchers_async - */ - listPhraseMatchersAsync( - request?: protos.google.cloud.contactcenterinsights.v1.IListPhraseMatchersRequest, - options?: CallOptions): - AsyncIterable{ - request = request || {}; - options = options || {}; - options.otherArgs = options.otherArgs || {}; - options.otherArgs.headers = options.otherArgs.headers || {}; - options.otherArgs.headers[ - 'x-goog-request-params' - ] = gax.routingHeader.fromParams({ - 'parent': request.parent || '', - }); - const defaultCallSettings = this._defaults['listPhraseMatchers']; - const callSettings = defaultCallSettings.merge(options); - this.initialize(); - return this.descriptors.page.listPhraseMatchers.asyncIterate( - this.innerApiCalls['listPhraseMatchers'] as GaxCall, - request as unknown as RequestType, - callSettings - ) as AsyncIterable; - } - // -------------------- - // -- Path templates -- - // -------------------- - - /** - * Return a fully-qualified analysis resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @param {string} analysis - * @returns {string} Resource name string. - */ - analysisPath(project:string,location:string,conversation:string,analysis:string) { - return this.pathTemplates.analysisPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - analysis: analysis, - }); - } - - /** - * Parse the project from Analysis resource. - * - * @param {string} analysisName - * A fully-qualified path representing Analysis resource. - * @returns {string} A string representing the project. - */ - matchProjectFromAnalysisName(analysisName: string) { - return this.pathTemplates.analysisPathTemplate.match(analysisName).project; - } - - /** - * Parse the location from Analysis resource. - * - * @param {string} analysisName - * A fully-qualified path representing Analysis resource. - * @returns {string} A string representing the location. - */ - matchLocationFromAnalysisName(analysisName: string) { - return this.pathTemplates.analysisPathTemplate.match(analysisName).location; - } - - /** - * Parse the conversation from Analysis resource. - * - * @param {string} analysisName - * A fully-qualified path representing Analysis resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromAnalysisName(analysisName: string) { - return this.pathTemplates.analysisPathTemplate.match(analysisName).conversation; - } - - /** - * Parse the analysis from Analysis resource. - * - * @param {string} analysisName - * A fully-qualified path representing Analysis resource. - * @returns {string} A string representing the analysis. - */ - matchAnalysisFromAnalysisName(analysisName: string) { - return this.pathTemplates.analysisPathTemplate.match(analysisName).analysis; - } - - /** - * Return a fully-qualified conversation resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} conversation - * @returns {string} Resource name string. - */ - conversationPath(project:string,location:string,conversation:string) { - return this.pathTemplates.conversationPathTemplate.render({ - project: project, - location: location, - conversation: conversation, - }); - } - - /** - * Parse the project from Conversation resource. - * - * @param {string} conversationName - * A fully-qualified path representing Conversation resource. - * @returns {string} A string representing the project. - */ - matchProjectFromConversationName(conversationName: string) { - return this.pathTemplates.conversationPathTemplate.match(conversationName).project; - } - - /** - * Parse the location from Conversation resource. - * - * @param {string} conversationName - * A fully-qualified path representing Conversation resource. - * @returns {string} A string representing the location. - */ - matchLocationFromConversationName(conversationName: string) { - return this.pathTemplates.conversationPathTemplate.match(conversationName).location; - } - - /** - * Parse the conversation from Conversation resource. - * - * @param {string} conversationName - * A fully-qualified path representing Conversation resource. - * @returns {string} A string representing the conversation. - */ - matchConversationFromConversationName(conversationName: string) { - return this.pathTemplates.conversationPathTemplate.match(conversationName).conversation; - } - - /** - * Return a fully-qualified issue resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} issue_model - * @param {string} issue - * @returns {string} Resource name string. - */ - issuePath(project:string,location:string,issueModel:string,issue:string) { - return this.pathTemplates.issuePathTemplate.render({ - project: project, - location: location, - issue_model: issueModel, - issue: issue, - }); - } - - /** - * Parse the project from Issue resource. - * - * @param {string} issueName - * A fully-qualified path representing Issue resource. - * @returns {string} A string representing the project. - */ - matchProjectFromIssueName(issueName: string) { - return this.pathTemplates.issuePathTemplate.match(issueName).project; - } - - /** - * Parse the location from Issue resource. - * - * @param {string} issueName - * A fully-qualified path representing Issue resource. - * @returns {string} A string representing the location. - */ - matchLocationFromIssueName(issueName: string) { - return this.pathTemplates.issuePathTemplate.match(issueName).location; - } - - /** - * Parse the issue_model from Issue resource. - * - * @param {string} issueName - * A fully-qualified path representing Issue resource. - * @returns {string} A string representing the issue_model. - */ - matchIssueModelFromIssueName(issueName: string) { - return this.pathTemplates.issuePathTemplate.match(issueName).issue_model; - } - - /** - * Parse the issue from Issue resource. - * - * @param {string} issueName - * A fully-qualified path representing Issue resource. - * @returns {string} A string representing the issue. - */ - matchIssueFromIssueName(issueName: string) { - return this.pathTemplates.issuePathTemplate.match(issueName).issue; - } - - /** - * Return a fully-qualified issueModel resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} issue_model - * @returns {string} Resource name string. - */ - issueModelPath(project:string,location:string,issueModel:string) { - return this.pathTemplates.issueModelPathTemplate.render({ - project: project, - location: location, - issue_model: issueModel, - }); - } - - /** - * Parse the project from IssueModel resource. - * - * @param {string} issueModelName - * A fully-qualified path representing IssueModel resource. - * @returns {string} A string representing the project. - */ - matchProjectFromIssueModelName(issueModelName: string) { - return this.pathTemplates.issueModelPathTemplate.match(issueModelName).project; - } - - /** - * Parse the location from IssueModel resource. - * - * @param {string} issueModelName - * A fully-qualified path representing IssueModel resource. - * @returns {string} A string representing the location. - */ - matchLocationFromIssueModelName(issueModelName: string) { - return this.pathTemplates.issueModelPathTemplate.match(issueModelName).location; - } - - /** - * Parse the issue_model from IssueModel resource. - * - * @param {string} issueModelName - * A fully-qualified path representing IssueModel resource. - * @returns {string} A string representing the issue_model. - */ - matchIssueModelFromIssueModelName(issueModelName: string) { - return this.pathTemplates.issueModelPathTemplate.match(issueModelName).issue_model; - } - - /** - * 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 phraseMatcher resource name string. - * - * @param {string} project - * @param {string} location - * @param {string} phrase_matcher - * @returns {string} Resource name string. - */ - phraseMatcherPath(project:string,location:string,phraseMatcher:string) { - return this.pathTemplates.phraseMatcherPathTemplate.render({ - project: project, - location: location, - phrase_matcher: phraseMatcher, - }); - } - - /** - * Parse the project from PhraseMatcher resource. - * - * @param {string} phraseMatcherName - * A fully-qualified path representing PhraseMatcher resource. - * @returns {string} A string representing the project. - */ - matchProjectFromPhraseMatcherName(phraseMatcherName: string) { - return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).project; - } - - /** - * Parse the location from PhraseMatcher resource. - * - * @param {string} phraseMatcherName - * A fully-qualified path representing PhraseMatcher resource. - * @returns {string} A string representing the location. - */ - matchLocationFromPhraseMatcherName(phraseMatcherName: string) { - return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).location; - } - - /** - * Parse the phrase_matcher from PhraseMatcher resource. - * - * @param {string} phraseMatcherName - * A fully-qualified path representing PhraseMatcher resource. - * @returns {string} A string representing the phrase_matcher. - */ - matchPhraseMatcherFromPhraseMatcherName(phraseMatcherName: string) { - return this.pathTemplates.phraseMatcherPathTemplate.match(phraseMatcherName).phrase_matcher; - } - - /** - * Return a fully-qualified settings resource name string. - * - * @param {string} project - * @param {string} location - * @returns {string} Resource name string. - */ - settingsPath(project:string,location:string) { - return this.pathTemplates.settingsPathTemplate.render({ - project: project, - location: location, - }); - } - - /** - * Parse the project from Settings resource. - * - * @param {string} settingsName - * A fully-qualified path representing Settings resource. - * @returns {string} A string representing the project. - */ - matchProjectFromSettingsName(settingsName: string) { - return this.pathTemplates.settingsPathTemplate.match(settingsName).project; - } - - /** - * Parse the location from Settings resource. - * - * @param {string} settingsName - * A fully-qualified path representing Settings resource. - * @returns {string} A string representing the location. - */ - matchLocationFromSettingsName(settingsName: string) { - return this.pathTemplates.settingsPathTemplate.match(settingsName).location; - } - - /** - * 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 { - this.initialize(); - if (!this._terminated) { - return this.contactCenterInsightsStub!.then(stub => { - this._terminated = true; - stub.close(); - this.operationsClient.close(); - }); - } - return Promise.resolve(); - } -} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json b/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json deleted file mode 100644 index 1c9d282..0000000 --- a/owl-bot-staging/v1/src/v1/contact_center_insights_client_config.json +++ /dev/null @@ -1,183 +0,0 @@ -{ - "interfaces": { - "google.cloud.contactcenterinsights.v1.ContactCenterInsights": { - "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 - }, - "ce5b960a6ed052e690863808e4f0deff3dc7d49f": { - "initial_retry_delay_millis": 1000, - "retry_delay_multiplier": 1.3, - "max_retry_delay_millis": 10000, - "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": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListConversations": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteConversation": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateAnalysis": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetAnalysis": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListAnalyses": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteAnalysis": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ExportInsightsData": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreateIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListIssueModels": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeleteIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeployIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UndeployIssueModel": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetIssue": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListIssues": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateIssue": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CalculateIssueModelStats": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CreatePhraseMatcher": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetPhraseMatcher": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "ListPhraseMatchers": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "DeletePhraseMatcher": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdatePhraseMatcher": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "CalculateStats": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "GetSettings": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - }, - "UpdateSettings": { - "timeout_millis": 60000, - "retry_codes_name": "unavailable", - "retry_params_name": "ce5b960a6ed052e690863808e4f0deff3dc7d49f" - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json b/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json deleted file mode 100644 index a3a2efb..0000000 --- a/owl-bot-staging/v1/src/v1/contact_center_insights_proto_list.json +++ /dev/null @@ -1,4 +0,0 @@ -[ - "../../protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto", - "../../protos/google/cloud/contactcenterinsights/v1/resources.proto" -] diff --git a/owl-bot-staging/v1/src/v1/gapic_metadata.json b/owl-bot-staging/v1/src/v1/gapic_metadata.json deleted file mode 100644 index a2b4ec4..0000000 --- a/owl-bot-staging/v1/src/v1/gapic_metadata.json +++ /dev/null @@ -1,325 +0,0 @@ -{ - "schema": "1.0", - "comment": "This file maps proto services/RPCs to the corresponding library clients/methods", - "language": "typescript", - "protoPackage": "google.cloud.contactcenterinsights.v1", - "libraryPackage": "@google-cloud/contact-center-insights", - "services": { - "ContactCenterInsights": { - "clients": { - "grpc": { - "libraryClient": "ContactCenterInsightsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "UpdateConversation": { - "methods": [ - "updateConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "DeleteConversation": { - "methods": [ - "deleteConversation" - ] - }, - "GetAnalysis": { - "methods": [ - "getAnalysis" - ] - }, - "DeleteAnalysis": { - "methods": [ - "deleteAnalysis" - ] - }, - "UpdateIssueModel": { - "methods": [ - "updateIssueModel" - ] - }, - "GetIssueModel": { - "methods": [ - "getIssueModel" - ] - }, - "ListIssueModels": { - "methods": [ - "listIssueModels" - ] - }, - "GetIssue": { - "methods": [ - "getIssue" - ] - }, - "ListIssues": { - "methods": [ - "listIssues" - ] - }, - "UpdateIssue": { - "methods": [ - "updateIssue" - ] - }, - "CalculateIssueModelStats": { - "methods": [ - "calculateIssueModelStats" - ] - }, - "CreatePhraseMatcher": { - "methods": [ - "createPhraseMatcher" - ] - }, - "GetPhraseMatcher": { - "methods": [ - "getPhraseMatcher" - ] - }, - "DeletePhraseMatcher": { - "methods": [ - "deletePhraseMatcher" - ] - }, - "UpdatePhraseMatcher": { - "methods": [ - "updatePhraseMatcher" - ] - }, - "CalculateStats": { - "methods": [ - "calculateStats" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateAnalysis": { - "methods": [ - "createAnalysis" - ] - }, - "ExportInsightsData": { - "methods": [ - "exportInsightsData" - ] - }, - "CreateIssueModel": { - "methods": [ - "createIssueModel" - ] - }, - "DeleteIssueModel": { - "methods": [ - "deleteIssueModel" - ] - }, - "DeployIssueModel": { - "methods": [ - "deployIssueModel" - ] - }, - "UndeployIssueModel": { - "methods": [ - "undeployIssueModel" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListAnalyses": { - "methods": [ - "listAnalyses", - "listAnalysesStream", - "listAnalysesAsync" - ] - }, - "ListPhraseMatchers": { - "methods": [ - "listPhraseMatchers", - "listPhraseMatchersStream", - "listPhraseMatchersAsync" - ] - } - } - }, - "grpc-fallback": { - "libraryClient": "ContactCenterInsightsClient", - "rpcs": { - "CreateConversation": { - "methods": [ - "createConversation" - ] - }, - "UpdateConversation": { - "methods": [ - "updateConversation" - ] - }, - "GetConversation": { - "methods": [ - "getConversation" - ] - }, - "DeleteConversation": { - "methods": [ - "deleteConversation" - ] - }, - "GetAnalysis": { - "methods": [ - "getAnalysis" - ] - }, - "DeleteAnalysis": { - "methods": [ - "deleteAnalysis" - ] - }, - "UpdateIssueModel": { - "methods": [ - "updateIssueModel" - ] - }, - "GetIssueModel": { - "methods": [ - "getIssueModel" - ] - }, - "ListIssueModels": { - "methods": [ - "listIssueModels" - ] - }, - "GetIssue": { - "methods": [ - "getIssue" - ] - }, - "ListIssues": { - "methods": [ - "listIssues" - ] - }, - "UpdateIssue": { - "methods": [ - "updateIssue" - ] - }, - "CalculateIssueModelStats": { - "methods": [ - "calculateIssueModelStats" - ] - }, - "CreatePhraseMatcher": { - "methods": [ - "createPhraseMatcher" - ] - }, - "GetPhraseMatcher": { - "methods": [ - "getPhraseMatcher" - ] - }, - "DeletePhraseMatcher": { - "methods": [ - "deletePhraseMatcher" - ] - }, - "UpdatePhraseMatcher": { - "methods": [ - "updatePhraseMatcher" - ] - }, - "CalculateStats": { - "methods": [ - "calculateStats" - ] - }, - "GetSettings": { - "methods": [ - "getSettings" - ] - }, - "UpdateSettings": { - "methods": [ - "updateSettings" - ] - }, - "CreateAnalysis": { - "methods": [ - "createAnalysis" - ] - }, - "ExportInsightsData": { - "methods": [ - "exportInsightsData" - ] - }, - "CreateIssueModel": { - "methods": [ - "createIssueModel" - ] - }, - "DeleteIssueModel": { - "methods": [ - "deleteIssueModel" - ] - }, - "DeployIssueModel": { - "methods": [ - "deployIssueModel" - ] - }, - "UndeployIssueModel": { - "methods": [ - "undeployIssueModel" - ] - }, - "ListConversations": { - "methods": [ - "listConversations", - "listConversationsStream", - "listConversationsAsync" - ] - }, - "ListAnalyses": { - "methods": [ - "listAnalyses", - "listAnalysesStream", - "listAnalysesAsync" - ] - }, - "ListPhraseMatchers": { - "methods": [ - "listPhraseMatchers", - "listPhraseMatchersStream", - "listPhraseMatchersAsync" - ] - } - } - } - } - } - } -} diff --git a/owl-bot-staging/v1/src/v1/index.ts b/owl-bot-staging/v1/src/v1/index.ts deleted file mode 100644 index a5c34c3..0000000 --- a/owl-bot-staging/v1/src/v1/index.ts +++ /dev/null @@ -1,19 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {ContactCenterInsightsClient} from './contact_center_insights_client'; diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js deleted file mode 100644 index 3d35f02..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.js +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 contactcenterinsights = require('@google-cloud/contact-center-insights'); - -function main() { - const contactCenterInsightsClient = new contactcenterinsights.ContactCenterInsightsClient(); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts b/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts deleted file mode 100644 index 6945bae..0000000 --- a/owl-bot-staging/v1/system-test/fixtures/sample/src/index.ts +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 {ContactCenterInsightsClient} from '@google-cloud/contact-center-insights'; - -// check that the client class type name can be used -function doStuffWithContactCenterInsightsClient(client: ContactCenterInsightsClient) { - client.close(); -} - -function main() { - // check that the client instance can be created - const contactCenterInsightsClient = new ContactCenterInsightsClient(); - doStuffWithContactCenterInsightsClient(contactCenterInsightsClient); -} - -main(); diff --git a/owl-bot-staging/v1/system-test/install.ts b/owl-bot-staging/v1/system-test/install.ts deleted file mode 100644 index 1f850b5..0000000 --- a/owl-bot-staging/v1/system-test/install.ts +++ /dev/null @@ -1,49 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts b/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts deleted file mode 100644 index edf8569..0000000 --- a/owl-bot-staging/v1/test/gapic_contact_center_insights_v1.ts +++ /dev/null @@ -1,3736 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. -// -// ** 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 contactcenterinsightsModule from '../src'; - -import {PassThrough} from 'stream'; - -import {protobuf, LROperation, operationsProtos} from 'google-gax'; - -function generateSampleMessage(instance: T) { - const filledObject = (instance.constructor as typeof protobuf.Message) - .toObject(instance as protobuf.Message, {defaults: true}); - return (instance.constructor as typeof protobuf.Message).fromObject(filledObject) as T; -} - -function stubSimpleCall(response?: ResponseType, error?: Error) { - return error ? sinon.stub().rejects(error) : sinon.stub().resolves([response]); -} - -function stubSimpleCallWithCallback(response?: ResponseType, error?: Error) { - return error ? sinon.stub().callsArgWith(2, error) : sinon.stub().callsArgWith(2, null, response); -} - -function stubLongRunningCall(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().rejects(callError) : sinon.stub().resolves([mockOperation]); -} - -function stubLongRunningCallWithCallback(response?: ResponseType, callError?: Error, lroError?: Error) { - const innerStub = lroError ? sinon.stub().rejects(lroError) : sinon.stub().resolves([response]); - const mockOperation = { - promise: innerStub, - }; - return callError ? sinon.stub().callsArgWith(2, callError) : sinon.stub().callsArgWith(2, null, mockOperation); -} - -function stubPageStreamingCall(responses?: ResponseType[], error?: Error) { - const pagingStub = sinon.stub(); - if (responses) { - for (let i = 0; i < responses.length; ++i) { - pagingStub.onCall(i).callsArgWith(2, null, responses[i]); - } - } - const transformStub = error ? sinon.stub().callsArgWith(2, error) : pagingStub; - const mockStream = new PassThrough({ - objectMode: true, - transform: transformStub, - }); - // trigger as many responses as needed - if (responses) { - for (let i = 0; i < responses.length; ++i) { - setImmediate(() => { mockStream.write({}); }); - } - setImmediate(() => { mockStream.end(); }); - } else { - setImmediate(() => { mockStream.write({}); }); - setImmediate(() => { mockStream.end(); }); - } - return sinon.stub().returns(mockStream); -} - -function stubAsyncIterationCall(responses?: ResponseType[], error?: Error) { - let counter = 0; - const asyncIterable = { - [Symbol.asyncIterator]() { - return { - async next() { - if (error) { - return Promise.reject(error); - } - if (counter >= responses!.length) { - return Promise.resolve({done: true, value: undefined}); - } - return Promise.resolve({done: false, value: responses![counter++]}); - } - }; - } - }; - return sinon.stub().returns(asyncIterable); -} - -describe('v1.ContactCenterInsightsClient', () => { - it('has servicePath', () => { - const servicePath = contactcenterinsightsModule.v1.ContactCenterInsightsClient.servicePath; - assert(servicePath); - }); - - it('has apiEndpoint', () => { - const apiEndpoint = contactcenterinsightsModule.v1.ContactCenterInsightsClient.apiEndpoint; - assert(apiEndpoint); - }); - - it('has port', () => { - const port = contactcenterinsightsModule.v1.ContactCenterInsightsClient.port; - assert(port); - assert(typeof port === 'number'); - }); - - it('should create a client with no option', () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient(); - assert(client); - }); - - it('should create a client with gRPC fallback', () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - fallback: true, - }); - assert(client); - }); - - it('has initialize method and supports deferred initialization', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - assert.strictEqual(client.contactCenterInsightsStub, undefined); - await client.initialize(); - assert(client.contactCenterInsightsStub); - }); - - it('has close method', () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.close(); - }); - - it('has getProjectId method', async () => { - const fakeProjectId = 'fake-project-id'; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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 contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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 contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCall(expectedResponse); - const [response] = await client.createConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createConversation without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.createConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createConversation( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createConversation with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateConversationRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createConversation(request), expectedError); - assert((client.innerApiCalls.createConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateConversation', () => { - it('invokes updateConversation without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); - request.conversation = {}; - request.conversation.name = ''; - const expectedHeaderRequestParams = "conversation.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.updateConversation = stubSimpleCall(expectedResponse); - const [response] = await client.updateConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateConversation without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); - request.conversation = {}; - request.conversation.name = ''; - const expectedHeaderRequestParams = "conversation.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.updateConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateConversation( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateConversation with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateConversationRequest()); - request.conversation = {}; - request.conversation.name = ''; - const expectedHeaderRequestParams = "conversation.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateConversation(request), expectedError); - assert((client.innerApiCalls.updateConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getConversation', () => { - it('invokes getConversation without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCall(expectedResponse); - const [response] = await client.getConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getConversation without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()); - client.innerApiCalls.getConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getConversation( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getConversation with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getConversation(request), expectedError); - assert((client.innerApiCalls.getConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteConversation', () => { - it('invokes deleteConversation without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversation = stubSimpleCall(expectedResponse); - const [response] = await client.deleteConversation(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteConversation without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteConversation = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteConversation( - 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); - assert((client.innerApiCalls.deleteConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteConversation with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteConversationRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteConversation = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteConversation(request), expectedError); - assert((client.innerApiCalls.deleteConversation as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getAnalysis', () => { - it('invokes getAnalysis without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()); - client.innerApiCalls.getAnalysis = stubSimpleCall(expectedResponse); - const [response] = await client.getAnalysis(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getAnalysis without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()); - client.innerApiCalls.getAnalysis = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getAnalysis( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IAnalysis|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getAnalysis with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getAnalysis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getAnalysis(request), expectedError); - assert((client.innerApiCalls.getAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deleteAnalysis', () => { - it('invokes deleteAnalysis without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAnalysis = stubSimpleCall(expectedResponse); - const [response] = await client.deleteAnalysis(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteAnalysis without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deleteAnalysis = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteAnalysis( - 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); - assert((client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteAnalysis with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteAnalysisRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteAnalysis = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deleteAnalysis(request), expectedError); - assert((client.innerApiCalls.deleteAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateIssueModel', () => { - it('invokes updateIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); - request.issueModel = {}; - request.issueModel.name = ''; - const expectedHeaderRequestParams = "issue_model.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); - client.innerApiCalls.updateIssueModel = stubSimpleCall(expectedResponse); - const [response] = await client.updateIssueModel(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); - request.issueModel = {}; - request.issueModel.name = ''; - const expectedHeaderRequestParams = "issue_model.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); - client.innerApiCalls.updateIssueModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIssueModel( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssueModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateIssueModel with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueModelRequest()); - request.issueModel = {}; - request.issueModel.name = ''; - const expectedHeaderRequestParams = "issue_model.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIssueModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIssueModel(request), expectedError); - assert((client.innerApiCalls.updateIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getIssueModel', () => { - it('invokes getIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); - client.innerApiCalls.getIssueModel = stubSimpleCall(expectedResponse); - const [response] = await client.getIssueModel(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.IssueModel()); - client.innerApiCalls.getIssueModel = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIssueModel( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssueModel|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIssueModel with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIssueModel = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIssueModel(request), expectedError); - assert((client.innerApiCalls.getIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listIssueModels', () => { - it('invokes listIssueModels without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse()); - client.innerApiCalls.listIssueModels = stubSimpleCall(expectedResponse); - const [response] = await client.listIssueModels(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIssueModels as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIssueModels without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsResponse()); - client.innerApiCalls.listIssueModels = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIssueModels( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IListIssueModelsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIssueModels as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listIssueModels with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssueModelsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listIssueModels = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIssueModels(request), expectedError); - assert((client.innerApiCalls.listIssueModels as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getIssue', () => { - it('invokes getIssue without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); - client.innerApiCalls.getIssue = stubSimpleCall(expectedResponse); - const [response] = await client.getIssue(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getIssue without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); - client.innerApiCalls.getIssue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getIssue( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getIssue with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetIssueRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getIssue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getIssue(request), expectedError); - assert((client.innerApiCalls.getIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('listIssues', () => { - it('invokes listIssues without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesResponse()); - client.innerApiCalls.listIssues = stubSimpleCall(expectedResponse); - const [response] = await client.listIssues(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIssues as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listIssues without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesResponse()); - client.innerApiCalls.listIssues = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listIssues( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IListIssuesResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listIssues as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listIssues with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListIssuesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listIssues = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listIssues(request), expectedError); - assert((client.innerApiCalls.listIssues as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateIssue', () => { - it('invokes updateIssue without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); - request.issue = {}; - request.issue.name = ''; - const expectedHeaderRequestParams = "issue.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); - client.innerApiCalls.updateIssue = stubSimpleCall(expectedResponse); - const [response] = await client.updateIssue(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateIssue without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); - request.issue = {}; - request.issue.name = ''; - const expectedHeaderRequestParams = "issue.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Issue()); - client.innerApiCalls.updateIssue = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateIssue( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IIssue|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateIssue with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateIssueRequest()); - request.issue = {}; - request.issue.name = ''; - const expectedHeaderRequestParams = "issue.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateIssue = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateIssue(request), expectedError); - assert((client.innerApiCalls.updateIssue as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('calculateIssueModelStats', () => { - it('invokes calculateIssueModelStats without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); - request.issueModel = ''; - const expectedHeaderRequestParams = "issue_model="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse()); - client.innerApiCalls.calculateIssueModelStats = stubSimpleCall(expectedResponse); - const [response] = await client.calculateIssueModelStats(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes calculateIssueModelStats without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); - request.issueModel = ''; - const expectedHeaderRequestParams = "issue_model="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsResponse()); - client.innerApiCalls.calculateIssueModelStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.calculateIssueModelStats( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ICalculateIssueModelStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes calculateIssueModelStats with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateIssueModelStatsRequest()); - request.issueModel = ''; - const expectedHeaderRequestParams = "issue_model="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.calculateIssueModelStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.calculateIssueModelStats(request), expectedError); - assert((client.innerApiCalls.calculateIssueModelStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createPhraseMatcher', () => { - it('invokes createPhraseMatcher without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.createPhraseMatcher = stubSimpleCall(expectedResponse); - const [response] = await client.createPhraseMatcher(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createPhraseMatcher without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.createPhraseMatcher = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createPhraseMatcher( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createPhraseMatcher with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreatePhraseMatcherRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createPhraseMatcher = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.createPhraseMatcher(request), expectedError); - assert((client.innerApiCalls.createPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getPhraseMatcher', () => { - it('invokes getPhraseMatcher without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.getPhraseMatcher = stubSimpleCall(expectedResponse); - const [response] = await client.getPhraseMatcher(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getPhraseMatcher without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.getPhraseMatcher = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getPhraseMatcher( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getPhraseMatcher with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetPhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getPhraseMatcher = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getPhraseMatcher(request), expectedError); - assert((client.innerApiCalls.getPhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('deletePhraseMatcher', () => { - it('invokes deletePhraseMatcher without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deletePhraseMatcher = stubSimpleCall(expectedResponse); - const [response] = await client.deletePhraseMatcher(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deletePhraseMatcher without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.protobuf.Empty()); - client.innerApiCalls.deletePhraseMatcher = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deletePhraseMatcher( - 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); - assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deletePhraseMatcher with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeletePhraseMatcherRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deletePhraseMatcher = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.deletePhraseMatcher(request), expectedError); - assert((client.innerApiCalls.deletePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updatePhraseMatcher', () => { - it('invokes updatePhraseMatcher without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); - request.phraseMatcher = {}; - request.phraseMatcher.name = ''; - const expectedHeaderRequestParams = "phrase_matcher.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.updatePhraseMatcher = stubSimpleCall(expectedResponse); - const [response] = await client.updatePhraseMatcher(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updatePhraseMatcher without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); - request.phraseMatcher = {}; - request.phraseMatcher.name = ''; - const expectedHeaderRequestParams = "phrase_matcher.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()); - client.innerApiCalls.updatePhraseMatcher = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updatePhraseMatcher( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updatePhraseMatcher with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdatePhraseMatcherRequest()); - request.phraseMatcher = {}; - request.phraseMatcher.name = ''; - const expectedHeaderRequestParams = "phrase_matcher.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updatePhraseMatcher = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updatePhraseMatcher(request), expectedError); - assert((client.innerApiCalls.updatePhraseMatcher as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('calculateStats', () => { - it('invokes calculateStats without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsResponse()); - client.innerApiCalls.calculateStats = stubSimpleCall(expectedResponse); - const [response] = await client.calculateStats(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.calculateStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes calculateStats without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsResponse()); - client.innerApiCalls.calculateStats = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.calculateStats( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ICalculateStatsResponse|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.calculateStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes calculateStats with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CalculateStatsRequest()); - request.location = ''; - const expectedHeaderRequestParams = "location="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.calculateStats = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.calculateStats(request), expectedError); - assert((client.innerApiCalls.calculateStats as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('getSettings', () => { - it('invokes getSettings without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); - client.innerApiCalls.getSettings = stubSimpleCall(expectedResponse); - const [response] = await client.getSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes getSettings without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); - client.innerApiCalls.getSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.getSettings( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.getSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes getSettings with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.GetSettingsRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.getSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.getSettings(request), expectedError); - assert((client.innerApiCalls.getSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('updateSettings', () => { - it('invokes updateSettings without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); - request.settings = {}; - request.settings.name = ''; - const expectedHeaderRequestParams = "settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); - client.innerApiCalls.updateSettings = stubSimpleCall(expectedResponse); - const [response] = await client.updateSettings(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes updateSettings without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); - request.settings = {}; - request.settings.name = ''; - const expectedHeaderRequestParams = "settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Settings()); - client.innerApiCalls.updateSettings = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.updateSettings( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.ISettings|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes updateSettings with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UpdateSettingsRequest()); - request.settings = {}; - request.settings.name = ''; - const expectedHeaderRequestParams = "settings.name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.updateSettings = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.updateSettings(request), expectedError); - assert((client.innerApiCalls.updateSettings as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - }); - - describe('createAnalysis', () => { - it('invokes createAnalysis without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createAnalysis = stubLongRunningCall(expectedResponse); - const [operation] = await client.createAnalysis(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAnalysis without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createAnalysis = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createAnalysis( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createAnalysis with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createAnalysis(request), expectedError); - assert((client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createAnalysis with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateAnalysisRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createAnalysis = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createAnalysis(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createAnalysis as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateAnalysisProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkCreateAnalysisProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateAnalysisProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkCreateAnalysisProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('exportInsightsData', () => { - it('invokes exportInsightsData without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportInsightsData = stubLongRunningCall(expectedResponse); - const [operation] = await client.exportInsightsData(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportInsightsData as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportInsightsData without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.exportInsightsData = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.exportInsightsData( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.exportInsightsData as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes exportInsightsData with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInsightsData = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.exportInsightsData(request), expectedError); - assert((client.innerApiCalls.exportInsightsData as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes exportInsightsData with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.exportInsightsData = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.exportInsightsData(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.exportInsightsData as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkExportInsightsDataProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkExportInsightsDataProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkExportInsightsDataProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkExportInsightsDataProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('createIssueModel', () => { - it('invokes createIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createIssueModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.createIssueModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.createIssueModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.createIssueModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.createIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes createIssueModel with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createIssueModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.createIssueModel(request), expectedError); - assert((client.innerApiCalls.createIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes createIssueModel with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.CreateIssueModelRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.createIssueModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.createIssueModel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.createIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkCreateIssueModelProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkCreateIssueModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkCreateIssueModelProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkCreateIssueModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deleteIssueModel', () => { - it('invokes deleteIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteIssueModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deleteIssueModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deleteIssueModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deleteIssueModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deleteIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deleteIssueModel with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIssueModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deleteIssueModel(request), expectedError); - assert((client.innerApiCalls.deleteIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deleteIssueModel with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeleteIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deleteIssueModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deleteIssueModel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deleteIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeleteIssueModelProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkDeleteIssueModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeleteIssueModelProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkDeleteIssueModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('deployIssueModel', () => { - it('invokes deployIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deployIssueModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.deployIssueModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deployIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.deployIssueModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.deployIssueModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.deployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes deployIssueModel with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deployIssueModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.deployIssueModel(request), expectedError); - assert((client.innerApiCalls.deployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes deployIssueModel with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.DeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.deployIssueModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.deployIssueModel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.deployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkDeployIssueModelProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkDeployIssueModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkDeployIssueModelProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkDeployIssueModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('undeployIssueModel', () => { - it('invokes undeployIssueModel without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.undeployIssueModel = stubLongRunningCall(expectedResponse); - const [operation] = await client.undeployIssueModel(request); - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.undeployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes undeployIssueModel without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = generateSampleMessage(new protos.google.longrunning.Operation()); - client.innerApiCalls.undeployIssueModel = stubLongRunningCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.undeployIssueModel( - request, - (err?: Error|null, - result?: LROperation|null - ) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const operation = await promise as LROperation; - const [response] = await operation.promise(); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.undeployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes undeployIssueModel with call error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployIssueModel = stubLongRunningCall(undefined, expectedError); - await assert.rejects(client.undeployIssueModel(request), expectedError); - assert((client.innerApiCalls.undeployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes undeployIssueModel with LRO error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.UndeployIssueModelRequest()); - request.name = ''; - const expectedHeaderRequestParams = "name="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.undeployIssueModel = stubLongRunningCall(undefined, undefined, expectedError); - const [operation] = await client.undeployIssueModel(request); - await assert.rejects(operation.promise(), expectedError); - assert((client.innerApiCalls.undeployIssueModel as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes checkUndeployIssueModelProgress without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkUndeployIssueModelProgress(expectedResponse.name); - assert.deepStrictEqual(decodedOperation.name, expectedResponse.name); - assert(decodedOperation.metadata); - assert((client.operationsClient.getOperation as SinonStub).getCall(0)); - }); - - it('invokes checkUndeployIssueModelProgress with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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.checkUndeployIssueModelProgress(''), expectedError); - assert((client.operationsClient.getOperation as SinonStub) - .getCall(0)); - }); - }); - - describe('listConversations', () => { - it('invokes listConversations without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCall(expectedResponse); - const [response] = await client.listConversations(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversations without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - ]; - client.innerApiCalls.listConversations = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listConversations( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IConversation[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listConversations with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listConversations = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listConversations(request), expectedError); - assert((client.innerApiCalls.listConversations as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listConversationsStream without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - ]; - client.descriptors.page.listConversations.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listConversationsStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.contactcenterinsights.v1.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listConversationsStream with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - 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.contactcenterinsights.v1.Conversation[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( - (client.descriptors.page.listConversations.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Conversation()), - ]; - client.descriptors.page.listConversations.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.contactcenterinsights.v1.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.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listConversations with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListConversationsRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";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.contactcenterinsights.v1.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.strictEqual( - (client.descriptors.page.listConversations.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listAnalyses', () => { - it('invokes listAnalyses without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - ]; - client.innerApiCalls.listAnalyses = stubSimpleCall(expectedResponse); - const [response] = await client.listAnalyses(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnalyses without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - ]; - client.innerApiCalls.listAnalyses = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listAnalyses( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IAnalysis[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listAnalyses with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listAnalyses = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listAnalyses(request), expectedError); - assert((client.innerApiCalls.listAnalyses as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listAnalysesStream without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - ]; - client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listAnalysesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.contactcenterinsights.v1.Analysis[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.Analysis) => { - 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.listAnalyses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); - assert.strictEqual( - (client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listAnalysesStream with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listAnalyses.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listAnalysesStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.contactcenterinsights.v1.Analysis[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.Analysis) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listAnalyses, request)); - assert.strictEqual( - (client.descriptors.page.listAnalyses.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnalyses without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.Analysis()), - ]; - client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.contactcenterinsights.v1.IAnalysis[] = []; - const iterable = client.listAnalysesAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listAnalyses with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListAnalysesRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listAnalyses.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listAnalysesAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.contactcenterinsights.v1.IAnalysis[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listAnalyses.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('listPhraseMatchers', () => { - it('invokes listPhraseMatchers without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - ]; - client.innerApiCalls.listPhraseMatchers = stubSimpleCall(expectedResponse); - const [response] = await client.listPhraseMatchers(request); - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listPhraseMatchers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listPhraseMatchers without error using callback', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - ]; - client.innerApiCalls.listPhraseMatchers = stubSimpleCallWithCallback(expectedResponse); - const promise = new Promise((resolve, reject) => { - client.listPhraseMatchers( - request, - (err?: Error|null, result?: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[]|null) => { - if (err) { - reject(err); - } else { - resolve(result); - } - }); - }); - const response = await promise; - assert.deepStrictEqual(response, expectedResponse); - assert((client.innerApiCalls.listPhraseMatchers as SinonStub) - .getCall(0).calledWith(request, expectedOptions /*, callback defined above */)); - }); - - it('invokes listPhraseMatchers with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedOptions = { - otherArgs: { - headers: { - 'x-goog-request-params': expectedHeaderRequestParams, - }, - }, - }; - const expectedError = new Error('expected'); - client.innerApiCalls.listPhraseMatchers = stubSimpleCall(undefined, expectedError); - await assert.rejects(client.listPhraseMatchers(request), expectedError); - assert((client.innerApiCalls.listPhraseMatchers as SinonStub) - .getCall(0).calledWith(request, expectedOptions, undefined)); - }); - - it('invokes listPhraseMatchersStream without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - ]; - client.descriptors.page.listPhraseMatchers.createStream = stubPageStreamingCall(expectedResponse); - const stream = client.listPhraseMatchersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher) => { - 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.listPhraseMatchers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPhraseMatchers, request)); - assert.strictEqual( - (client.descriptors.page.listPhraseMatchers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('invokes listPhraseMatchersStream with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedError = new Error('expected'); - client.descriptors.page.listPhraseMatchers.createStream = stubPageStreamingCall(undefined, expectedError); - const stream = client.listPhraseMatchersStream(request); - const promise = new Promise((resolve, reject) => { - const responses: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher[] = []; - stream.on('data', (response: protos.google.cloud.contactcenterinsights.v1.PhraseMatcher) => { - responses.push(response); - }); - stream.on('end', () => { - resolve(responses); - }); - stream.on('error', (err: Error) => { - reject(err); - }); - }); - await assert.rejects(promise, expectedError); - assert((client.descriptors.page.listPhraseMatchers.createStream as SinonStub) - .getCall(0).calledWith(client.innerApiCalls.listPhraseMatchers, request)); - assert.strictEqual( - (client.descriptors.page.listPhraseMatchers.createStream as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listPhraseMatchers without error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent="; - const expectedResponse = [ - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.PhraseMatcher()), - ]; - client.descriptors.page.listPhraseMatchers.asyncIterate = stubAsyncIterationCall(expectedResponse); - const responses: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[] = []; - const iterable = client.listPhraseMatchersAsync(request); - for await (const resource of iterable) { - responses.push(resource!); - } - assert.deepStrictEqual(responses, expectedResponse); - assert.deepStrictEqual( - (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - - it('uses async iteration with listPhraseMatchers with error', async () => { - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - const request = generateSampleMessage(new protos.google.cloud.contactcenterinsights.v1.ListPhraseMatchersRequest()); - request.parent = ''; - const expectedHeaderRequestParams = "parent=";const expectedError = new Error('expected'); - client.descriptors.page.listPhraseMatchers.asyncIterate = stubAsyncIterationCall(undefined, expectedError); - const iterable = client.listPhraseMatchersAsync(request); - await assert.rejects(async () => { - const responses: protos.google.cloud.contactcenterinsights.v1.IPhraseMatcher[] = []; - for await (const resource of iterable) { - responses.push(resource!); - } - }); - assert.deepStrictEqual( - (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) - .getCall(0).args[1], request); - assert.strictEqual( - (client.descriptors.page.listPhraseMatchers.asyncIterate as SinonStub) - .getCall(0).args[2].otherArgs.headers['x-goog-request-params'], - expectedHeaderRequestParams - ); - }); - }); - - describe('Path templates', () => { - - describe('analysis', () => { - const fakePath = "/rendered/path/analysis"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - analysis: "analysisValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.analysisPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.analysisPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('analysisPath', () => { - const result = client.analysisPath("projectValue", "locationValue", "conversationValue", "analysisValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.analysisPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromAnalysisName', () => { - const result = client.matchProjectFromAnalysisName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromAnalysisName', () => { - const result = client.matchLocationFromAnalysisName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromAnalysisName', () => { - const result = client.matchConversationFromAnalysisName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchAnalysisFromAnalysisName', () => { - const result = client.matchAnalysisFromAnalysisName(fakePath); - assert.strictEqual(result, "analysisValue"); - assert((client.pathTemplates.analysisPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('conversation', () => { - const fakePath = "/rendered/path/conversation"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - conversation: "conversationValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.conversationPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.conversationPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('conversationPath', () => { - const result = client.conversationPath("projectValue", "locationValue", "conversationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.conversationPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromConversationName', () => { - const result = client.matchProjectFromConversationName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromConversationName', () => { - const result = client.matchLocationFromConversationName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchConversationFromConversationName', () => { - const result = client.matchConversationFromConversationName(fakePath); - assert.strictEqual(result, "conversationValue"); - assert((client.pathTemplates.conversationPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('issue', () => { - const fakePath = "/rendered/path/issue"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - issue_model: "issueModelValue", - issue: "issueValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.issuePathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.issuePathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('issuePath', () => { - const result = client.issuePath("projectValue", "locationValue", "issueModelValue", "issueValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.issuePathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIssueName', () => { - const result = client.matchProjectFromIssueName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.issuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIssueName', () => { - const result = client.matchLocationFromIssueName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.issuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIssueModelFromIssueName', () => { - const result = client.matchIssueModelFromIssueName(fakePath); - assert.strictEqual(result, "issueModelValue"); - assert((client.pathTemplates.issuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIssueFromIssueName', () => { - const result = client.matchIssueFromIssueName(fakePath); - assert.strictEqual(result, "issueValue"); - assert((client.pathTemplates.issuePathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('issueModel', () => { - const fakePath = "/rendered/path/issueModel"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - issue_model: "issueModelValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.issueModelPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.issueModelPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('issueModelPath', () => { - const result = client.issueModelPath("projectValue", "locationValue", "issueModelValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.issueModelPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromIssueModelName', () => { - const result = client.matchProjectFromIssueModelName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromIssueModelName', () => { - const result = client.matchLocationFromIssueModelName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchIssueModelFromIssueModelName', () => { - const result = client.matchIssueModelFromIssueModelName(fakePath); - assert.strictEqual(result, "issueModelValue"); - assert((client.pathTemplates.issueModelPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('location', () => { - const fakePath = "/rendered/path/location"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - 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('phraseMatcher', () => { - const fakePath = "/rendered/path/phraseMatcher"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - phrase_matcher: "phraseMatcherValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.phraseMatcherPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.phraseMatcherPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('phraseMatcherPath', () => { - const result = client.phraseMatcherPath("projectValue", "locationValue", "phraseMatcherValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.phraseMatcherPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromPhraseMatcherName', () => { - const result = client.matchProjectFromPhraseMatcherName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromPhraseMatcherName', () => { - const result = client.matchLocationFromPhraseMatcherName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchPhraseMatcherFromPhraseMatcherName', () => { - const result = client.matchPhraseMatcherFromPhraseMatcherName(fakePath); - assert.strictEqual(result, "phraseMatcherValue"); - assert((client.pathTemplates.phraseMatcherPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - - describe('settings', () => { - const fakePath = "/rendered/path/settings"; - const expectedParameters = { - project: "projectValue", - location: "locationValue", - }; - const client = new contactcenterinsightsModule.v1.ContactCenterInsightsClient({ - credentials: {client_email: 'bogus', private_key: 'bogus'}, - projectId: 'bogus', - }); - client.initialize(); - client.pathTemplates.settingsPathTemplate.render = - sinon.stub().returns(fakePath); - client.pathTemplates.settingsPathTemplate.match = - sinon.stub().returns(expectedParameters); - - it('settingsPath', () => { - const result = client.settingsPath("projectValue", "locationValue"); - assert.strictEqual(result, fakePath); - assert((client.pathTemplates.settingsPathTemplate.render as SinonStub) - .getCall(-1).calledWith(expectedParameters)); - }); - - it('matchProjectFromSettingsName', () => { - const result = client.matchProjectFromSettingsName(fakePath); - assert.strictEqual(result, "projectValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - - it('matchLocationFromSettingsName', () => { - const result = client.matchLocationFromSettingsName(fakePath); - assert.strictEqual(result, "locationValue"); - assert((client.pathTemplates.settingsPathTemplate.match as SinonStub) - .getCall(-1).calledWith(fakePath)); - }); - }); - }); -}); diff --git a/owl-bot-staging/v1/tsconfig.json b/owl-bot-staging/v1/tsconfig.json deleted file mode 100644 index c78f1c8..0000000 --- a/owl-bot-staging/v1/tsconfig.json +++ /dev/null @@ -1,19 +0,0 @@ -{ - "extends": "./node_modules/gts/tsconfig-google.json", - "compilerOptions": { - "rootDir": ".", - "outDir": "build", - "resolveJsonModule": true, - "lib": [ - "es2018", - "dom" - ] - }, - "include": [ - "src/*.ts", - "src/**/*.ts", - "test/*.ts", - "test/**/*.ts", - "system-test/*.ts" - ] -} diff --git a/owl-bot-staging/v1/webpack.config.js b/owl-bot-staging/v1/webpack.config.js deleted file mode 100644 index 97e7287..0000000 --- a/owl-bot-staging/v1/webpack.config.js +++ /dev/null @@ -1,64 +0,0 @@ -// Copyright 2021 Google LLC -// -// Licensed under the Apache License, Version 2.0 (the "License"); -// you may not use this file except in compliance with the License. -// You may obtain a copy of the License at -// -// https://www.apache.org/licenses/LICENSE-2.0 -// -// Unless required by applicable law or agreed to in writing, software -// distributed under the License is distributed on an "AS IS" BASIS, -// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -// See the License for the specific language governing permissions and -// limitations under the License. - -const path = require('path'); - -module.exports = { - entry: './src/index.ts', - output: { - library: 'ContactCenterInsights', - filename: './contact-center-insights.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/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto b/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto index e8153a1..922219b 100644 --- a/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto +++ b/protos/google/cloud/contactcenterinsights/v1/contact_center_insights.proto @@ -607,6 +607,19 @@ message ExportInsightsDataRequest { string table = 2; } + // Specifies the action that occurs if the destination table already exists. + enum WriteDisposition { + // Write disposition is not specified. Defaults to WRITE_TRUNCATE. + WRITE_DISPOSITION_UNSPECIFIED = 0; + + // If the table already exists, BigQuery will overwrite the table data and + // use the schema from the load. + WRITE_TRUNCATE = 1; + + // If the table already exists, BigQuery will append data to the table. + WRITE_APPEND = 2; + } + // Exporter destination. oneof destination { // Specified if sink is a BigQuery table. @@ -629,6 +642,9 @@ message ExportInsightsDataRequest { // Format: // projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} string kms_key = 4; + + // Options for what to do if the destination table already exists. + WriteDisposition write_disposition = 5; } // Metadata for an export insights operation. diff --git a/protos/protos.d.ts b/protos/protos.d.ts index 0807c63..6b8989d 100644 --- a/protos/protos.d.ts +++ b/protos/protos.d.ts @@ -2288,6 +2288,9 @@ export namespace google { /** ExportInsightsDataRequest kmsKey */ kmsKey?: (string|null); + + /** ExportInsightsDataRequest writeDisposition */ + writeDisposition?: (google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|keyof typeof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|null); } /** Represents an ExportInsightsDataRequest. */ @@ -2311,6 +2314,9 @@ export namespace google { /** ExportInsightsDataRequest kmsKey. */ public kmsKey: string; + /** ExportInsightsDataRequest writeDisposition. */ + public writeDisposition: (google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|keyof typeof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition); + /** ExportInsightsDataRequest destination. */ public destination?: "bigQueryDestination"; @@ -2488,6 +2494,13 @@ export namespace google { */ public toJSON(): { [k: string]: any }; } + + /** WriteDisposition enum. */ + enum WriteDisposition { + WRITE_DISPOSITION_UNSPECIFIED = 0, + WRITE_TRUNCATE = 1, + WRITE_APPEND = 2 + } } /** Properties of an ExportInsightsDataMetadata. */ diff --git a/protos/protos.js b/protos/protos.js index d8143b7..7e3949f 100644 --- a/protos/protos.js +++ b/protos/protos.js @@ -4979,6 +4979,7 @@ * @property {string|null} [parent] ExportInsightsDataRequest parent * @property {string|null} [filter] ExportInsightsDataRequest filter * @property {string|null} [kmsKey] ExportInsightsDataRequest kmsKey + * @property {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition|null} [writeDisposition] ExportInsightsDataRequest writeDisposition */ /** @@ -5028,6 +5029,14 @@ */ ExportInsightsDataRequest.prototype.kmsKey = ""; + /** + * ExportInsightsDataRequest writeDisposition. + * @member {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} writeDisposition + * @memberof google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest + * @instance + */ + ExportInsightsDataRequest.prototype.writeDisposition = 0; + // OneOf field names bound to virtual getters and setters var $oneOfFields; @@ -5074,6 +5083,8 @@ writer.uint32(/* id 3, wireType 2 =*/26).string(message.filter); if (message.kmsKey != null && Object.hasOwnProperty.call(message, "kmsKey")) writer.uint32(/* id 4, wireType 2 =*/34).string(message.kmsKey); + if (message.writeDisposition != null && Object.hasOwnProperty.call(message, "writeDisposition")) + writer.uint32(/* id 5, wireType 0 =*/40).int32(message.writeDisposition); return writer; }; @@ -5120,6 +5131,9 @@ case 4: message.kmsKey = reader.string(); break; + case 5: + message.writeDisposition = reader.int32(); + break; default: reader.skipType(tag & 7); break; @@ -5173,6 +5187,15 @@ if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) if (!$util.isString(message.kmsKey)) return "kmsKey: string expected"; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + switch (message.writeDisposition) { + default: + return "writeDisposition: enum value expected"; + case 0: + case 1: + case 2: + break; + } return null; }; @@ -5199,6 +5222,20 @@ message.filter = String(object.filter); if (object.kmsKey != null) message.kmsKey = String(object.kmsKey); + switch (object.writeDisposition) { + case "WRITE_DISPOSITION_UNSPECIFIED": + case 0: + message.writeDisposition = 0; + break; + case "WRITE_TRUNCATE": + case 1: + message.writeDisposition = 1; + break; + case "WRITE_APPEND": + case 2: + message.writeDisposition = 2; + break; + } return message; }; @@ -5219,6 +5256,7 @@ object.parent = ""; object.filter = ""; object.kmsKey = ""; + object.writeDisposition = options.enums === String ? "WRITE_DISPOSITION_UNSPECIFIED" : 0; } if (message.parent != null && message.hasOwnProperty("parent")) object.parent = message.parent; @@ -5231,6 +5269,8 @@ object.filter = message.filter; if (message.kmsKey != null && message.hasOwnProperty("kmsKey")) object.kmsKey = message.kmsKey; + if (message.writeDisposition != null && message.hasOwnProperty("writeDisposition")) + object.writeDisposition = options.enums === String ? $root.google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition[message.writeDisposition] : message.writeDisposition; return object; }; @@ -5477,6 +5517,22 @@ return BigQueryDestination; })(); + /** + * WriteDisposition enum. + * @name google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition + * @enum {number} + * @property {number} WRITE_DISPOSITION_UNSPECIFIED=0 WRITE_DISPOSITION_UNSPECIFIED value + * @property {number} WRITE_TRUNCATE=1 WRITE_TRUNCATE value + * @property {number} WRITE_APPEND=2 WRITE_APPEND value + */ + ExportInsightsDataRequest.WriteDisposition = (function() { + var valuesById = {}, values = Object.create(valuesById); + values[valuesById[0] = "WRITE_DISPOSITION_UNSPECIFIED"] = 0; + values[valuesById[1] = "WRITE_TRUNCATE"] = 1; + values[valuesById[2] = "WRITE_APPEND"] = 2; + return values; + })(); + return ExportInsightsDataRequest; })(); diff --git a/protos/protos.json b/protos/protos.json index a2c01a0..b625a3d 100644 --- a/protos/protos.json +++ b/protos/protos.json @@ -961,6 +961,10 @@ "kmsKey": { "type": "string", "id": 4 + }, + "writeDisposition": { + "type": "WriteDisposition", + "id": 5 } }, "nested": { @@ -982,6 +986,13 @@ "id": 2 } } + }, + "WriteDisposition": { + "values": { + "WRITE_DISPOSITION_UNSPECIFIED": 0, + "WRITE_TRUNCATE": 1, + "WRITE_APPEND": 2 + } } } }, diff --git a/samples/generated/v1/contact_center_insights.export_insights_data.js b/samples/generated/v1/contact_center_insights.export_insights_data.js index fb50e9f..c51c492 100644 --- a/samples/generated/v1/contact_center_insights.export_insights_data.js +++ b/samples/generated/v1/contact_center_insights.export_insights_data.js @@ -38,6 +38,10 @@ function main(parent) { * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} */ // const kmsKey = 'abc123' + /** + * Options for what to do if the destination table already exists. + */ + // const writeDisposition = {} // Imports the Contactcenterinsights library const {ContactCenterInsightsClient} = diff --git a/src/v1/contact_center_insights_client.ts b/src/v1/contact_center_insights_client.ts index 4536ee2..392fca1 100644 --- a/src/v1/contact_center_insights_client.ts +++ b/src/v1/contact_center_insights_client.ts @@ -2586,6 +2586,8 @@ export class ContactCenterInsightsClient { * A fully qualified KMS key name for BigQuery tables protected by CMEK. * Format: * projects/{project}/locations/{location}/keyRings/{keyring}/cryptoKeys/{key}/cryptoKeyVersions/{version} + * @param {google.cloud.contactcenterinsights.v1.ExportInsightsDataRequest.WriteDisposition} request.writeDisposition + * Options for what to do if the destination table already exists. * @param {object} [options] * Call options. See {@link https://googleapis.dev/nodejs/google-gax/latest/interfaces/CallOptions.html|CallOptions} for more details. * @returns {Promise} - The promise which resolves to an array.