|
| 1 | +// Copyright 2021 Google LLC |
| 2 | +// |
| 3 | +// Licensed under the Apache License, Version 2.0 (the "License"); |
| 4 | +// you may not use this file except in compliance with the License. |
| 5 | +// You may obtain a copy of the License at |
| 6 | +// |
| 7 | +// https://www.apache.org/licenses/LICENSE-2.0 |
| 8 | +// |
| 9 | +// Unless required by applicable law or agreed to in writing, software |
| 10 | +// distributed under the License is distributed on an "AS IS" BASIS, |
| 11 | +// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 12 | +// See the License for the specific language governing permissions and |
| 13 | +// limitations under the License. |
| 14 | + |
| 15 | +'use strict'; |
| 16 | + |
| 17 | +async function main(projectId, agentId, testId, location) { |
| 18 | + /** |
| 19 | + * TODO(developer): Uncomment these variables before running the sample. |
| 20 | + */ |
| 21 | + // const projectId = 'my-project'; |
| 22 | + // const agentId = 'my-agent'; |
| 23 | + // const testId = 'my-flow'; |
| 24 | + // const location = 'global'; |
| 25 | + |
| 26 | + // [START dialogflow_cx_list_testcase_sample] |
| 27 | + const parent = `projects/${projectId}/locations/${location}/agents/${agentId}/testCases/${testId}`; |
| 28 | + |
| 29 | + const {TestCasesClient} = require('@google-cloud/dialogflow-cx'); |
| 30 | + |
| 31 | + const client = new TestCasesClient({ |
| 32 | + apiEndpoint: 'global-dialogflow.googleapis.com', |
| 33 | + }); |
| 34 | + const req = { |
| 35 | + parent, |
| 36 | + filter: 'environment=draft', |
| 37 | + }; |
| 38 | + |
| 39 | + const res = await client.listTestCaseResults(req); |
| 40 | + |
| 41 | + console.log(res); |
| 42 | + // [END dialogflow_cx_list_testcase_sample] |
| 43 | +} |
| 44 | + |
| 45 | +process.on('unhandledRejection', err => { |
| 46 | + console.error(err.message); |
| 47 | + process.exitCode = 1; |
| 48 | +}); |
| 49 | +main(...process.argv.slice(2)); |
0 commit comments