Class PlaylistsApi

java.lang.Object
de.sonallux.spotify.api.apis.PlaylistsApi

public class PlaylistsApi extends Object
Playlists
  • Constructor Details

    • PlaylistsApi

      public PlaylistsApi()
  • Method Details

    • addTracksToPlaylist

      public AddTracksToPlaylistRequest addTracksToPlaylist(String playlistId, List<String> uris)

      Add Items to Playlist

      Add one or more items to a user's playlist.

      Parameters:
      playlistId -

      The Spotify ID of 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 the uris parameter is present in the query string, any URIs listed here in the body will be ignored.

      Returns:
      a AddTracksToPlaylistRequest object to build and execute the request
    • changePlaylistDetails

      public ChangePlaylistDetailsRequest changePlaylistDetails(String playlistId)

      Change Playlist Details

      Change a playlist's name and public/private state. (The user must, of course, own the playlist.)

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      Returns:
      a ChangePlaylistDetailsRequest object to build and execute the request
    • createPlaylist

      public CreatePlaylistRequest createPlaylist(String userId, String name)

      Create 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 CreatePlaylistRequest object to build and execute the request
    • getCategoriesPlaylists

      public GetCategoriesPlaylistsRequest getCategoriesPlaylists(String categoryId)

      Get Category's Playlists

      Get a list of Spotify playlists tagged with a particular category.

      Parameters:
      categoryId -

      The Spotify category ID for the category.

      Returns:
      a GetCategoriesPlaylistsRequest object to build and execute the request
    • getFeaturedPlaylists

      public GetFeaturedPlaylistsRequest getFeaturedPlaylists()

      Get Featured Playlists

      Get a list of Spotify featured playlists (shown, for example, on a Spotify player's 'Browse' tab).

      Returns:
      a GetFeaturedPlaylistsRequest object to build and execute the request
    • getListOfCurrentUsersPlaylists

      public GetListOfCurrentUsersPlaylistsRequest getListOfCurrentUsersPlaylists()

      Get Current User's Playlists

      Get a list of the playlists owned or followed by the current Spotify user.

      Returns:
      a GetListOfCurrentUsersPlaylistsRequest object to build and execute the request
    • getListUsersPlaylists

      public GetListUsersPlaylistsRequest getListUsersPlaylists(String userId)

      Get 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 GetListUsersPlaylistsRequest object to build and execute the request
    • getPlaylist

      public GetPlaylistRequest getPlaylist(String playlistId)

      Get Playlist

      Get a playlist owned by a Spotify user.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      Returns:
      a GetPlaylistRequest object to build and execute the request
    • getPlaylistCover

      public GetPlaylistCoverRequest getPlaylistCover(String playlistId)

      Get Playlist Cover Image

      Get the current image associated with a specific playlist.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      Returns:
      a GetPlaylistCoverRequest object to build and execute the request
    • getPlaylistsTracks

      public GetPlaylistsTracksRequest getPlaylistsTracks(String playlistId)

      Get Playlist Items

      Get full details of the items of a playlist owned by a Spotify user.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      Returns:
      a GetPlaylistsTracksRequest object to build and execute the request
    • removeTracksPlaylist

      public RemoveTracksPlaylistRequest removeTracksPlaylist(String playlistId, List<Map<String,Object>> tracks)

      Remove Playlist Items

      Remove one or more items from a user's playlist.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      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 RemoveTracksPlaylistRequest object to build and execute the request
    • reorderPlaylistsTracks

      public ReorderPlaylistsTracksRequest reorderPlaylistsTracks(String playlistId, int rangeStart, int insertBefore)

      Reorder Playlist Items

      Reorder items in a playlist

      Parameters:
      playlistId -

      The Spotify ID of 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 ReorderPlaylistsTracksRequest object to build and execute the request
    • replacePlaylistsTracks

      public ReplacePlaylistsTracksRequest replacePlaylistsTracks(String playlistId, List<String> uris)

      Replace Playlist Items

      Replacing items in a playlist will overwrite its existing items. This operation can be used for replacing or clearing items in a playlist.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      uris -
      Returns:
      a ReplacePlaylistsTracksRequest object to build and execute the request
    • uploadCustomPlaylistCover

      public UploadCustomPlaylistCoverRequest uploadCustomPlaylistCover(String playlistId, String base64Image)

      Add Custom Playlist Cover Image

      Replace the image used to represent a specific playlist.

      Parameters:
      playlistId -

      The Spotify ID of the playlist.

      base64Image -

      Base64 encoded JPEG image data, maximum payload size is 256 KB.

      Returns:
      a UploadCustomPlaylistCoverRequest object to build and execute the request