|
| 1 | +// Copyright 2020 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 | +// http://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 = 'my-project', location = 'us', agent = 'foo') { |
| 18 | + // [START dialogflow_cx_quickstart] |
| 19 | + /** |
| 20 | + * TODO(developer): Uncomment these variables before running the sample. |
| 21 | + */ |
| 22 | + // const projectId = 'my-project'; |
| 23 | + // const location = 'us'; |
| 24 | + // const agent = 'foo'; |
| 25 | + |
| 26 | + // Imports the Google Cloud Some API library |
| 27 | + const {IntentsClient} = require('@google-cloud/dialogflow-cx'); |
| 28 | + const client = new IntentsClient(); |
| 29 | + async function listIntents() { |
| 30 | + const parent = client.agentPath(projectId, location, agent); |
| 31 | + console.info(parent); |
| 32 | + // TODO: implement a quickstart that does something useful: |
| 33 | + /* |
| 34 | + const [intents] = await client.listIntents({ |
| 35 | + parent, |
| 36 | + }); |
| 37 | + console.info(intents); |
| 38 | + */ |
| 39 | + } |
| 40 | + listIntents(); |
| 41 | + // [END dialogflow_cx_quickstart] |
| 42 | +} |
| 43 | + |
| 44 | +main(...process.argv.slice(2)); |
| 45 | +process.on('unhandledRejection', err => { |
| 46 | + console.error(err.message); |
| 47 | + process.exitCode = 1; |
| 48 | +}); |
0 commit comments