2020-05-03 07:10:41 +01:00
|
|
|
|
using System.Collections.Generic;
|
2022-11-18 11:30:09 +00:00
|
|
|
|
using System.Threading;
|
2020-05-02 21:48:21 +01:00
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
|
|
|
|
|
namespace SpotifyAPI.Web
|
|
|
|
|
{
|
2020-05-31 15:57:58 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Endpoints for retrieving information about a user’s playlists and for managing a user’s playlists.
|
|
|
|
|
/// </summary>
|
2020-05-02 21:48:21 +01:00
|
|
|
|
public interface IPlaylistsClient
|
|
|
|
|
{
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Remove one or more items from a user’s playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-remove-tracks-playlist
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<SnapshotResponse> RemoveItems(string playlistId, PlaylistRemoveItemsRequest request, CancellationToken cancel = default);
|
2020-05-03 00:00:35 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Add one or more items to a user’s playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-add-tracks-to-playlist
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<SnapshotResponse> AddItems(string playlistId, PlaylistAddItemsRequest request, CancellationToken cancel = default);
|
2020-05-03 00:00:35 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get full details of the items of a playlist owned by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlists-tracks
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId, CancellationToken cancel = default);
|
2020-05-30 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get full details of the items of a playlist owned by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlists-tracks
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId, PlaylistGetItemsRequest request, CancellationToken cancel = default);
|
2020-05-03 00:00:35 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Create a playlist for a Spotify user. (The playlist will be empty until you add tracks.)
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userId">The user’s Spotify user ID.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-create-playlist
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<FullPlaylist> Create(string userId, PlaylistCreateRequest request, CancellationToken cancel = default);
|
2020-05-03 07:10:41 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Replace the image used to represent a specific playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="base64JpgData">Base64 encoded JPEG image data, maximum payload size is 256 KB.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-upload-custom-playlist-cover
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<bool> UploadCover(string playlistId, string base64JpgData, CancellationToken cancel = default);
|
2020-05-30 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get the current image associated with a specific playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist-cover
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<List<Image>> GetCovers(string playlistId, CancellationToken cancel = default);
|
2020-05-03 08:06:28 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a list of the playlists owned or followed by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userId">The user’s Spotify user ID.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-list-users-playlists
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<SimplePlaylist>> GetUsers(string userId, CancellationToken cancel = default);
|
2020-05-30 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a list of the playlists owned or followed by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="userId">The user’s Spotify user ID.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-list-users-playlists
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<SimplePlaylist>> GetUsers(string userId, PlaylistGetUsersRequest request, CancellationToken cancel = default);
|
2020-05-03 08:06:28 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a playlist owned by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2020-05-05 14:30:00 +01:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<FullPlaylist> Get(string playlistId, CancellationToken cancel = default);
|
2020-05-30 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a playlist owned by a Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2020-05-05 14:30:00 +01:00
|
|
|
|
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<FullPlaylist> Get(string playlistId, PlaylistGetRequest request, CancellationToken cancel = default);
|
2020-05-03 08:06:28 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Replace all the items in a playlist, overwriting its existing items.
|
|
|
|
|
/// This powerful request can be useful for replacing items, re-ordering existing items, or clearing the playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-replace-playlists-tracks
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<bool> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request, CancellationToken cancel = default);
|
2020-05-03 08:06:28 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a list of the playlists owned or followed by the current Spotify user.
|
|
|
|
|
/// </summary>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-list-of-current-users-playlists
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<SimplePlaylist>> CurrentUsers(CancellationToken cancel = default);
|
2020-05-30 23:11:05 +01:00
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Get a list of the playlists owned or followed by the current Spotify user.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-list-of-current-users-playlists
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<Paging<SimplePlaylist>> CurrentUsers(PlaylistCurrentUsersRequest request, CancellationToken cancel = default);
|
2020-05-03 12:11:53 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <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="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-change-playlist-details
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<bool> ChangeDetails(string playlistId, PlaylistChangeDetailsRequest request, CancellationToken cancel = default);
|
2020-05-03 21:34:03 +01:00
|
|
|
|
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Reorder an item or a group of items in a playlist.
|
|
|
|
|
/// </summary>
|
|
|
|
|
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
|
|
|
|
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
/// <param name="cancel">The cancellation-token to allow to cancel the request.</param>
|
2020-05-30 23:11:05 +01:00
|
|
|
|
/// <remarks>
|
|
|
|
|
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-reorder-playlists-tracks
|
|
|
|
|
/// </remarks>
|
|
|
|
|
/// <returns></returns>
|
2022-11-18 11:30:09 +00:00
|
|
|
|
Task<SnapshotResponse> ReorderItems(string playlistId, PlaylistReorderItemsRequest request, CancellationToken cancel = default);
|
2020-05-02 21:48:21 +01:00
|
|
|
|
}
|
|
|
|
|
}
|