-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: initial full generation of library (#1)
- Loading branch information
Showing
3 changed files
with
107 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
{ | ||
"name": "nodejs-dialogflow-cx-samples", | ||
"private": true, | ||
"license": "Apache-2.0", | ||
"author": "Google LLC", | ||
"engines": { | ||
"node": ">=10" | ||
}, | ||
"files": [ | ||
"*.js" | ||
], | ||
"scripts": { | ||
"test": "c8 mocha --timeout 600000 test/*.js" | ||
}, | ||
"dependencies": { | ||
"@google-cloud/dialogflow-cx": "^0.1.0" | ||
}, | ||
"devDependencies": { | ||
"c8": "^7.3.0", | ||
"chai": "^4.2.0", | ||
"mocha": "^8.1.1" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
// Copyright 2020 Google LLC | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// http://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
|
||
'use strict'; | ||
|
||
async function main(projectId = 'my-project', location = 'us', agent = 'foo') { | ||
// [START dialogflow_cx_quickstart] | ||
/** | ||
* TODO(developer): Uncomment these variables before running the sample. | ||
*/ | ||
// const projectId = 'my-project'; | ||
// const location = 'us'; | ||
// const agent = 'foo'; | ||
|
||
// Imports the Google Cloud Some API library | ||
const {IntentsClient} = require('@google-cloud/dialogflow-cx'); | ||
const client = new IntentsClient(); | ||
async function listIntents() { | ||
const parent = client.agentPath(projectId, location, agent); | ||
console.info(parent); | ||
// TODO: implement a quickstart that does something useful: | ||
/* | ||
const [intents] = await client.listIntents({ | ||
parent, | ||
}); | ||
console.info(intents); | ||
*/ | ||
} | ||
listIntents(); | ||
// [END dialogflow_cx_quickstart] | ||
} | ||
|
||
main(...process.argv.slice(2)); | ||
process.on('unhandledRejection', err => { | ||
console.error(err.message); | ||
process.exitCode = 1; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
// | ||
// Licensed under the Apache License, Version 2.0 (the "License"); | ||
// you may not use this file except in compliance with the License. | ||
// You may obtain a copy of the License at | ||
// | ||
// https://www.apache.org/licenses/LICENSE-2.0 | ||
// | ||
// Unless required by applicable law or agreed to in writing, software | ||
// distributed under the License is distributed on an "AS IS" BASIS, | ||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
// See the License for the specific language governing permissions and | ||
// limitations under the License. | ||
// | ||
// ** This file is automatically generated by gapic-generator-typescript. ** | ||
// ** https://github.com/googleapis/gapic-generator-typescript ** | ||
// ** All changes to this file may be overwritten. ** | ||
|
||
'use strict'; | ||
|
||
const path = require('path'); | ||
const {assert} = require('chai'); | ||
const cp = require('child_process'); | ||
const {describe, it} = require('mocha'); | ||
|
||
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'}); | ||
|
||
const cwd = path.join(__dirname, '..'); | ||
|
||
const project = process.env.GCLOUD_PROJECT; | ||
|
||
describe('Quickstart', () => { | ||
it('should run quickstart', async () => { | ||
const stdout = execSync(`node ./quickstart.js ${project}`, {cwd}); | ||
assert.match(stdout, /projects/); | ||
}); | ||
}); |