Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions examples/data/follow/CheckUsersFollowPlaylistExample.java
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,14 @@

public class CheckUsersFollowPlaylistExample {
private static final String accessToken = "taHZ2SdB-bPA3FsK3D7ZN5npZS47cMy-IEySVEGttOhXmqaVAIo0ESvTCLjLBifhHOHOIuhFUKPW1WMDP7w6dj3MAZdWT8CLI2MkZaXbYLTeoDvXesf2eeiLYPBGdx8tIwQJKgV8XdnzH_DONk";
private static final String ownerId = "abbaspotify";
private static final String playlistId = "3AGOiaoRXMSjswCLtuNqv5";
private static final String[] ids = new String[]{"abbaspotify"};

private static final SpotifyApi spotifyApi = new SpotifyApi.Builder()
.setAccessToken(accessToken)
.build();
private static final CheckUsersFollowPlaylistRequest checkUsersFollowPlaylistRequest = spotifyApi
.checkUsersFollowPlaylist(ownerId, playlistId, ids)
.checkUsersFollowPlaylist(playlistId, ids)
.build();

public static void checkUsersFollowPlaylist_Sync() {
Expand Down
20 changes: 20 additions & 0 deletions src/main/java/se/michaelthelin/spotify/SpotifyApi.java
Original file line number Diff line number Diff line change
Expand Up @@ -776,7 +776,10 @@ public CheckCurrentUserFollowsArtistsOrUsersRequest.Builder checkCurrentUserFoll
* follow the playlist. Maximum: 5 IDs.
* @return A {@link CheckUsersFollowPlaylistRequest.Builder}.
* @see <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify: URLs &amp; IDs</a>
*
* @deprecated since the endpoint no longer needs the owner_id param. Use {@link #checkUsersFollowPlaylist(String, String[])} instead.
*/
@Deprecated(since = "8.3.7")
public CheckUsersFollowPlaylistRequest.Builder checkUsersFollowPlaylist(
String owner_id, String playlist_id, String[] ids) {
return new CheckUsersFollowPlaylistRequest.Builder(accessToken)
Expand All @@ -786,6 +789,23 @@ public CheckUsersFollowPlaylistRequest.Builder checkUsersFollowPlaylist(
.ids(concat(ids, ','));
}

/**
* Check to see if one or more Spotify users are following a specified playlist.
*
* @param playlist_id The Spotify ID of the playlist.
* @param ids A list of Spotify User IDs; the IDs of the users that you want to check to see if they
* follow the playlist. Maximum: 5 IDs.
* @return A {@link CheckUsersFollowPlaylistRequest.Builder}.
* @see <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify: URLs &amp; IDs</a>
*/
public CheckUsersFollowPlaylistRequest.Builder checkUsersFollowPlaylist(
String playlist_id, String[] ids) {
return new CheckUsersFollowPlaylistRequest.Builder(accessToken)
.setDefaults(httpManager, scheme, host, port)
.playlist_id(playlist_id)
.ids(concat(ids, ','));
}

/**
* Add the current user as a follower of one or more artists or other Spotify users.
*
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,10 @@ public Builder(final String accessToken) {
* @param owner_id The Spotify user ID of the person who owns the playlist.
* @return A {@link CheckUsersFollowPlaylistRequest.Builder}.
* @see <a href="https://developer.spotify.com/documentation/web-api/concepts/spotify-uris-ids">Spotify: URIs &amp; IDs</a>
*
* @deprecated since the endpoint no longer needs it.
*/
@Deprecated(since = "8.3.7")
public Builder owner_id(final String owner_id) {
assert (owner_id != null);
assert (!owner_id.isEmpty());
Expand Down Expand Up @@ -106,7 +109,7 @@ public Builder ids(final String ids) {
*/
@Override
public CheckUsersFollowPlaylistRequest build() {
setPath("/v1/users/{owner_id}/playlists/{playlist_id}/followers/contains");
setPath("/v1/playlists/{playlist_id}/followers/contains");
return new CheckUsersFollowPlaylistRequest(this);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

public class CheckUsersFollowPlaylistRequestTest extends AbstractDataTest<Boolean[]> {
private final CheckUsersFollowPlaylistRequest defaultRequest = SPOTIFY_API
.checkUsersFollowPlaylist(ID_USER, ID_PLAYLIST, new String[]{ID_USER, ID_USER})
.checkUsersFollowPlaylist(ID_PLAYLIST, new String[]{ID_USER, ID_USER})
.setHttpManager(
TestUtil.MockedHttpManager.returningJson(
"requests/data/follow/CheckUsersFollowPlaylistRequest.json"))
Expand All @@ -26,7 +26,7 @@ public CheckUsersFollowPlaylistRequestTest() throws Exception {
public void shouldComplyWithReference() {
assertHasAuthorizationHeader(defaultRequest);
assertEquals(
"https://api.spotify.com:443/v1/users/abbaspotify/playlists/3AGOiaoRXMSjswCLtuNqv5/followers/contains?ids=abbaspotify%2Cabbaspotify",
"https://api.spotify.com:443/v1/playlists/3AGOiaoRXMSjswCLtuNqv5/followers/contains?ids=abbaspotify%2Cabbaspotify",
defaultRequest.getUri().toString());
}

Expand Down