Conversation
|
Right now, I've placed all new common interfaces in an |
9bef08e to
557f20d
Compare
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## beta #457 +/- ##
=========================================
Coverage 49.84% 49.84%
Complexity 582 582
=========================================
Files 243 243
Lines 8626 8626
Branches 1054 1054
=========================================
Hits 4300 4300
Misses 3526 3526
Partials 800 800 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
This PR introduces a set of shared model interfaces (Album, Artist, Playlist, Show, Episode, Track) so callers can treat full and simplified Spotify model objects uniformly, and updates the corresponding model classes to implement those interfaces.
Changes:
- Added new common interfaces under
se.michaelthelin.spotify.model_objects.interfaces(e.g.,IPlaylist,ITrack, etc.). - Updated full + simplified specification model classes (and
AlbumSimplifiedSpecial) to implement the new interfaces. - Enabled simplified Track/Episode to be treated as playlist items via
ITrack/IEpisodeextendingIPlaylistItem.
Reviewed changes
Copilot reviewed 19 out of 19 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| src/main/java/se/michaelthelin/spotify/model_objects/specification/TrackSimplified.java | Implements ITrack to unify simplified Track usage. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Track.java | Implements ITrack to unify full Track usage. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/ShowSimplified.java | Implements IShow for common Show access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Show.java | Implements IShow for common Show access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistSimplified.java | Implements IPlaylist for common Playlist access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Playlist.java | Implements IPlaylist for common Playlist access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/EpisodeSimplified.java | Implements IEpisode for common Episode access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Episode.java | Implements IEpisode for common Episode access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/ArtistSimplified.java | Implements IArtist for common Artist access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Artist.java | Implements IArtist for common Artist access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/AlbumSimplified.java | Implements IAlbum for common Album access. |
| src/main/java/se/michaelthelin/spotify/model_objects/specification/Album.java | Implements IAlbum for common Album access. |
| src/main/java/se/michaelthelin/spotify/model_objects/special/AlbumSimplifiedSpecial.java | Implements IAlbum to include the “special” simplified album in the common contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/ITrack.java | New interface defining shared Track contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/IShow.java | New interface defining shared Show contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/IPlaylist.java | New interface defining shared Playlist contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/IEpisode.java | New interface defining shared Episode contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/IArtist.java | New interface defining shared Artist contract. |
| src/main/java/se/michaelthelin/spotify/model_objects/interfaces/IAlbum.java | New interface defining shared Album contract. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
However, renaming these would also be a breaking change… |
|
As this PR targets |
dargmuesli
left a comment
There was a problem hiding this comment.
Just rerequest me as reviewer once not draft anymore 🙌
9d14a94 to
d6700e3
Compare
d6700e3 to
01f413e
Compare
@dargmuesli thanks for your reply :) Let me ask a follow up question: In the Spotify docs, it's
Personally I would say, let's use the ones we already have for Tracks as they are probably used more and rename the Episode counterparts (although this would not be exactly in line with the official Spotify API doc). Exactly sticking to the API would also mean that we cannot have a common preview URL method. If we want to rename, we could either keep the old method names as well and mark them as depreciated or remove directly. But as I don't really like the felling to break code intentionally and to do not block the remaining PR, I'm also fine with not unifying these methods for now. So let me know whether you have a preference, despite that the PR would be ready for review. |
I'm working on a project, where I'm sometimes getting a
PlaylistSimplifiedand sometimes aPlaylist. As I only need the basic properties, it would save me a lot of boilerplate code if I could downcast both classes toIPlaylistinstead of writing my own conversion methods and model classes.Therefore, this pull request introduces new interfaces to unify the representation of Spotify model objects (Album, Artist, Playlist, Show, Episode, and Track), and updates the corresponding model classes to implement these interfaces. This especially benefits applications implementing this library by providing common interfaces for full and simplified versions of model objects.
I've added no tests, as interfaces only provide the contract, not the implementation, and the model class specific implementations are already tested.
The change is done in a way it shouldn't break any code of existing applications. I've targeted the
betabranch and would be happy if this PR could be included in the final v10 release.