getTrack
methodthis.getTrack()
Look up a track.
this.getTrack = function(trackId, options, callback) {
// In case someone is using a version where options parameter did not exist.
var actualCallback;
if (typeof options === 'function') {
actualCallback = options;
} else {
actualCallback = callback;
}
var actualOptions = {};
if (typeof options === 'object') {
Object.keys(options).forEach(function(key) {
actualOptions[key] = options[key];
});
}
var request = WebApiRequest.builder()
.withPath('/v1/tracks/' + trackId)
.withQueryParameters(actualOptions)
.build();
_addAccessToken(request, this.getAccessToken());
var promise = _performRequest(HttpManager.get, request);
if (actualCallback) {
promise.then(function(data) {
actualCallback(null, data);
}, function(err) {
actualCallback(err);
});
} else {
return promise;
}
};