(projectId, agentId, location)
| 15 | 'use strict'; |
| 16 | |
| 17 | async function main(projectId, agentId, 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 location = 'global'; |
| 24 | |
| 25 | // [START dialogflow_cx_log_running_operation] |
| 26 | |
| 27 | const {AgentsClient, protos} = require('@google-cloud/dialogflow-cx'); |
| 28 | |
| 29 | const api_endpoint = `${location}-dialogflow.googleapis.com`; |
| 30 | |
| 31 | const client = new AgentsClient({apiEndpoint: api_endpoint}); |
| 32 | |
| 33 | const exportAgentRequest = |
| 34 | new protos.google.cloud.dialogflow.cx.v3.ExportAgentRequest(); |
| 35 | |
| 36 | exportAgentRequest.name = `projects/${projectId}/locations/${location}/agents/${agentId}`; |
| 37 | |
| 38 | // exportAgent call returns a promise to a long running operation |
| 39 | const [operation] = await client.exportAgent(exportAgentRequest); |
| 40 | |
| 41 | // Waiting for the long running opporation to finish |
| 42 | const [response] = await operation.promise(); |
| 43 | |
| 44 | // Prints the result of the operation when the operation is done |
| 45 | console.log(response); |
| 46 | |
| 47 | // [END dialogflow_cx_log_running_operation] |
| 48 | } |
| 49 | |
| 50 | process.on('unhandledRejection', err => { |
| 51 | console.error(err.message); |
no outgoing calls
no test coverage detected