(projectId, displayName)
| 17 | process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements |
| 18 | |
| 19 | async function main(projectId, displayName) { |
| 20 | // [START dialogflow_set_agent_sample] |
| 21 | |
| 22 | const parent = 'projects/' + projectId + '/locations/global'; |
| 23 | |
| 24 | const api_endpoint = 'global-dialogflow.googleapis.com'; |
| 25 | |
| 26 | const agent = { |
| 27 | displayName: displayName, |
| 28 | defaultLanguageCode: 'en', |
| 29 | timeZone: 'America/Los_Angeles', |
| 30 | }; |
| 31 | |
| 32 | const {AgentsClient} = require('@google-cloud/dialogflow-cx'); |
| 33 | |
| 34 | const client = new AgentsClient({apiEndpoint: api_endpoint}); |
| 35 | |
| 36 | async function setAgentSample() { |
| 37 | const request = { |
| 38 | agent, |
| 39 | parent, |
| 40 | }; |
| 41 | |
| 42 | const [response] = await client.createAgent(request); |
| 43 | console.log(`response: ${JSON.stringify(response, null, 2)}`); |
| 44 | |
| 45 | // Delete created agent resource |
| 46 | client.deleteAgent({name: response.name}); |
| 47 | } |
| 48 | await setAgentSample(); |
| 49 | // [END dialogflow_set_agent_sample] |
| 50 | } |
| 51 | |
| 52 | process.on('unhandledRejection', err => { |
| 53 | console.error(err.message); |
no test coverage detected