mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-24 23:16:28 +00:00
Support uploading an image for a playlist (#318)
* Support uploading an image for a playlist * Support uploading a playlist image * Support uploading a playlist image Support uploading a playlist image * Add support for new playlist endpoint without userid
This commit is contained in:
parent
f31af2395c
commit
f173e23e1a
@ -60,6 +60,9 @@ namespace SpotifyAPI.Web.Enums
|
|||||||
UserReadCurrentlyPlaying = 131072,
|
UserReadCurrentlyPlaying = 131072,
|
||||||
|
|
||||||
[String("app-remote-control")]
|
[String("app-remote-control")]
|
||||||
AppRemoteControl = 262144
|
AppRemoteControl = 262144,
|
||||||
|
|
||||||
|
[String("ugc-image-upload")]
|
||||||
|
UgcImageUpload = 524288
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1496,6 +1496,56 @@ namespace SpotifyAPI.Web
|
|||||||
return (await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
|
return (await UploadDataAsync<ErrorResponse>(_builder.UpdatePlaylist(userId, playlistId), body.ToString(Formatting.None), "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user's Spotify user ID.</param>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public ErrorResponse UploadPlaylistImage(string userId, string playlistId, string base64EncodedJpgImage)
|
||||||
|
{
|
||||||
|
return UploadData<ErrorResponse>(_builder.UploadPlaylistImage(userId, playlistId), base64EncodedJpgImage, "PUT") ?? new ErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user's Spotify user ID.</param>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public async Task<ErrorResponse> UploadPlaylistImageAsync(string userId, string playlistId, string base64EncodedJpgImage)
|
||||||
|
{
|
||||||
|
return (await UploadDataAsync<ErrorResponse>(_builder.UploadPlaylistImage(userId, playlistId), base64EncodedJpgImage, "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change a playlist’s name and public/private state. (The user must, of course, own the playlist.)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public ErrorResponse UploadPlaylistImage(string playlistId, string base64EncodedJpgImage)
|
||||||
|
{
|
||||||
|
return UploadData<ErrorResponse>(_builder.UploadPlaylistImage(playlistId), base64EncodedJpgImage, "PUT") ?? new ErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Change a playlist’s name and public/private state asynchronously. (The user must, of course, own the playlist.)
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <param name="base64EncodedJpgImage">The image as a base64 encoded string</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public async Task<ErrorResponse> UploadPlaylistImageAsync(string playlistId, string base64EncodedJpgImage)
|
||||||
|
{
|
||||||
|
return (await UploadDataAsync<ErrorResponse>(_builder.UploadPlaylistImage(playlistId), base64EncodedJpgImage, "PUT").ConfigureAwait(false)) ?? new ErrorResponse();
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
|
/// Replace all the tracks in a playlist, overwriting its existing tracks. This powerful request can be useful for
|
||||||
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
/// replacing tracks, re-ordering existing tracks, or clearing the playlist.
|
||||||
|
@ -763,6 +763,29 @@ namespace SpotifyAPI.Web
|
|||||||
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks";
|
return $"{APIBase}/users/{userId}/playlists/{playlistId}/tracks";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Upload an image for a playlist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="userId">The user's Spotify user ID.</param>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public string UploadPlaylistImage(string userId, string playlistId)
|
||||||
|
{
|
||||||
|
return $"{APIBase}/users/{userId}/playlists/{playlistId}/images";
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Upload an image for a playlist.
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||||
|
/// <returns></returns>
|
||||||
|
/// <remarks>AUTH NEEDED</remarks>
|
||||||
|
public string UploadPlaylistImage(string playlistId)
|
||||||
|
{
|
||||||
|
return $"{APIBase}/playlists/{playlistId}/images";
|
||||||
|
}
|
||||||
|
|
||||||
#endregion Playlists
|
#endregion Playlists
|
||||||
|
|
||||||
#region Profiles
|
#region Profiles
|
||||||
|
Loading…
Reference in New Issue
Block a user