spotify-web-api-node icon indicating copy to clipboard operation
spotify-web-api-node copied to clipboard

Add getGeneric function; Add to tutorials

Open dersimn opened this issue 3 years ago • 1 comments

How do you feel about a function like this?

spotifyApi.getGeneric('https://api.spotify.com/v1/users/USERID/playlists?offset=20&limit=20')

It would make things like this possible (see tutorial folder for working example):

// Get first batch of playlists
const playlist = await spotifyApi.getUserPlaylists();
const allItems = [...playlist.body.items];

// Get further paging objects
let next = playlist.body.next;
while(next) {
  const nextItems = await spotifyApi.getGeneric(next);
  next = nextItems.body.next;

  allItems.push(...nextItems.body.items);
}

dersimn avatar Mar 12 '21 18:03 dersimn

Coverage Status

Coverage decreased (-0.3%) to 97.568% when pulling d6d083936b49abe8fba34db3f722fdd23d73800c on dersimn:pr/1 into be15f1c742b35134ce5bd35521d8bf1ab1ba67cf on thelinmichael:master.

coveralls avatar Mar 12 '21 19:03 coveralls