indaba-client

JavaScript client for the Indaba Music SDK

npm install indaba-client
10 downloads in the last week
20 downloads in the last month

Indaba

Initialize indaba with ENV:

  • dorianEndpoint: required
  • lydianEndpoint: required
indaba = require('indaba-client')({
  dorianEndpoint: 'http://beta.indavelopment.com',
  lydianEndpoint: process.env.INDABA_TEST_ENDPOINT,
});

indaba has our models:

var opp = new indaba.Opportunity(opportunityJsonData);

Get Request:

  • path: required URL path
  • token: optional access token
  • query: optional query object
  • cast: optional class to wrap result(s)
indaba.get({
  path: '/opportunities',
  query: {
    limit: 10
  }
  cast: indaba.Opportunity
}, function(err, data) {
  var opp = data[0];
  console.log("opp phase: ", opp.getPhase());
})

Post Request:

  • path: required URL path
  • token: required access token
  • body: optional payload
  • cast: optional class to wrap result(s)
indaba.post({
  path: '/opportunities/xxx/enter',
  token: 'yyy'
}, function(err) {
  if (!err) {
    console.log("you are entered!");
  }
})

Visitor

Stateful visitor session. Instantiate with required token:

var visitor = indaba.createVisitor(token);
visitor.whoami(function(err) {
  // visitor.currentUser is now set
});

see lib/visitor.js for API

npm loves you