de.sonallux.spotify.api.apis.playlists.UploadCustomPlaylistCoverRequest 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.*;
/**
* Add Custom Playlist Cover Image request
*
* Required OAuth scopes
* ugc-image-upload, playlist-modify-public, playlist-modify-private
*
* Response
* Image uploaded
*/
public class UploadCustomPlaylistCoverRequest {
private static final TypeReference RESPONSE_TYPE = new TypeReference<>() {};
private final ApiClient apiClient;
private final Request request;
/**
* Add Custom Playlist Cover Image request
* @param apiClient The API client
* @param playlistId The Spotify ID of the playlist.
* @param base64Image Base64 encoded JPEG image data, maximum payload size is 256 KB.
*/
public UploadCustomPlaylistCoverRequest(ApiClient apiClient, String playlistId, String base64Image) {
this.apiClient = apiClient;
this.request = new Request("PUT", "/playlists/{playlist_id}/images")
.addPathParameter("playlist_id", String.valueOf(playlistId))
.withRawBody(okhttp3.RequestBody.create(base64Image, okhttp3.MediaType.get("image/jpeg")))
;
}
/**
* 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