indaba-client
v0.0.4
Published
JavaScript client for the Indaba Music SDK
Downloads
4
Readme
Create a client with options:
dorianEndpoint
: requiredlydianEndpoint
: requiredtoken
: 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);
Get Request:
path
: required URL path (/opportunities/
)query
: object used to build query stringcast
: data or datum will be cast to this class (client.Opportunity
)
client.get({
path: '/opportunities',
query: {
limit: 10
}
cast: client.Opportunity
}, function(err, data) {
var opp = data[0];
console.log("opp phase: ", opp.getPhase());
})
Post Request:
path
: required URL pathbody
: payload object of post requestcast
: data or datum will be cast to this class
client.post({
path: '/opportunities/xxx/enter'
}, function(err) {
if (!err) {
console.log("you are entered!");
}
})