zmb3 / spotify

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

Add "Total" field to client.CurrentUsersAlbums and client.CurrentUsersPlaylists #197

Closed joebonneau closed 1 year ago

joebonneau commented 1 year ago

Hello,

I'm writing a CLI using this library (great job, by the way!) and I've come across an issue while trying to implement goroutines to speed up grabbing all of the saved albums for a user.

Without the "total" field that is provided by the API response, I have to resort to an infinite for loop where I can only know whether I'm done iterating by the number of items returned. If the total albums returned is less than the limit, then I can say that I've reached the end. However, this doesn't jive so well with this sort of implementation.

If the "total" field could be added for both client functions, I think this would be useful for a number of applications.

joebonneau commented 1 year ago

Woops, I just realized this is already available :man_facepalming: . Sorry!