zmb3 / spotify

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

Change type of userID to string, to be concistent with other code #67

Closed eanker closed 6 years ago

eanker commented 6 years ago

The ownerID is of type string, except for those three lines.

This caused errors when doing user.ID as it resulted in expected type ID got type string.

zmb3 commented 6 years ago

This is intentional, as it helps to distinguish cases where the user is just your username (a string) and where it is the “Spotify ID” which is something different.

Further, a change like this would break the public API so unless there’s very good reason to do so we should try to avoid it.

eanker commented 6 years ago

Ah, thanks for the reply, didn't think of that.

How would one then use one of those methods, to for example unfollow it's own playlist. As when I do client.getCurrentUser().ID I get a string, that can not be put in the method as ownerID. Also when having a playlist called playlist client.UnfollowPlaylist(playlist.Owner.ID, playlist.ID) gives an error that the owner is an string opposed to a ID.

Or did I change too much and should I only change the type in UnfollowPlaylist?

zmb3 commented 6 years ago

You can always do

spotify.ID(playlist.Owner.ID)

eanker commented 6 years ago

This change was not in line with the spotify API itself, and therefor is closed.