Class PlaylistsApi
- java.lang.Object
-
- de.sonallux.spotify.api.apis.PlaylistsApi
-
public class PlaylistsApi extends Object
-
-
Constructor Summary
Constructors Constructor Description PlaylistsApi()
-
Method Summary
-
-
-
Method Detail
-
addTracksToPlaylist
public AddTracksToPlaylistRequest addTracksToPlaylist(String playlistId, List<String> uris)
Add Items to a Playlist
Add one or more items to a user's playlist.
- Parameters:
playlistId-The Spotify ID for the playlist.
uris-A JSON array of the Spotify URIs to add. For example:
{"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh","spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
A maximum of 100 items can be added in one request. Note: if theurisparameter is present in the query string, any URIs listed here in the body will be ignored.- Returns:
- a
AddTracksToPlaylistRequestobject to build and execute the request
-
changePlaylistDetails
public ChangePlaylistDetailsRequest changePlaylistDetails(String playlistId)
Change a Playlist's Details
Change a playlist's name and public/private state. (The user must, of course, own the playlist.)
- Parameters:
playlistId-The Spotify ID for the playlist.
- Returns:
- a
ChangePlaylistDetailsRequestobject to build and execute the request
-
createPlaylist
public CreatePlaylistRequest createPlaylist(String userId, String name)
Create a Playlist
Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
- Parameters:
userId-The user's Spotify user ID.
name-The name for the new playlist, for example
"Your Coolest Playlist". This name does not need to be unique; a user may have several playlists with the same name.- Returns:
- a
CreatePlaylistRequestobject to build and execute the request
-
getListOfCurrentUsersPlaylists
public GetListOfCurrentUsersPlaylistsRequest getListOfCurrentUsersPlaylists()
Get a List of Current User's Playlists
Get a list of the playlists owned or followed by the current Spotify user.
- Returns:
- a
GetListOfCurrentUsersPlaylistsRequestobject to build and execute the request
-
getListUsersPlaylists
public GetListUsersPlaylistsRequest getListUsersPlaylists(String userId)
Get a List of a User's Playlists
Get a list of the playlists owned or followed by a Spotify user.
- Parameters:
userId-The user's Spotify user ID.
- Returns:
- a
GetListUsersPlaylistsRequestobject to build and execute the request
-
getPlaylist
public GetPlaylistRequest getPlaylist(String playlistId)
Get a Playlist
Get a playlist owned by a Spotify user.
- Parameters:
playlistId-The Spotify ID for the playlist.
- Returns:
- a
GetPlaylistRequestobject to build and execute the request
-
getPlaylistCover
public GetPlaylistCoverRequest getPlaylistCover(String playlistId)
Get a Playlist Cover Image
Get the current image associated with a specific playlist.
- Parameters:
playlistId-The Spotify ID for the playlist.
- Returns:
- a
GetPlaylistCoverRequestobject to build and execute the request
-
getPlaylistsTracks
public GetPlaylistsTracksRequest getPlaylistsTracks(String playlistId)
Get a Playlist's Items
Get full details of the items of a playlist owned by a Spotify user.
- Parameters:
playlistId-The Spotify ID for the playlist.
- Returns:
- a
GetPlaylistsTracksRequestobject to build and execute the request
-
removeTracksPlaylist
public RemoveTracksPlaylistRequest removeTracksPlaylist(String playlistId, List<Map<String,Object>> tracks)
Remove Items from a Playlist
Remove one or more items from a user's playlist.
- Parameters:
playlistId-The Spotify ID
tracks-An array of objects containing Spotify URIs of the tracks or episodes to remove. For example:
{ "tracks": [{ "uri": "spotify:track:4iV5W9uYEdYUVa79Axb7Rh" },{ "uri": "spotify:track:1301WleyT98MSxVHPZCA6M" }] }. A maximum of 100 objects can be sent at once.- Returns:
- a
RemoveTracksPlaylistRequestobject to build and execute the request
-
reorderPlaylistsTracks
public ReorderPlaylistsTracksRequest reorderPlaylistsTracks(String playlistId, int rangeStart, int insertBefore)
Reorder items in a playlist
Reorder an item or a group of items in a playlist.
- Parameters:
playlistId-The Spotify ID for the playlist.
rangeStart-The position of the first item to be reordered.
insertBefore-The position where the items should be inserted.
To reorder the items to the end of the playlist, simply set insert_before to the position after the last item.
Examples:
To reorder the first item to the last position in a playlist with 10 items, set range_start to 0, and insert_before to 10.
To reorder the last item in a playlist with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.- Returns:
- a
ReorderPlaylistsTracksRequestobject to build and execute the request
-
replacePlaylistsTracks
public ReplacePlaylistsTracksRequest replacePlaylistsTracks(String playlistId, List<String> uris)
Replace items in a playlist
Replace all the items in a playlist, overwriting its existing items. This powerful request can be useful for replacing items, re-ordering existing items, or clearing the playlist.
- Parameters:
playlistId-The Spotify ID for the playlist.
uris-A comma-separated list of Spotify URIs to set, can be track or episode URIs. For example:
uris=spotify:track:4iV5W9uYEdYUVa79Axb7Rh,spotify:track:1301WleyT98MSxVHPZCA6M,spotify:episode:512ojhOuo1ktJprKbVcKyQ
A maximum of 100 items can be set in one request.- Returns:
- a
ReplacePlaylistsTracksRequestobject to build and execute the request
-
uploadCustomPlaylistCover
public UploadCustomPlaylistCoverRequest uploadCustomPlaylistCover(String playlistId, String base64Image)
Upload a Custom Playlist Cover Image
Replace the image used to represent a specific playlist.
- Parameters:
playlistId-The Spotify ID for the playlist.
base64Image-The new cover image of the playlist as a Base64 encoded JPEG image. Maximum payload size is 256KB.
- Returns:
- a
UploadCustomPlaylistCoverRequestobject to build and execute the request
-
-