zmb3 / spotify

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

fix: description field in FullPlaylist was shadowing the one from SimplePlaylist #203

Closed Sundava closed 1 year ago

Sundava commented 1 year ago

Follow up of #202, I realized that including the Description field in SimplePlaylist means it should removed from FullPlaylist.

It is very minor, but having it in both structs (In addition to being redundant) means that when explicitly selecting the SimplePlaylist part from the struct, the Description is always empty. It meant we couldn't do this :

func printDescription(playlist SimplePlaylist) {
  fmt.Println(playlist.Description)
}

playlist, err := client.GetPlaylist(ctx, spotify.ID(spotifyID)) // Assume we fetch a playlist with a non empty Description
printDescription(playlist.SimplePlaylist) // Prints nothing, even if playlist.Description is not empty
}