items) {
+ this.items = items;
return this;
}
@@ -473,10 +473,10 @@ public Playlist createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "snapshot_id")
? jsonObject.get("snapshot_id").getAsString()
: null)
- .setTracks(
- hasAndNotNull(jsonObject, "tracks")
+ .setItems(
+ hasAndNotNull(jsonObject, "items")
? new PlaylistTrack.JsonUtil().createModelObjectPaging(
- jsonObject.getAsJsonObject("tracks"))
+ jsonObject.getAsJsonObject("items"))
: null)
.setType(
hasAndNotNull(jsonObject, "type")
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistSimplified.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistSimplified.java
index 01cda2407..d27d318f1 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistSimplified.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistSimplified.java
@@ -37,8 +37,8 @@ public class PlaylistSimplified extends AbstractModelObject implements ISearchMo
private final Boolean publicAccess;
/** The version identifier for the current playlist. */
private final String snapshotId;
- /** Information about the tracks of the playlist. */
- private final PlaylistTracksInformation tracks;
+ /** Information about the items of the playlist. */
+ private final PlaylistTracksInformation items;
/** The object type. */
private final ModelObjectType type;
/** The Spotify URI for the playlist. */
@@ -57,7 +57,7 @@ private PlaylistSimplified(final Builder builder) {
this.owner = builder.owner;
this.publicAccess = builder.publicAccess;
this.snapshotId = builder.snapshotId;
- this.tracks = builder.tracks;
+ this.items = builder.items;
this.type = builder.type;
this.uri = builder.uri;
}
@@ -168,12 +168,12 @@ public String getSnapshotId() {
}
/**
- * Get information about the tracks of the playlist.
+ * Get information about the items of the playlist.
*
- * @return Information about the tracks of the playlist.
+ * @return Information about the items of the playlist.
*/
- public PlaylistTracksInformation getTracks() {
- return tracks;
+ public PlaylistTracksInformation getItems() {
+ return items;
}
/**
@@ -197,7 +197,7 @@ public String getUri() {
@Override
public String toString() {
- return "PlaylistSimplified(name=" + name + ", tracks=" + tracks + ", collaborative=" + collaborative
+ return "PlaylistSimplified(name=" + name + ", items=" + items + ", collaborative=" + collaborative
+ ", description=" + description + ", externalUrls=" + externalUrls + ", href=" + href + ", id=" + id
+ ", images=" + Arrays.toString(images) + ", owner=" + owner + ", publicAccess=" + publicAccess
+ ", snapshotId=" + snapshotId + ", type=" + type + ", uri=" + uri + ")";
@@ -222,7 +222,7 @@ public static final class Builder extends AbstractModelObject.Builder {
private User owner;
private Boolean publicAccess;
private String snapshotId;
- private PlaylistTracksInformation tracks;
+ private PlaylistTracksInformation items;
private ModelObjectType type;
private String uri;
@@ -345,13 +345,13 @@ public Builder setSnapshotId(String snapshotId) {
}
/**
- * Set some track information of the playlist to be built.
+ * Set some item information of the playlist to be built.
*
- * @param tracks A playlist tracks information object.
+ * @param items A playlist tracks information object.
* @return A {@link PlaylistSimplified.Builder}.
*/
- public Builder setTracks(PlaylistTracksInformation tracks) {
- this.tracks = tracks;
+ public Builder setItems(PlaylistTracksInformation items) {
+ this.items = items;
return this;
}
@@ -445,10 +445,10 @@ public PlaylistSimplified createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "snapshot_id")
? jsonObject.get("snapshot_id").getAsString()
: null)
- .setTracks(
- hasAndNotNull(jsonObject, "tracks")
+ .setItems(
+ hasAndNotNull(jsonObject, "items")
? new PlaylistTracksInformation.JsonUtil().createModelObject(
- jsonObject.getAsJsonObject("tracks"))
+ jsonObject.getAsJsonObject("items"))
: null)
.setType(
hasAndNotNull(jsonObject, "type")
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistTrack.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistTrack.java
index f249c5ce8..f4d9cc523 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistTrack.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/PlaylistTrack.java
@@ -24,7 +24,7 @@ public class PlaylistTrack extends AbstractModelObject {
/** Whether the track is a local file. */
private final Boolean isLocal;
/** The track or episode information. */
- private final IPlaylistItem track;
+ private final IPlaylistItem item;
private PlaylistTrack(final Builder builder) {
super(builder);
@@ -32,7 +32,7 @@ private PlaylistTrack(final Builder builder) {
this.addedAt = builder.addedAt;
this.addedBy = builder.addedBy;
this.isLocal = builder.isLocal;
- this.track = builder.track;
+ this.item = builder.item;
}
/**
@@ -68,15 +68,15 @@ public Boolean getIsLocal() {
/**
* Get a full track or episode object from this playlist track object.
*
- * @return Information about the track.
+ * @return Information about the item.
*/
- public IPlaylistItem getTrack() {
- return track;
+ public IPlaylistItem getItem() {
+ return item;
}
@Override
public String toString() {
- return "PlaylistTrack(track=" + track + ", addedAt=" + addedAt + ", addedBy=" + addedBy + ", isLocal=" + isLocal
+ return "PlaylistTrack(item=" + item + ", addedAt=" + addedAt + ", addedBy=" + addedBy + ", isLocal=" + isLocal
+ ")";
}
@@ -92,7 +92,7 @@ public static final class Builder extends AbstractModelObject.Builder {
private Date addedAt;
private User addedBy;
private Boolean isLocal;
- private IPlaylistItem track;
+ private IPlaylistItem item;
/**
* Default constructor.
@@ -137,11 +137,11 @@ public Builder setIsLocal(Boolean isLocal) {
/**
* Set the full track or episode object of the playlist track to be built.
*
- * @param track Information about the track.
+ * @param item Information about the item.
* @return A {@link PlaylistTrack.Builder}.
*/
- public Builder setTrack(IPlaylistItem track) {
- this.track = track;
+ public Builder setItem(IPlaylistItem item) {
+ this.item = item;
return this;
}
@@ -169,12 +169,12 @@ public PlaylistTrack createModelObject(JsonObject jsonObject) {
}
try {
- IPlaylistItem track = null;
+ IPlaylistItem item = null;
- if (hasAndNotNull(jsonObject, "track")) {
- final JsonObject trackObj = jsonObject.getAsJsonObject("track");
+ if (hasAndNotNull(jsonObject, "item")) {
+ final JsonObject itemObj = jsonObject.getAsJsonObject("item");
- track = PlaylistItemFactory.createPlaylistItem(trackObj);
+ item = PlaylistItemFactory.createPlaylistItem(itemObj);
}
return new Builder()
@@ -191,7 +191,7 @@ public PlaylistTrack createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "is_local")
? jsonObject.get("is_local").getAsBoolean()
: null)
- .setTrack(track)
+ .setItem(item)
.build();
} catch (ParseException e) {
SpotifyApi.LOGGER.log(Level.SEVERE, e.getMessage());
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/Show.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/Show.java
index 78369c9a8..20eaf802a 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/Show.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/Show.java
@@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.neovisionaries.i18n.CountryCode;
import se.michaelthelin.spotify.enums.ModelObjectType;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;
@@ -16,8 +15,6 @@
*/
@JsonDeserialize(builder = Show.Builder.class)
public class Show extends AbstractModelObject {
- /** A list of the countries in which the show can be played. */
- private final CountryCode[] availableMarkets;
/** The copyright statements of the show. */
private final Copyright[] copyrights;
/** A description of the show. */
@@ -42,8 +39,6 @@ public class Show extends AbstractModelObject {
private final String mediaType;
/** The name of the show. */
private final String name;
- /** The publisher of the show. */
- private final String publisher;
/** The object type. */
private final ModelObjectType type;
/** The Spotify URI for the show. */
@@ -56,7 +51,6 @@ public class Show extends AbstractModelObject {
*/
public Show(Builder builder) {
super(builder);
- this.availableMarkets = builder.availableMarkets;
this.copyrights = builder.copyrights;
this.description = builder.description;
this.explicit = builder.explicit;
@@ -69,21 +63,10 @@ public Show(Builder builder) {
this.languages = builder.languages;
this.mediaType = builder.mediaType;
this.name = builder.name;
- this.publisher = builder.publisher;
this.type = builder.type;
this.uri = builder.uri;
}
- /**
- * Get a list of the countries in which the show can be played.
- *
- * @return An array of ISO 3166-1 alpha-2 country
- * * codes.
- */
- public CountryCode[] getAvailableMarkets() {
- return availableMarkets;
- }
-
/**
* Get the copyright statements of the show.
*
@@ -194,15 +177,6 @@ public String getName() {
return name;
}
- /**
- * Get the publisher of the show.
- *
- * @return The publisher of the show.
- */
- public String getPublisher() {
- return publisher;
- }
-
/**
* Get the model object type. In this case "show".
*
@@ -223,11 +197,11 @@ public String getUri() {
@Override
public String toString() {
- return "Show(availableMarkets=" + Arrays.toString(availableMarkets) + ", copyrights=" + Arrays.toString(copyrights)
+ return "Show(copyrights=" + Arrays.toString(copyrights)
+ ", description=" + description + ", explicit=" + explicit + ", episodes=" + episodes + ", externalUrls="
+ externalUrls + ", href=" + href + ", id=" + id + ", images=" + Arrays.toString(images)
+ ", isExternallyHosted=" + isExternallyHosted + ", languages=" + Arrays.toString(languages) + ", mediaType="
- + mediaType + ", name=" + name + ", publisher=" + publisher + ", type=" + type + ", uri=" + uri + ")";
+ + mediaType + ", name=" + name + ", type=" + type + ", uri=" + uri + ")";
}
@Override
@@ -239,7 +213,6 @@ public Builder builder() {
* Builder class for building {@link Show} instances.
*/
public static final class Builder extends AbstractModelObject.Builder {
- private CountryCode[] availableMarkets;
private Copyright[] copyrights;
private String description;
private Boolean explicit;
@@ -252,7 +225,6 @@ public static final class Builder extends AbstractModelObject.Builder {
private String[] languages;
private String mediaType;
private String name;
- private String publisher;
private ModelObjectType type;
private String uri;
@@ -263,18 +235,6 @@ public Builder() {
super();
}
- /**
- * Set the available markets of the show to be built.
- *
- * @param availableMarkets A list of the countries in which the show can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- * @return A {@link Show.Builder}.
- */
- public Builder setAvailableMarkets(CountryCode... availableMarkets) {
- this.availableMarkets = availableMarkets;
- return this;
- }
-
/**
* Set the copyrights of the show to be built.
*
@@ -407,17 +367,6 @@ public Builder setName(String name) {
return this;
}
- /**
- * Set the publisher for the show to be built.
- *
- * @param publisher The publisher of the show.
- * @return A {@link Show.Builder}.
- */
- public Builder setPublisher(String publisher) {
- this.publisher = publisher;
- return this;
- }
-
/**
* Set the type of the model object. In this case "show".
*
@@ -465,11 +414,6 @@ public Show createModelObject(JsonObject jsonObject) {
}
return new Builder()
- .setAvailableMarkets(
- hasAndNotNull(jsonObject, "available_markets")
- ? new Gson().fromJson(
- jsonObject.getAsJsonArray("available_markets"), CountryCode[].class)
- : null)
.setCopyrights(
hasAndNotNull(jsonObject, "copyrights")
? new Gson().fromJson(
@@ -523,10 +467,6 @@ public Show createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "name")
? jsonObject.get("name").getAsString()
: null)
- .setPublisher(
- hasAndNotNull(jsonObject, "publisher")
- ? jsonObject.get("publisher").getAsString()
- : null)
.setType(
hasAndNotNull(jsonObject, "type")
? ModelObjectType.keyOf(
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/ShowSimplified.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/ShowSimplified.java
index 1c8cc29d4..f9372f42a 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/ShowSimplified.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/ShowSimplified.java
@@ -3,7 +3,6 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.neovisionaries.i18n.CountryCode;
import se.michaelthelin.spotify.enums.ModelObjectType;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;
import se.michaelthelin.spotify.requests.data.search.interfaces.ISearchModelObject;
@@ -17,8 +16,6 @@
*/
@JsonDeserialize(builder = ShowSimplified.Builder.class)
public class ShowSimplified extends AbstractModelObject implements ISearchModelObject {
- /** A list of the countries in which the show can be played. */
- private final CountryCode[] availableMarkets;
/** The copyright statements of the show. */
private final Copyright[] copyrights;
/** A description of the show. */
@@ -41,8 +38,6 @@ public class ShowSimplified extends AbstractModelObject implements ISearchModelO
private final String mediaType;
/** The name of the show. */
private final String name;
- /** The publisher of the show. */
- private final String publisher;
/** The object type. */
private final ModelObjectType type;
/** The Spotify URI for the show. */
@@ -55,7 +50,6 @@ public class ShowSimplified extends AbstractModelObject implements ISearchModelO
*/
public ShowSimplified(Builder builder) {
super(builder);
- this.availableMarkets = builder.availableMarkets;
this.copyrights = builder.copyrights;
this.description = builder.description;
this.explicit = builder.explicit;
@@ -67,21 +61,10 @@ public ShowSimplified(Builder builder) {
this.languages = builder.languages;
this.mediaType = builder.mediaType;
this.name = builder.name;
- this.publisher = builder.publisher;
this.type = builder.type;
this.uri = builder.uri;
}
- /**
- * Get a list of the countries in which the show can be played.
- *
- * @return An array of ISO 3166-1 alpha-2 country
- * * codes.
- */
- public CountryCode[] getAvailableMarkets() {
- return availableMarkets;
- }
-
/**
* Get the copyright statements of the show.
*
@@ -183,15 +166,6 @@ public String getName() {
return name;
}
- /**
- * Get the publisher of the show.
- *
- * @return The publisher of the show.
- */
- public String getPublisher() {
- return publisher;
- }
-
/**
* Get the model object type. In this case "show".
*
@@ -212,11 +186,11 @@ public String getUri() {
@Override
public String toString() {
- return "ShowSimplified(availableMarkets=" + Arrays.toString(availableMarkets) + ", copyrights="
+ return "ShowSimplified(copyrights="
+ Arrays.toString(copyrights) + ", description=" + description + ", explicit=" + explicit + ", externalUrls="
+ externalUrls + ", href=" + href + ", id=" + id + ", images=" + Arrays.toString(images)
+ ", isExternallyHosted=" + isExternallyHosted + ", languages=" + Arrays.toString(languages) + ", mediaType="
- + mediaType + ", name=" + name + ", publisher=" + publisher + ", type=" + type + ", uri=" + uri + ")";
+ + mediaType + ", name=" + name + ", type=" + type + ", uri=" + uri + ")";
}
@Override
@@ -228,7 +202,6 @@ public Builder builder() {
* Builder class for building {@link ShowSimplified} instances.
*/
public static final class Builder extends AbstractModelObject.Builder {
- private CountryCode[] availableMarkets;
private Copyright[] copyrights;
private String description;
private Boolean explicit;
@@ -240,7 +213,6 @@ public static final class Builder extends AbstractModelObject.Builder {
private String[] languages;
private String mediaType;
private String name;
- private String publisher;
private ModelObjectType type;
private String uri;
@@ -251,18 +223,6 @@ public Builder() {
super();
}
- /**
- * Set the available markets of the show to be built.
- *
- * @param availableMarkets A list of the countries in which the show can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- * @return A {@link ShowSimplified.Builder}.
- */
- public Builder setAvailableMarkets(CountryCode... availableMarkets) {
- this.availableMarkets = availableMarkets;
- return this;
- }
-
/**
* Set the copyrights of the show to be built.
*
@@ -384,17 +344,6 @@ public Builder setName(String name) {
return this;
}
- /**
- * Set the publisher for the show to be built.
- *
- * @param publisher The publisher of the show.
- * @return A {@link ShowSimplified.Builder}.
- */
- public Builder setPublisher(String publisher) {
- this.publisher = publisher;
- return this;
- }
-
/**
* Set the type of the model object. In this case "show".
*
@@ -442,11 +391,6 @@ public ShowSimplified createModelObject(JsonObject jsonObject) {
}
return new Builder()
- .setAvailableMarkets(
- hasAndNotNull(jsonObject, "available_markets")
- ? new Gson().fromJson(
- jsonObject.getAsJsonArray("available_markets"), CountryCode[].class)
- : null)
.setCopyrights(
hasAndNotNull(jsonObject, "copyrights")
? new Gson().fromJson(
@@ -495,10 +439,6 @@ public ShowSimplified createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "name")
? jsonObject.get("name").getAsString()
: null)
- .setPublisher(
- hasAndNotNull(jsonObject, "publisher")
- ? jsonObject.get("publisher").getAsString()
- : null)
.setType(
hasAndNotNull(jsonObject, "type")
? ModelObjectType.keyOf(
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/Track.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/Track.java
index 0386f325e..64cdf541a 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/Track.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/Track.java
@@ -1,9 +1,7 @@
package se.michaelthelin.spotify.model_objects.specification;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.neovisionaries.i18n.CountryCode;
import se.michaelthelin.spotify.enums.ModelObjectType;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;
import se.michaelthelin.spotify.model_objects.IPlaylistItem;
@@ -24,16 +22,12 @@ public class Track extends AbstractModelObject implements IArtistTrackModelObjec
private final AlbumSimplified album;
/** The artists who performed the track. */
private final ArtistSimplified[] artists;
- /** A list of the countries in which the track can be played. */
- private final CountryCode[] availableMarkets;
/** The disc number. */
private final Integer discNumber;
/** The track length in milliseconds. */
private final Integer durationMs;
/** Whether the track is explicit. */
private final Boolean explicit;
- /** External IDs for the track. */
- private final ExternalId externalIds;
/** External URLs for the track. */
private final ExternalUrl externalUrls;
/** The Spotify Web API endpoint URL for the track. */
@@ -42,14 +36,10 @@ public class Track extends AbstractModelObject implements IArtistTrackModelObjec
private final String id;
/** Whether the track is playable. */
private final Boolean isPlayable;
- /** Information about the original track. */
- private final TrackLink linkedFrom;
/** Restrictions on the track. */
private final Restrictions restrictions;
/** The name of the track. */
private final String name;
- /** The popularity of the track. */
- private final Integer popularity;
/** A link to a 30 second preview of the track. */
private final String previewUrl;
/** The number of the track. */
@@ -64,19 +54,15 @@ private Track(final Builder builder) {
this.album = builder.album;
this.artists = builder.artists;
- this.availableMarkets = builder.availableMarkets;
this.discNumber = builder.discNumber;
this.durationMs = builder.durationMs;
this.explicit = builder.explicit;
- this.externalIds = builder.externalIds;
this.externalUrls = builder.externalUrls;
this.href = builder.href;
this.id = builder.id;
this.isPlayable = builder.isPlayable;
- this.linkedFrom = builder.linkedFrom;
this.restrictions = builder.restrictions;
this.name = builder.name;
- this.popularity = builder.popularity;
this.previewUrl = builder.previewUrl;
this.trackNumber = builder.trackNumber;
this.type = builder.type;
@@ -103,16 +89,6 @@ public ArtistSimplified[] getArtists() {
return artists;
}
- /**
- * Get the country codes of all countries, in which the track is available.
- *
- * @return A list of the countries in which the track can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- */
- public CountryCode[] getAvailableMarkets() {
- return availableMarkets;
- }
-
/**
* Get the disc number of the track in its album.
*
@@ -142,16 +118,6 @@ public Boolean getIsExplicit() {
return explicit;
}
- /**
- * Get the external IDs of the track.
- * Example: isrc -> "International Standard Recording Code".
- *
- * @return Known external IDs for the track.
- */
- public ExternalId getExternalIds() {
- return externalIds;
- }
-
/**
* Get the external URLs of the track.
* Example: Spotify-URL.
@@ -195,17 +161,6 @@ public Boolean getIsPlayable() {
return isPlayable;
}
- /**
- * Get the track link object of the track if
- * Track Relinking was applied and the requested track has been replaced with a different track. The track in the
- * {@code linked_from} object contains information about the originally requested track.
- *
- * @return The track in the {@code linked_from} object contains information about the originally requested track.
- */
- public TrackLink getLinkedFrom() {
- return linkedFrom;
- }
-
/**
* Get the restrictions of the track. Part of the response when
* Track Relinking is applied, the original
@@ -231,24 +186,6 @@ public String getName() {
return name;
}
- /**
- * Get the popularity of the track. The value will be between 0 and 100, with 100 being the most popular.
- *
- * The popularity of a track is a value between 0 and 100, with 100 being the most popular. The popularity is
- * calculated by algorithm and is based, in the most part, on the total number of plays the track has had and how
- * recent those plays are.
- *
- * Generally speaking, songs that are being played a lot now will have a higher popularity than songs that were played
- * a lot in the past. Duplicate tracks (e.g. the same track from a single and an album) are rated independently.
- * Artist and album popularity is derived mathematically from track popularity. Note that the popularity value may lag
- * actual popularity by a few days: the value is not updated in real time.
- *
- * @return The popularity of the track. The value will be between 0 and 100, with 100 being the most popular.
- */
- public Integer getPopularity() {
- return popularity;
- }
-
/**
* Get a link to a 30 second preview (MP3 format) of the track. {@code null} if not available.
*
@@ -291,11 +228,11 @@ public String getUri() {
@Override
public String toString() {
- return "Track(name=" + name + ", artists=" + Arrays.toString(artists) + ", album=" + album + ", availableMarkets="
- + Arrays.toString(availableMarkets) + ", discNumber=" + discNumber + ", durationMs=" + durationMs
- + ", explicit=" + explicit + ", externalIds=" + externalIds + ", externalUrls=" + externalUrls + ", href="
- + href + ", id=" + id + ", isPlayable=" + isPlayable + ", linkedFrom=" + linkedFrom + ", restrictions="
- + restrictions + ", popularity=" + popularity + ", previewUrl=" + previewUrl + ", trackNumber=" + trackNumber
+ return "Track(name=" + name + ", artists=" + Arrays.toString(artists) + ", album=" + album
+ + ", discNumber=" + discNumber + ", durationMs=" + durationMs
+ + ", explicit=" + explicit + ", externalUrls=" + externalUrls + ", href="
+ + href + ", id=" + id + ", isPlayable=" + isPlayable + ", restrictions="
+ + restrictions + ", previewUrl=" + previewUrl + ", trackNumber=" + trackNumber
+ ", type=" + type + ", uri=" + uri + ")";
}
@@ -310,19 +247,15 @@ public Builder builder() {
public static final class Builder extends AbstractModelObject.Builder {
private AlbumSimplified album;
private ArtistSimplified[] artists;
- private CountryCode[] availableMarkets;
private Integer discNumber;
private Integer durationMs;
private Boolean explicit;
- private ExternalId externalIds;
private ExternalUrl externalUrls;
private String href;
private String id;
private Boolean isPlayable;
- private TrackLink linkedFrom;
private Restrictions restrictions;
private String name;
- private Integer popularity;
private String previewUrl;
private Integer trackNumber;
private ModelObjectType type;
@@ -357,18 +290,6 @@ public Builder setArtists(ArtistSimplified... artists) {
return this;
}
- /**
- * Set the available markets of the track to be built.
- *
- * @param availableMarkets A list of the countries in which the track can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- * @return A {@link Track.Builder}.
- */
- public Builder setAvailableMarkets(CountryCode... availableMarkets) {
- this.availableMarkets = availableMarkets;
- return this;
- }
-
/**
* Set the disc number of the track to be built.
*
@@ -403,17 +324,6 @@ public Builder setExplicit(Boolean explicit) {
return this;
}
- /**
- * Set the external IDs of the track to be built.
- *
- * @param externalIds Known external IDs for the track.
- * @return A {@link Track.Builder}.
- */
- public Builder setExternalIds(ExternalId externalIds) {
- this.externalIds = externalIds;
- return this;
- }
-
/**
* Set external URLs of the track to be built.
*
@@ -458,18 +368,6 @@ public Builder setIsPlayable(Boolean isPlayable) {
return this;
}
- /**
- * Set the track link object of the track to be built.
- *
- * @param linkedFrom The track in the {@code linked_from} object contains information about the originally requested
- * track.
- * @return A {@link Track.Builder}.
- */
- public Builder setLinkedFrom(TrackLink linkedFrom) {
- this.linkedFrom = linkedFrom;
- return this;
- }
-
/**
* Set the restrictions object of the track to be built.
*
@@ -493,18 +391,6 @@ public Builder setName(String name) {
return this;
}
- /**
- * Set the popularity of the track to be built.
- *
- * @param popularity The popularity of the track. The value will be between 0 and 100, with 100 being the most
- * popular.
- * @return A {@link Track.Builder}.
- */
- public Builder setPopularity(Integer popularity) {
- this.popularity = popularity;
- return this;
- }
-
/**
* Set the preview URL of the track to be built.
*
@@ -584,11 +470,6 @@ public Track createModelObject(JsonObject jsonObject) {
? new ArtistSimplified.JsonUtil().createModelObjectArray(
jsonObject.getAsJsonArray("artists"))
: null)
- .setAvailableMarkets(
- hasAndNotNull(jsonObject, "available_markets")
- ? new Gson().fromJson(
- jsonObject.getAsJsonArray("available_markets"), CountryCode[].class)
- : null)
.setDiscNumber(
hasAndNotNull(jsonObject, "disc_number")
? jsonObject.get("disc_number").getAsInt()
@@ -601,11 +482,6 @@ public Track createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "explicit")
? jsonObject.get("explicit").getAsBoolean()
: null)
- .setExternalIds(
- hasAndNotNull(jsonObject, "external_ids")
- ? new ExternalId.JsonUtil().createModelObject(
- jsonObject.getAsJsonObject("external_ids"))
- : null)
.setExternalUrls(
hasAndNotNull(jsonObject, "external_urls")
? new ExternalUrl.JsonUtil().createModelObject(
@@ -623,11 +499,6 @@ public Track createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "is_playable")
? jsonObject.get("is_playable").getAsBoolean()
: null)
- .setLinkedFrom(
- hasAndNotNull(jsonObject, "linked_from")
- ? new TrackLink.JsonUtil().createModelObject(
- jsonObject.get("linked_from").getAsJsonObject())
- : null)
.setRestrictions(
hasAndNotNull(jsonObject, "restrictions")
? new Restrictions.JsonUtil().createModelObject(
@@ -637,10 +508,6 @@ public Track createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "name")
? jsonObject.get("name").getAsString()
: null)
- .setPopularity(
- hasAndNotNull(jsonObject, "popularity")
- ? jsonObject.get("popularity").getAsInt()
- : null)
.setPreviewUrl(
hasAndNotNull(jsonObject, "preview_url")
? jsonObject.get("preview_url").getAsString()
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/TrackSimplified.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/TrackSimplified.java
index c715cb510..588999ab7 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/TrackSimplified.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/TrackSimplified.java
@@ -1,9 +1,7 @@
package se.michaelthelin.spotify.model_objects.specification;
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.google.gson.Gson;
import com.google.gson.JsonObject;
-import com.neovisionaries.i18n.CountryCode;
import se.michaelthelin.spotify.enums.ModelObjectType;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;
@@ -18,8 +16,6 @@
public class TrackSimplified extends AbstractModelObject {
/** The artists who performed the track. */
private final ArtistSimplified[] artists;
- /** A list of the countries in which the track can be played. */
- private final CountryCode[] availableMarkets;
/** The disc number. */
private final Integer discNumber;
/** The track length in milliseconds. */
@@ -34,8 +30,6 @@ public class TrackSimplified extends AbstractModelObject {
private final String id;
/** Whether the track is playable. */
private final Boolean isPlayable;
- /** Information about the original track. */
- private final TrackLink linkedFrom;
/** The name of the track. */
private final String name;
/** A link to a 30 second preview of the track. */
@@ -51,7 +45,6 @@ private TrackSimplified(final Builder builder) {
super(builder);
this.artists = builder.artists;
- this.availableMarkets = builder.availableMarkets;
this.discNumber = builder.discNumber;
this.durationMs = builder.durationMs;
this.explicit = builder.explicit;
@@ -59,7 +52,6 @@ private TrackSimplified(final Builder builder) {
this.href = builder.href;
this.id = builder.id;
this.isPlayable = builder.isPlayable;
- this.linkedFrom = builder.linkedFrom;
this.name = builder.name;
this.previewUrl = builder.previewUrl;
this.trackNumber = builder.trackNumber;
@@ -77,16 +69,6 @@ public ArtistSimplified[] getArtists() {
return artists;
}
- /**
- * Get the country codes of all countries, in which the track is available.
- *
- * @return A list of the countries in which the track can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- */
- public CountryCode[] getAvailableMarkets() {
- return availableMarkets;
- }
-
/**
* Get the disc number of the track in its album.
*
@@ -155,17 +137,6 @@ public Boolean getIsPlayable() {
return isPlayable;
}
- /**
- * Get the track link object of the track if
- * Track Relinking was applied and the requested track has been replaced with a different track. The track in the
- * {@code linked_from} object contains information about the originally requested track.
- *
- * @return The track in the {@code linked_from} object contains information about the originally requested track.
- */
- public TrackLink getLinkedFrom() {
- return linkedFrom;
- }
-
/**
* Get the name of a track.
*
@@ -215,10 +186,9 @@ public String getUri() {
@Override
public String toString() {
- return "TrackSimplified(name=" + name + ", artists=" + Arrays.toString(artists) + ", availableMarkets="
- + Arrays.toString(availableMarkets) + ", discNumber=" + discNumber + ", durationMs=" + durationMs
- + ", explicit=" + explicit + ", externalUrls=" + externalUrls + ", href=" + href + ", id=" + id
- + ", isPlayable=" + isPlayable + ", linkedFrom=" + linkedFrom + ", previewUrl=" + previewUrl + ", trackNumber="
+ return "TrackSimplified(name=" + name + ", artists=" + Arrays.toString(artists) + ", discNumber=" + discNumber
+ + ", durationMs=" + durationMs + ", explicit=" + explicit + ", externalUrls=" + externalUrls + ", href=" + href
+ + ", id=" + id + ", isPlayable=" + isPlayable + ", previewUrl=" + previewUrl + ", trackNumber="
+ trackNumber + ", type=" + type + ", uri=" + uri + ")";
}
@@ -232,7 +202,6 @@ public Builder builder() {
*/
public static final class Builder extends AbstractModelObject.Builder {
private ArtistSimplified[] artists;
- private CountryCode[] availableMarkets;
private Integer discNumber;
private Integer durationMs;
private Boolean explicit;
@@ -240,7 +209,6 @@ public static final class Builder extends AbstractModelObject.Builder {
private String href;
private String id;
private Boolean isPlayable;
- private TrackLink linkedFrom;
private String name;
private String previewUrl;
private Integer trackNumber;
@@ -265,18 +233,6 @@ public Builder setArtists(ArtistSimplified... artists) {
return this;
}
- /**
- * Set the available markets of the track to be built.
- *
- * @param availableMarkets A list of the countries in which the track can be played, identified by their
- * ISO 3166-1 alpha-2 code.
- * @return A {@link TrackSimplified.Builder}.
- */
- public Builder setAvailableMarkets(CountryCode... availableMarkets) {
- this.availableMarkets = availableMarkets;
- return this;
- }
-
/**
* Set the disc number of the track to be built.
*
@@ -355,18 +311,6 @@ public Builder setIsPlayable(Boolean isPlayable) {
return this;
}
- /**
- * Set the track link object of the track to be built.
- *
- * @param linkedFrom The track in the {@code linked_from} object contains information about the originally requested
- * track.
- * @return A {@link TrackSimplified.Builder}.
- */
- public Builder setLinkedFrom(TrackLink linkedFrom) {
- this.linkedFrom = linkedFrom;
- return this;
- }
-
/**
* Set the name of the track to be built.
*
@@ -452,11 +396,6 @@ public TrackSimplified createModelObject(JsonObject jsonObject) {
? new ArtistSimplified.JsonUtil().createModelObjectArray(
jsonObject.getAsJsonArray("artists"))
: null)
- .setAvailableMarkets(
- hasAndNotNull(jsonObject, "available_markets")
- ? new Gson().fromJson(jsonObject.getAsJsonArray(
- "available_markets"), CountryCode[].class)
- : null)
.setDiscNumber(
hasAndNotNull(jsonObject, "disc_number")
? jsonObject.get("disc_number").getAsInt()
@@ -486,11 +425,6 @@ public TrackSimplified createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "is_playable")
? jsonObject.get("is_playable").getAsBoolean()
: null)
- .setLinkedFrom(
- hasAndNotNull(jsonObject, "linked_from")
- ? new TrackLink.JsonUtil().createModelObject(
- jsonObject.get("linked_from").getAsJsonObject())
- : null)
.setName(
hasAndNotNull(jsonObject, "name")
? jsonObject.get("name").getAsString()
diff --git a/src/main/java/se/michaelthelin/spotify/model_objects/specification/User.java b/src/main/java/se/michaelthelin/spotify/model_objects/specification/User.java
index d502fdd3a..d09c3bc29 100644
--- a/src/main/java/se/michaelthelin/spotify/model_objects/specification/User.java
+++ b/src/main/java/se/michaelthelin/spotify/model_objects/specification/User.java
@@ -2,9 +2,7 @@
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.google.gson.JsonObject;
-import com.neovisionaries.i18n.CountryCode;
import se.michaelthelin.spotify.enums.ModelObjectType;
-import se.michaelthelin.spotify.enums.ProductType;
import se.michaelthelin.spotify.model_objects.AbstractModelObject;
import java.util.Arrays;
@@ -22,24 +20,16 @@
public class User extends AbstractModelObject {
/** The user's birthdate. */
private final String birthdate;
- /** The country of the user. */
- private final CountryCode country;
/** The name displayed on the user's profile. */
private final String displayName;
- /** The user's email address. */
- private final String email;
/** External URLs for the user. */
private final ExternalUrl externalUrls;
- /** Information about the followers of the user. */
- private final Followers followers;
/** The Spotify Web API endpoint URL for the user. */
private final String href;
/** The Spotify user ID for the user. */
private final String id;
/** The user's profile image. */
private final Image[] images;
- /** The user's Spotify subscription level. */
- private final ProductType product;
/** The object type. */
private final ModelObjectType type;
/** The Spotify URI for the user. */
@@ -49,15 +39,11 @@ private User(final Builder builder) {
super(builder);
this.birthdate = builder.birthdate;
- this.country = builder.country;
this.displayName = builder.displayName;
- this.email = builder.email;
this.externalUrls = builder.externalUrls;
- this.followers = builder.followers;
this.href = builder.href;
this.id = builder.id;
this.images = builder.images;
- this.product = builder.product;
this.type = builder.type;
this.uri = builder.uri;
}
@@ -74,18 +60,6 @@ public String getBirthdate() {
return birthdate;
}
- /**
- * Get the country code of the users set home country.
- * Note: This field is only available when the current user has granted access to the {@code user-read-private}
- * scope.
- *
- * @return An ISO 3166-1 alpha-2 country code.
- * @see Spotify: Using Scopes
- */
- public CountryCode getCountry() {
- return country;
- }
-
/**
* Get the users display name if available.
* If the display name is not available, {@code null} will be returned.
@@ -96,19 +70,6 @@ public String getDisplayName() {
return displayName;
}
- /**
- * Get the users email address.
- * Important! This email address is unverified; there is no proof that it actually belongs to the user.
- * Note: This field is only available when the current user has granted access to the {@code user-read-email}
- * scope.
- *
- * @return The user's email address, as entered by the user when creating their account.
- * @see Spotify: Using Scopes
- */
- public String getEmail() {
- return email;
- }
-
/**
* Get the external URLs of the user.
* Example: Spotify-URL.
@@ -119,16 +80,6 @@ public ExternalUrl getExternalUrls() {
return externalUrls;
}
- /**
- * Get information about the followers of the user.
- * Example: Follower count.
- *
- * @return Information about the followers of the user.
- */
- public Followers getFollowers() {
- return followers;
- }
-
/**
* Get the Spotify Web API endpoint URL of the user.
*
@@ -157,19 +108,6 @@ public Image[] getImages() {
return images;
}
- /**
- * Get the product type of the users account.
- * Product type refers to premium account, free account, etc.
- * Note: This field is only available when the current user has granted access to the {@code user-read-private}
- * scope.
- *
- * @return The user's Spotify subscription level: "premium", "free", etc.
- * @see Spotify: Using Scopes
- */
- public ProductType getProduct() {
- return product;
- }
-
/**
* Get the model object type. In this case "user".
*
@@ -191,9 +129,9 @@ public String getUri() {
@Override
public String toString() {
- return "User(birthdate=" + birthdate + ", country=" + country + ", displayName=" + displayName + ", email=" + email
- + ", externalUrls=" + externalUrls + ", followers=" + followers + ", href=" + href + ", id=" + id + ", images="
- + Arrays.toString(images) + ", product=" + product + ", type=" + type + ", uri=" + uri + ")";
+ return "User(birthdate=" + birthdate + ", displayName=" + displayName
+ + ", externalUrls=" + externalUrls + ", href=" + href + ", id=" + id + ", images="
+ + Arrays.toString(images) + ", type=" + type + ", uri=" + uri + ")";
}
@Override
@@ -206,15 +144,11 @@ public Builder builder() {
*/
public static final class Builder extends AbstractModelObject.Builder {
private String birthdate;
- private CountryCode country;
private String displayName;
- private String email;
private ExternalUrl externalUrls;
- private Followers followers;
private String href;
private String id;
private Image[] images;
- private ProductType product;
private ModelObjectType type;
private String uri;
@@ -236,17 +170,6 @@ public Builder setBirthdate(String birthdate) {
return this;
}
- /**
- * Set the home country of the user object to be built.
- *
- * @param country An ISO 3166-1 alpha-2 country code.
- * @return A {@link User.Builder}.
- */
- public Builder setCountry(CountryCode country) {
- this.country = country;
- return this;
- }
-
/**
* Set the display name of the user to be built. If the user hasn't a display name, set {@code null} instead.
*
@@ -258,17 +181,6 @@ public Builder setDisplayName(String displayName) {
return this;
}
- /**
- * Set the email address of the user to be built.
- *
- * @param email The user's email address, as entered by the user when creating their account.
- * @return A {@link User.Builder}.
- */
- public Builder setEmail(String email) {
- this.email = email;
- return this;
- }
-
/**
* Set external urls of the user to be built.
*
@@ -280,17 +192,6 @@ public Builder setExternalUrls(ExternalUrl externalUrls) {
return this;
}
- /**
- * Set the followers object of the user to be built.
- *
- * @param followers Information about the followers of the user.
- * @return A {@link User.Builder}.
- */
- public Builder setFollowers(Followers followers) {
- this.followers = followers;
- return this;
- }
-
/**
* Set href of Spotify api endpoint of the user to be built.
*
@@ -325,17 +226,6 @@ public Builder setImages(Image... images) {
return this;
}
- /**
- * Set the product type of the user to be built.
- *
- * @param product The user's Spotify subscription level: "premium", "free", etc.
- * @return A {@link User.Builder}.
- */
- public Builder setProduct(ProductType product) {
- this.product = product;
- return this;
- }
-
/**
* Set the type of the model object. In this case "user".
*
@@ -386,29 +276,15 @@ public User createModelObject(JsonObject jsonObject) {
hasAndNotNull(jsonObject, "birthdate")
? jsonObject.get("birthdate").getAsString()
: null)
- .setCountry(
- hasAndNotNull(jsonObject, "country")
- ? CountryCode.getByCode(
- jsonObject.get("country").getAsString())
- : null)
.setDisplayName(
hasAndNotNull(jsonObject, "display_name")
? jsonObject.get("display_name").getAsString()
: null)
- .setEmail(
- hasAndNotNull(jsonObject, "email")
- ? jsonObject.get("email").getAsString()
- : null)
.setExternalUrls(
hasAndNotNull(jsonObject, "external_urls")
? new ExternalUrl.JsonUtil().createModelObject(
jsonObject.getAsJsonObject("external_urls"))
: null)
- .setFollowers(
- hasAndNotNull(jsonObject, "followers")
- ? new Followers.JsonUtil().createModelObject(
- jsonObject.getAsJsonObject("followers"))
- : null)
.setHref(
hasAndNotNull(jsonObject, "href")
? jsonObject.get("href").getAsString()
@@ -422,11 +298,6 @@ public User createModelObject(JsonObject jsonObject) {
? new Image.JsonUtil().createModelObjectArray(
jsonObject.getAsJsonArray("images"))
: null)
- .setProduct(
- hasAndNotNull(jsonObject, "product")
- ? ProductType.keyOf(
- jsonObject.get("product").getAsString().toLowerCase())
- : null)
.setType(
hasAndNotNull(jsonObject, "type")
? ModelObjectType.keyOf(
diff --git a/src/main/java/se/michaelthelin/spotify/requests/data/albums/GetSeveralAlbumsRequest.java b/src/main/java/se/michaelthelin/spotify/requests/data/albums/GetSeveralAlbumsRequest.java
deleted file mode 100644
index 4047b38f3..000000000
--- a/src/main/java/se/michaelthelin/spotify/requests/data/albums/GetSeveralAlbumsRequest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-package se.michaelthelin.spotify.requests.data.albums;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.neovisionaries.i18n.CountryCode;
-import org.apache.hc.core5.http.ParseException;
-import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
-import se.michaelthelin.spotify.model_objects.specification.Album;
-import se.michaelthelin.spotify.requests.data.AbstractDataRequest;
-
-import java.io.IOException;
-
-/**
- * Get Spotify catalog information for multiple albums identified by their Spotify IDs.
- */
-@JsonDeserialize(builder = GetSeveralAlbumsRequest.Builder.class)
-public class GetSeveralAlbumsRequest extends AbstractDataRequest {
-
- /**
- * The private {@link GetSeveralAlbumsRequest} constructor.
- *
- * @param builder A {@link GetSeveralAlbumsRequest.Builder}.
- */
- private GetSeveralAlbumsRequest(final Builder builder) {
- super(builder);
- }
-
- /**
- * Get multiple albums.
- *
- * @return An array containing albums.
- * @throws IOException In case of networking issues.
- * @throws SpotifyWebApiException The Web API returned an error further specified in this exception's root cause.
- */
- public Album[] execute() throws
- IOException,
- SpotifyWebApiException,
- ParseException {
- return new Album.JsonUtil().createModelObjectArray(getJson(), "albums");
- }
-
- /**
- * Builder class for building a {@link GetSeveralAlbumsRequest}.
- */
- public static final class Builder extends AbstractDataRequest.Builder {
-
- /**
- * Create a new {@link GetSeveralAlbumsRequest.Builder} instance.
- *
- * @param accessToken Required. A valid access token from the Spotify Accounts service.
- */
- public Builder(final String accessToken) {
- super(accessToken);
- }
-
- /**
- * The IDs query parameter setter.
- *
- * @param ids Required. A comma-separated list of the Spotify IDs for the albums. Maximum: 20 IDs.
- * @return A {@link GetSeveralAlbumsRequest.Builder}.
- * @see Spotify URIs & IDs
- */
- public Builder ids(final String ids) {
- assert (ids != null);
- assert (ids.split(",").length <= 20);
- return setQueryParameter("ids", ids);
- }
-
- /**
- * The market query parameter setter.
- *
- * @param market Optional. An ISO 3166-1 alpha-2 country code. Provide this parameter if you want to apply Track
- * Relinking.
- * @return A {@link GetSeveralAlbumsRequest.Builder}.
- * @see Wikipedia: ISO 3166-1 alpha-2 country codes
- * @see Spotify: Track Relinking Guide
- */
- public Builder market(final CountryCode market) {
- assert (market != null);
- return setQueryParameter("market", market);
- }
-
- /**
- * The request build method.
- *
- * @return A custom {@link GetSeveralAlbumsRequest}.
- */
- @Override
- public GetSeveralAlbumsRequest build() {
- setPath("/v1/albums");
- return new GetSeveralAlbumsRequest(this);
- }
-
- @Override
- protected Builder self() {
- return this;
- }
- }
-}
diff --git a/src/main/java/se/michaelthelin/spotify/requests/data/artists/GetArtistsTopTracksRequest.java b/src/main/java/se/michaelthelin/spotify/requests/data/artists/GetArtistsTopTracksRequest.java
deleted file mode 100644
index a819cbdb2..000000000
--- a/src/main/java/se/michaelthelin/spotify/requests/data/artists/GetArtistsTopTracksRequest.java
+++ /dev/null
@@ -1,96 +0,0 @@
-package se.michaelthelin.spotify.requests.data.artists;
-
-import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
-import com.neovisionaries.i18n.CountryCode;
-import org.apache.hc.core5.http.ParseException;
-import se.michaelthelin.spotify.exceptions.SpotifyWebApiException;
-import se.michaelthelin.spotify.model_objects.specification.Track;
-import se.michaelthelin.spotify.requests.data.AbstractDataRequest;
-
-import java.io.IOException;
-
-/**
- * Get Spotify catalog information about an artist’s top tracks by country.
- */
-@JsonDeserialize(builder = GetArtistsTopTracksRequest.Builder.class)
-public class GetArtistsTopTracksRequest extends AbstractDataRequest