JMPerez / spotify-web-api-js

A client-side JS wrapper for the Spotify Web API
https://jmperezperez.com/spotify-web-api-js/
MIT License
1.86k stars 260 forks source link

Options not working for `getPlaylistTracks` #183

Closed eduardoRubioG closed 3 years ago

eduardoRubioG commented 4 years ago

Describe the bug Adding an options object to the function getPlaylistTracks seems to have no effect.

To Reproduce

spotifyWebApi.getPlaylistTracks(
      '', // blank string for user id parameter
      'some_playlist_id', 
      { limit: 12, offset: 5 }
    ).then((resp) => {
       console.log(resp); 
}); 

Will correctly console log the playlist information but with the tracks item coming back with the default limit of 100 and offset of 0.

Expected behavior I would expect that the API returns the track object with the limit and offset set to what is passed in through the parameter. I tried other functions with similar options object and it seems to work as expected. I am assuming there is some extra logic that needs to be added so that the limit and offset values are applied to the tracks belonging to the playlist rather than the actual playlist query (i.e. returning at most 12 playlist matches with an offset of 5).

Desktop (please complete the following information):

P.S. This is a great project and, unless there is already a solution to this or I am doing it wrong, I would be happy to take a deeper dive and contribute some solution!

JMPerez commented 3 years ago

Hi @eduardoRubioG! The signature for the function changed to only receive the playlist id, as Spotify drop the user_id bit from the request. Could you try again and reopen the issue if it's still failing?