zmb3 / spotify

A Go wrapper for the Spotify Web API
Apache License 2.0
1.37k stars 287 forks source link

Paging #96

Closed jpenninkhof closed 4 years ago

jpenninkhof commented 5 years ago

It seems that e.g. getPlaylist doesn't support the paging features of the Spotify API. As Spotify limits output per page to 100, this means that the wrapper will only retrieve the first 100 items of a playlist or album. The following pages are inaccessibly through the wrapper.

zmb3 commented 5 years ago

The Opt variants all support the limit and offset fields which allow you to retrieve whichever page you're looking for.

chrisvdg commented 5 years ago

I agree it's possible to do, but I find it way too cumbersome and think a lot of users will do want to do that, resulting in a lot of people writing having to write similar code for getting paged results back, that's why I added the helpers in my PR #79 without breaking the current API

Other suggestions on how to make it easier to retrieve results from multiple pages are welcome ofc. I'll see if I can free up some time to work on it.

btw, duplicate of #75?

jpenninkhof commented 4 years ago

The 'Opt' version will work for me. Must have overlooked it. Thanks!

zmb3 commented 4 years ago

I added a more convenient way to move through the pages. You can check out the example here: https://github.com/zmb3/spotify/blob/master/examples/paging/page.go