File tree Expand file tree Collapse file tree
src/main/java/se/michaelthelin/spotify/model_objects Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ package se .michaelthelin .spotify .model_objects .interfaces ;
2+
3+ /**
4+ * Represents an object that has a total count.
5+ *
6+ * <p>This interface is implemented by objects that provide a total count of items,
7+ * such as paging objects, followers, and playlist item information.
8+ */
9+ public interface IHasTotal {
10+ /**
11+ * Get the total count.
12+ *
13+ * @return The total count, or {@code null} if not available.
14+ */
15+ Integer getTotal ();
16+ }
17+
Original file line number Diff line number Diff line change @@ -88,6 +88,13 @@ public interface IPlaylist {
8888 */
8989 Boolean getIsPublicAccess ();
9090
91+ /**
92+ * Get information about the items in the playlist. The concrete type depends on the specific playlist object type.
93+ *
94+ * @return Item information containing total count.
95+ */
96+ IHasTotal getItems ();
97+
9198 /**
9299 * Get the snapshot ID, the version identifier for the current playlist. Can be supplied in other requests to target
93100 * a specific playlist version.
Original file line number Diff line number Diff line change 33import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
44import com .google .gson .JsonObject ;
55import se .michaelthelin .spotify .model_objects .AbstractModelObject ;
6+ import se .michaelthelin .spotify .model_objects .interfaces .IHasTotal ;
67
78/**
89 * Retrieve information about Playlist Track Information objects by building instances from this class.
910 */
1011@ JsonDeserialize (builder = PlaylistTracksInformation .Builder .class )
11- public class PlaylistTracksInformation extends AbstractModelObject {
12+ public class PlaylistTracksInformation extends AbstractModelObject implements IHasTotal {
1213 /** A link to the Web API endpoint where full details of the playlist's tracks can be retrieved. */
1314 private final String href ;
1415 /** Number of tracks in the playlist. */
Original file line number Diff line number Diff line change 33import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
44import com .google .gson .JsonObject ;
55import se .michaelthelin .spotify .model_objects .AbstractModelObject ;
6+ import se .michaelthelin .spotify .model_objects .interfaces .IHasTotal ;
67
78import java .lang .reflect .ParameterizedType ;
89import java .util .Arrays ;
1617 * @param <T> The type of the objects contained in a paging object.
1718 */
1819@ JsonDeserialize (builder = Paging .Builder .class )
19- public class Paging <T > extends AbstractModelObject {
20+ public class Paging <T > extends AbstractModelObject implements IHasTotal {
2021 /** The Spotify Web API endpoint URL. */
2122 private final String href ;
2223 /** Array of items in the paging object. */
Original file line number Diff line number Diff line change 33import com .fasterxml .jackson .databind .annotation .JsonDeserialize ;
44import com .google .gson .JsonObject ;
55import se .michaelthelin .spotify .model_objects .AbstractModelObject ;
6+ import se .michaelthelin .spotify .model_objects .interfaces .IHasTotal ;
67
78import java .lang .reflect .ParameterizedType ;
89import java .util .Arrays ;
1617 * @param <T> The type of the objects contained in a paging object.
1718 */
1819@ JsonDeserialize (builder = PagingCursorbased .Builder .class )
19- public class PagingCursorbased <T > extends AbstractModelObject {
20+ public class PagingCursorbased <T > extends AbstractModelObject implements IHasTotal {
2021 /** The Spotify Web API endpoint URL. */
2122 private final String href ;
2223 /** Array of items in the paging object. */
You can’t perform that action at this time.
0 commit comments