de.sonallux.spotify.api.apis.playlists.RemoveTracksPlaylistRequest Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of spotify-web-api-java Show documentation
Show all versions of spotify-web-api-java Show documentation
A Java wrapper for Spotify's Web API
The newest version!
package de.sonallux.spotify.api.apis.playlists;
import com.fasterxml.jackson.core.type.TypeReference;
import de.sonallux.spotify.api.http.ApiCall;
import de.sonallux.spotify.api.http.ApiClient;
import de.sonallux.spotify.api.http.Request;
import de.sonallux.spotify.api.models.*;
/**
* Remove Playlist Items request
*
* Required OAuth scopes
* playlist-modify-public, playlist-modify-private
*
* Response
* A snapshot ID for the playlist
*/
public class RemoveTracksPlaylistRequest {
private static final TypeReference RESPONSE_TYPE = new TypeReference<>() {};
private final ApiClient apiClient;
private final Request request;
/**
* Remove Playlist Items request
* @param apiClient The API client
* @param playlistId The Spotify ID of the playlist.
* @param 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.
*/
public RemoveTracksPlaylistRequest(ApiClient apiClient, String playlistId, java.util.List> tracks) {
this.apiClient = apiClient;
this.request = new Request("DELETE", "/playlists/{playlist_id}/tracks")
.addPathParameter("playlist_id", String.valueOf(playlistId))
.addBodyParameter("tracks", tracks)
;
}
/**
* @param snapshotId The playlist's snapshot ID against which you want to make the changes. The API will validate that the specified items exist and in the specified positions and make the changes, even if more recent changes have been made to the playlist.
* @return this request
*/
public RemoveTracksPlaylistRequest snapshotId(String snapshotId) {
this.request.addBodyParameter("snapshot_id", snapshotId);
return this;
}
/**
* Build the request into an executable api call
* @return an executable api call
*/
public ApiCall build() {
return apiClient.createApiCall(request, RESPONSE_TYPE);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy