(projectId, location, agentId)
| 15 | 'use strict'; |
| 16 | |
| 17 | async function main(projectId, location, agentId) { |
| 18 | // [START dialogflow_cx_list_intents] |
| 19 | /** |
| 20 | * TODO(developer): Uncomment these variables before running the sample. |
| 21 | */ |
| 22 | // const projectId = 'my-project'; |
| 23 | // const location = 'global'; |
| 24 | // const agentId = 'my-agent'; |
| 25 | |
| 26 | // Imports the Google Cloud Some API library |
| 27 | const {IntentsClient} = require('@google-cloud/dialogflow-cx'); |
| 28 | /** |
| 29 | * Example for regional endpoint: |
| 30 | * const location = 'us-central1' |
| 31 | * const client = new SessionsClient({apiEndpoint: 'us-central1-dialogflow.googleapis.com'}) |
| 32 | */ |
| 33 | const client = new IntentsClient(); |
| 34 | |
| 35 | async function listIntents() { |
| 36 | const parent = client.agentPath(projectId, location, agentId); |
| 37 | console.info(parent); |
| 38 | |
| 39 | const [intents] = await client.listIntents({ |
| 40 | parent, |
| 41 | pageSize: 100, |
| 42 | }); |
| 43 | intents.forEach(intent => { |
| 44 | console.log('===================='); |
| 45 | console.log(`Intent name: ${intent.name}`); |
| 46 | console.log(`Intent display name: ${intent.displayName}`); |
| 47 | console.log(`# Parameters: ${intent.parameters.length}`); |
| 48 | console.log(`# Training Phrases: ${intent.trainingPhrases.length}`); |
| 49 | }); |
| 50 | } |
| 51 | |
| 52 | listIntents(); |
| 53 | // [END dialogflow_cx_list_intents] |
| 54 | } |
| 55 | |
| 56 | main(...process.argv.slice(2)); |
| 57 | process.on('unhandledRejection', err => { |
no test coverage detected