de.sonallux.spotify.api.apis.playlists.ChangePlaylistDetailsRequest 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.*;
/**
* Change Playlist Details request
*
* Required OAuth scopes
* playlist-modify-public, playlist-modify-private
*
* Response
* Playlist updated
*/
public class ChangePlaylistDetailsRequest {
private static final TypeReference RESPONSE_TYPE = new TypeReference<>() {};
private final ApiClient apiClient;
private final Request request;
/**
* Change Playlist Details request
* @param apiClient The API client
* @param playlistId The Spotify ID of the playlist.
*/
public ChangePlaylistDetailsRequest(ApiClient apiClient, String playlistId) {
this.apiClient = apiClient;
this.request = new Request("PUT", "/playlists/{playlist_id}")
.addPathParameter("playlist_id", String.valueOf(playlistId))
;
}
/**
* @param name The new name for the playlist, for example "My New Playlist Title"
* @return this request
*/
public ChangePlaylistDetailsRequest name(String name) {
this.request.addBodyParameter("name", name);
return this;
}
/**
* @param _public The playlist's public/private status (if it should be added to the user's profile or not): true
the playlist will be public, false
the playlist will be private, null
the playlist status is not relevant. For more about public/private status, see Working with Playlists
* @return this request
*/
public ChangePlaylistDetailsRequest _public(boolean _public) {
this.request.addBodyParameter("public", _public);
return this;
}
/**
* @param collaborative If true
, the playlist will become collaborative and other users will be able to modify the playlist in their Spotify client.
Note: You can only set collaborative
to true
on non-public playlists.
* @return this request
*/
public ChangePlaylistDetailsRequest collaborative(boolean collaborative) {
this.request.addBodyParameter("collaborative", collaborative);
return this;
}
/**
* @param description Value for playlist description as displayed in Spotify Clients and in the Web API.
* @return this request
*/
public ChangePlaylistDetailsRequest description(String description) {
this.request.addBodyParameter("description", description);
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