wit-keywords

1.0.0 • Public • Published

wit-keywords

Mass push values to keyword based entities on Wit.ai

Travis npm version npm downloads npm license

Installation

npm install wit-keywords --save

Usage

Push an array of actors to the actor entity

const keywords = require('wit-keywords');
 
new keywords(process.env.WIT_TOKEN)
  .entity('actor')
  .push([
    'Leonardo DiCaprio',
    'Steve Carell',
    'Alec Baldwin',
    'Micheal Cera'
  ])
  .then(response => console.log(response))
  .catch(err => console.log(err));
 
//=> [{
//=>   value: 'Leonardo DiCaprio',
//=>   status: 'added'
//=> }, {}, {}, {}]

Trigger a function after each pushed item

const keywords = require('wit-keywords');
 
new keywords(process.env.WIT_TOKEN)
 .entity('actor')
 .after(actor => {
   // Do something
 })
 .push([
   'Leonardo DiCaprio',
   'Steve Carell',
   'Alec Baldwin',
   'Micheal Cera'
 ]);

Trigger a function after each pushed item

const keywords = require('wit-keywords');
 
new keywords(process.env.WIT_TOKEN)
  .entity('actor')
  .after(actor => {
    // Do something
  })
  .push([
    'Leonardo DiCaprio',
    'Steve Carell',
    'Alec Baldwin',
    'Micheal Cera'
  ]);

Set custom number of parallel requests (concurrency)

const keywords = require('wit-keywords');
 
new keywords(process.env.WIT_TOKEN)
  .concurrency(4) // Default = 3
  .entity('actor')
  .after(actor => {
    // Do something
  })
  .push([
    'Leonardo DiCaprio',
    'Steve Carell',
    'Alec Baldwin',
    'Micheal Cera'
  ]);

License

MIT © Daniel Eckermann

Readme

Keywords

none

Package Sidebar

Install

npm i wit-keywords

Weekly Downloads

0

Version

1.0.0

License

MIT

Last publish

Collaborators

  • ecrmnn