indaba-client

JavaScript client for the Indaba Music SDK

Create a client with options:

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

Client has our models:

var opp = new client.Opportunity(opportunityJsonData);
  • path: required URL path (/opportunities/)
  • query: object used to build query string
  • cast: data or datum will be cast to this class (client.Opportunity)
client.get({
  path: '/opportunities',
  query: {
    limit: 10
  }
  cast: client.Opportunity
}, function(errdata) {
  var opp = data[0];
  console.log("opp phase: ", opp.getPhase());
})

Post Request:

  • path: required URL path
  • body: payload object of post request
  • cast: data or datum will be cast to this class
client.post({
  path: '/opportunities/xxx/enter'
}, function(err) {
  if (!err) {
    console.log("you are entered!");
  }
})