Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var DiscoveryV1 = require('watson-developer-cloud/discovery/v1');
- /**
- * Queries a Watson Discovery collection
- *
- * @param {String} username
- * @param {String} password
- * @param {String} environment_id
- * @param {String} collection_id
- * @param {String} query
- *
- * @returns {Promise}
- */
- function main(params) {
- var discovery = new DiscoveryV1({
- username: params.username,
- password: params.password,
- version_date: '2017-11-07'
- });
- return new Promise(function(resolve, reject) {
- discovery.query({
- environment_id: params.environment_id,
- collection_id: params.collection_id,
- query: params.query
- }, function(err, response) {
- if (err) {
- console.error(err);
- reject(err);
- } else {
- resolve(response);
- }
- });
- });
- }
Add Comment
Please, Sign In to add comment