soundcloudnodejs.js
function searchTrack_q(options) {
    return new Promise(function (resolve, reject) {
        if (!options.oauth_token) {
            reject(new Error('Error searchTrack_q oauth_token is required and is null '));
        } else {

            if (!options.q) {
                reject(new Error('Error searchTrack_q options.q is required and is null'));
            } else {
                var uri = 'https://api.soundcloud.com/me/tracks?format=json&oauth_token=' + options.oauth_token + '&q=' + options.q;
                if (DEBUG_MODE_ON) {
                    console.log("searchTrack_q URI, ", uri);
                }

                request.getAsync(uri, {timeout: 10000}).spread(function (response, body) {
                    //console.log('searchTrack_q successful',body);
                    try {
                        //console.log(body.toString('utf8'))
                        resolve(JSON.parse(body.toString('utf8')));
                    } catch (e) {
                        if (DEBUG_MODE_ON) {
                            console.log('Error while searchTrack_q track: ', e);
                        }
                        reject(e);
                    }
                }).catch(function (e) {
                    if (DEBUG_MODE_ON) {
                        console.log('Error while searchTrack_q track: ', e);
                    }
                    reject(e);
                });
            }
        }
    });
}
function searchTrack_q(options) {
    return new Promise(function (resolve, reject) {
        if (!options.oauth_token) {
            reject(new Error('Error searchTrack_q oauth_token is required and is null '));
        } else {

            if (!options.q) {
                reject(new Error('Error searchTrack_q options.q is required and is null'));
            } else {
                var uri = 'https://api.soundcloud.com/me/tracks?format=json&oauth_token=' + options.oauth_token + '&q=' + options.q;
                if (DEBUG_MODE_ON) {
                    console.log("searchTrack_q URI, ", uri);
                }

                request.getAsync(uri, {timeout: 10000}).spread(function (response, body) {
                    //console.log('searchTrack_q successful',body);
                    try {
                        //console.log(body.toString('utf8'))
                        resolve(JSON.parse(body.toString('utf8')));
                    } catch (e) {
                        if (DEBUG_MODE_ON) {
                            console.log('Error while searchTrack_q track: ', e);
                        }
                        reject(e);
                    }
                }).catch(function (e) {
                    if (DEBUG_MODE_ON) {
                        console.log('Error while searchTrack_q track: ', e);
                    }
                    reject(e);
                });
            }
        }
    });
}
function searchTrack_q ( options ) { return new Promise ( function ( resolve , reject ) { if ( ! options . oauth_token ) { reject ( new Error ( 'Error searchTrack_q oauth_token is required and is null ' ) ) ; } else { if ( ! options . q ) { reject ( new Error ( 'Error searchTrack_q options.q is required and is null' ) ) ; } else { var uri = 'https://api.soundcloud.com/me/tracks?format=json&oauth_token=' + options . oauth_token + '&q=' + options . q ; if ( DEBUG_MODE_ON ) { console . log ( "searchTrack_q URI, " , uri ) ; } request . getAsync ( uri , { timeout : 10000 } ) . spread ( function ( response , body ) { //console.log('searchTrack_q successful',body); try { //console.log(body.toString('utf8')) resolve ( JSON . parse ( body . toString ( 'utf8' ) ) ) ; } catch ( e ) { if ( DEBUG_MODE_ON ) { console . log ( 'Error while searchTrack_q track: ' , e ) ; } reject ( e ) ; } } ) . catch ( function ( e ) { if ( DEBUG_MODE_ON ) { console . log ( 'Error while searchTrack_q track: ' , e ) ; } reject ( e ) ; } ) ; } } } ) ; }
Search for a track
@param options
@returns {bluebird|exports|module.exports}
Search for a track