src/spotify-web-api.js
function(options, callback) {
    var _opts = {};
    var optionsOfTypeArray = ['seed_artists', 'seed_genres', 'seed_tracks'];
    for (var option in options) {
      if (options.hasOwnProperty(option)) {
        if (
          optionsOfTypeArray.indexOf(option) !== -1 &&
          Object.prototype.toString.call(options[option]) === '[object Array]'
        ) {
          _opts[option] = options[option].join(',');
        } else {
          _opts[option] = options[option];
        }
      }
    }

    return WebApiRequest.builder(this.getAccessToken())
      .withPath('/v1/recommendations')
      .withQueryParameters(_opts)
      .build()
      .execute(HttpManager.get, callback);
  }
function(options, callback) {
    var _opts = {};
    var optionsOfTypeArray = ['seed_artists', 'seed_genres', 'seed_tracks'];
    for (var option in options) {
      if (options.hasOwnProperty(option)) {
        if (
          optionsOfTypeArray.indexOf(option) !== -1 &&
          Object.prototype.toString.call(options[option]) === '[object Array]'
        ) {
          _opts[option] = options[option].join(',');
        } else {
          _opts[option] = options[option];
        }
      }
    }

    return WebApiRequest.builder(this.getAccessToken())
      .withPath('/v1/recommendations')
      .withQueryParameters(_opts)
      .build()
      .execute(HttpManager.get, callback);
  }
function ( options , callback ) { var _opts = { } ; var optionsOfTypeArray = [ 'seed_artists' , 'seed_genres' , 'seed_tracks' ] ; for ( var option in options ) { if ( options . hasOwnProperty ( option ) ) { if ( optionsOfTypeArray . indexOf ( option ) !== - 1 && Object . prototype . toString . call ( options [ option ] ) === '[object Array]' ) { _opts [ option ] = options [ option ] . join ( ',' ) ; } else { _opts [ option ] = options [ option ] ; } } } return WebApiRequest . builder ( this . getAccessToken ( ) ) . withPath ( '/v1/recommendations' ) . withQueryParameters ( _opts ) . build ( ) . execute ( HttpManager . get , callback ) ; }
Create a playlist-style listening experience based on seed artists, tracks and genres.
@param {Object} [options] The options supplied to this request.
@param {requestCallback} [callback] Optional callback method to be called instead of the promise.
@example getRecommendations({ min_energy: 0.4, seed_artists: ['6mfK6Q2tzLMEchAr0e9Uzu', '4DYFVNKZ1uixa6SQTvzQwJ'], min_popularity: 50 }).then(...)
@returns {Promise|undefined} A promise that if successful, resolves to an object containing
a list of tracks and a list of seeds. If rejected, it contains an error object. Not returned if a callback is given.
Create a playlist - style listening experience based on seed artists tracks and genres .