zmb3 / spotify

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

ReleaseDateTime method only defined for FullAlbum struct #101

Closed siku2 closed 4 years ago

siku2 commented 4 years ago

71, which adds the ReleaseDate and ReleaseDatePrecision fields to the SimpleAlbum struct, was merged ages ago, but SimpleAlbum doesn't have the ReleaseDateTime method which is defined for the FullAlbum struct.

Is it possible to move the ReleaseDateTime method to the SimpleAlbum instead? I would gladly open a PR if interested.

Tangentially related: Is there a reason why - especially in case of the Album structs - multiple fields are defined both on the "simple" as well as on the "full" variant even though the simple one is embedded?

zmb3 commented 4 years ago

I get confused, and I think its because sometimes the Web API docs aren't in line with reality.

According to the docs SimpleAlbum should not have ReleaseDatePrecision.

If we can prove that ReleaseDateTime should be moved to SimpleAlbum I'm happy to take a PR. And if you see things that are in the simple variant (and thus) embedded in the full variant I'd love to see a PR to fix those, too!

siku2 commented 4 years ago

I just checked and it really is weird. Right now the simplified album object definitely seems to include the ReleaseDate and ReleaseDatePrecision keys.

The following is the value of the "album" key in a track object I just got from the API:

click to open

```json { "name": "VIDA", "artists": [ ], "album_group": "", "album_type": "album", "id": "5C0YLr4OoRGFDaqdMQmkeH", "uri": "spotify:album:5C0YLr4OoRGFDaqdMQmkeH", "available_markets": [ ], "href": "https://api.spotify.com/v1/albums/5C0YLr4OoRGFDaqdMQmkeH", "images": [ ], "external_urls": { "spotify": "https://open.spotify.com/album/5C0YLr4OoRGFDaqdMQmkeH" }, "release_date": "2019-02-01", "release_date_precision": "day" } ```

What I find interesting is that these keys are documented in the "Old" Reference docs but in the Beta Reference, the one you linked, they're gone. Maybe this means they're deprecated, or they simply forgot to include them in the new docs. It's still in "beta" after all.

I also spent some time looking for related issues over at spotify/web-api but I couldn't find any.

Anyway, even if the release date keys will no longer be part of the simplified album object in the future, I still think the SimpleAlbum struct should get the ReleaseDateTime method since it already has the fields and even contains the comment: "You can use ReleaseDateTime to convert this to a time.Time value."