Skip to content

Commit

Permalink
update documentation about interactive (wit-ai#77)
Browse files Browse the repository at this point in the history
* update information about the new interactive api
* uncomment interactive

Merging to fix issues wit-ai#74 wit-ai#72 .
@stopachka Please follow-up to address comments.
  • Loading branch information
stopachka authored and patapizza committed Aug 12, 2016
1 parent 1dc3f28 commit 86a0cb8
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 6 deletions.
6 changes: 6 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
## v4.1.0

### Breaking changes

- interactive is no longer a function on the `Wit` client. Instead, you require it from the library. `require('node-wit').interactive`

## v4.0.0

After a lot of internal dogfooding and bot building, we decided to change the API in a backwards-incompatible way. The changes are described below and aim to simplify user code and accommodate upcoming features.
Expand Down
6 changes: 4 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@ The Wit module provides a Wit class with the following methods:
* `message` - the Wit [message](https://wit.ai/docs/http/20160330#get-intent-via-text-link) API
* `converse` - the low-level Wit [converse](https://wit.ai/docs/http/20160330#converse-link) API
* `runActions` - a higher-level method to the Wit converse API
* `interactive` - starts an interactive conversation with your bot

You can also require a library function to test out your bot in the terminal. `require('node-wit').interactive`

### Wit class

Expand Down Expand Up @@ -160,7 +161,8 @@ Starts an interactive conversation with your bot.

Example:
```js
client.interactive();
const {interactive} = require('node-wit');
interactive(client)
```

See the [docs](https://wit.ai/docs) for more information.
Expand Down
5 changes: 4 additions & 1 deletion examples/basic.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

let Wit = null;
let interactive = null;
try {
// if running from repo
Wit = require('../').Wit;
interactive = require('../').interactive;
} catch (e) {
Wit = require('node-wit').Wit;
interactive = require('node-wit').interactive;
}

const accessToken = (() => {
Expand All @@ -29,4 +32,4 @@ const actions = {
};

const client = new Wit({accessToken, actions});
client.interactive();
interactive(client);
6 changes: 5 additions & 1 deletion examples/joke.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,17 @@
'use strict';

let Wit = null;
let interactive = null;
try {
// if running from repo
Wit = require('../').Wit;
interactive = require('../').interactive;
} catch (e) {
Wit = require('node-wit').Wit;
interactive = require('node-wit').interactive;
}


const accessToken = (() => {
if (process.argv.length !== 3) {
console.log('usage: node examples/joke.js <wit-access-token>');
Expand Down Expand Up @@ -84,4 +88,4 @@ const actions = {
};

const client = new Wit({accessToken, actions});
client.interactive();
interactive(client);
5 changes: 4 additions & 1 deletion examples/quickstart.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
'use strict';

let Wit = null;
let interactive = null;
try {
// if running from repo
Wit = require('../').Wit;
interactive = require('../').interactive;
} catch (e) {
Wit = require('node-wit').Wit;
interactive = require('node-wit').interactive;
}

const accessToken = (() => {
Expand Down Expand Up @@ -56,4 +59,4 @@ const actions = {
};

const client = new Wit({accessToken, actions});
client.interactive();
interactive(client);
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@
"author": "The Wit Team <[email protected]>",
"dependencies": {
"isomorphic-fetch": "^2.2.1",
"node-fetch": "^1.5.1",
"node-uuid": "^1.4.7"
},
"engines": {
Expand Down

0 comments on commit 86a0cb8

Please sign in to comment.