Skip to content

Commit 27757fb

Browse files
authored
feat!: initial full generation of library (#1)
0 parents  commit 27757fb

File tree

3 files changed

+107
-0
lines changed

3 files changed

+107
-0
lines changed

dialogflow-cx/package.json

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"name": "nodejs-dialogflow-cx-samples",
3+
"private": true,
4+
"license": "Apache-2.0",
5+
"author": "Google LLC",
6+
"engines": {
7+
"node": ">=10"
8+
},
9+
"files": [
10+
"*.js"
11+
],
12+
"scripts": {
13+
"test": "c8 mocha --timeout 600000 test/*.js"
14+
},
15+
"dependencies": {
16+
"@google-cloud/dialogflow-cx": "^0.1.0"
17+
},
18+
"devDependencies": {
19+
"c8": "^7.3.0",
20+
"chai": "^4.2.0",
21+
"mocha": "^8.1.1"
22+
}
23+
}

dialogflow-cx/quickstart.js

+48
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
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+
});

dialogflow-cx/test/quickstart.js

+36
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
//
2+
// Licensed under the Apache License, Version 2.0 (the "License");
3+
// you may not use this file except in compliance with the License.
4+
// You may obtain a copy of the License at
5+
//
6+
// https://www.apache.org/licenses/LICENSE-2.0
7+
//
8+
// Unless required by applicable law or agreed to in writing, software
9+
// distributed under the License is distributed on an "AS IS" BASIS,
10+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11+
// See the License for the specific language governing permissions and
12+
// limitations under the License.
13+
//
14+
// ** This file is automatically generated by gapic-generator-typescript. **
15+
// ** https://github.com/googleapis/gapic-generator-typescript **
16+
// ** All changes to this file may be overwritten. **
17+
18+
'use strict';
19+
20+
const path = require('path');
21+
const {assert} = require('chai');
22+
const cp = require('child_process');
23+
const {describe, it} = require('mocha');
24+
25+
const execSync = cmd => cp.execSync(cmd, {encoding: 'utf-8'});
26+
27+
const cwd = path.join(__dirname, '..');
28+
29+
const project = process.env.GCLOUD_PROJECT;
30+
31+
describe('Quickstart', () => {
32+
it('should run quickstart', async () => {
33+
const stdout = execSync(`node ./quickstart.js ${project}`, {cwd});
34+
assert.match(stdout, /projects/);
35+
});
36+
});

0 commit comments

Comments
 (0)