Skip to content

Commit

Permalink
add API version param
Browse files Browse the repository at this point in the history
  • Loading branch information
l5t committed May 17, 2016
1 parent 5fdee12 commit 0c08ad1
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
- warns instead of throwing when validating actions

## v3.3.1
- adding API versioning


## v3.3.0

- callbacks are not called asynchronously by default, choice is left to the developer (use process.nextTick in your callback to emulate the previous behavior)
Expand Down
5 changes: 3 additions & 2 deletions lib/wit.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const logLevels = require('./logger').logLevels;

const DEFAULT_MAX_STEPS = 5;
const CALLBACK_TIMEOUT_MS = 10000;
const API_VERSION = '20160516';

let l = new Logger(logLevels.LOG);

Expand Down Expand Up @@ -125,7 +126,7 @@ const Wit = function(token, actions, logger) {
cb = context;
context = undefined;
}
let qs = 'q=' + encodeURIComponent(message);
let qs = 'v='+ API_VERSION +'&q=' + encodeURIComponent(message);
if (context) {
qs += '&context=' + encodeURIComponent(JSON.stringify(context));
}
Expand All @@ -142,7 +143,7 @@ const Wit = function(token, actions, logger) {

this.converse = (sessionId, message, context, cb) => {
const handler = makeWitResponseHandler('converse', l, cb);
let qs = 'session_id=' + sessionId;
let qs = 'v='+ API_VERSION + '&session_id=' + sessionId;
if (message) {
qs += '&q=' + encodeURIComponent(message);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "node-wit",
"version": "3.3.0",
"version": "3.3.1",
"description": "Wit.ai Node.js SDK",
"keywords": [
"wit",
Expand Down

0 comments on commit 0c08ad1

Please sign in to comment.