Skip to content

Commit

Permalink
Added verbosity and number of entities as params for message (wit-ai#161
Browse files Browse the repository at this point in the history
)

* Added verbosity and number of entities as params for message()

* Update wit.js

* Update wit.js
  • Loading branch information
oniken authored and blandinw committed Oct 16, 2017
1 parent 156edad commit b05a425
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion lib/wit.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,17 @@ function Wit(opts) {

this._sessions = {};

this.message = (message, context) => {
this.message = (message, context, n, verbose) => {
let qs = 'q=' + encodeURIComponent(message);
if (context) {
qs += '&context=' + encodeURIComponent(JSON.stringify(context));
}
if (typeof n === 'number') {
qs += '&n=' + encodeURIComponent(JSON.stringify(n));
}
if (verbose != null) {
qs += '&verbose=' + encodeURIComponent(JSON.stringify(verbose));
}
const method = 'GET';
const fullURL = witURL + '/message?' + qs
const handler = makeWitResponseHandler(logger, 'message');
Expand Down

0 comments on commit b05a425

Please sign in to comment.