mirror of
https://github.com/Sarsoo/Spotify.NET.git
synced 2024-12-23 14:46:26 +00:00
📘 More docs! #451
This commit is contained in:
parent
4c38f958a0
commit
7445d3ca0e
@ -5,33 +5,176 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public interface IPlaylistsClient
|
||||
{
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-remove-tracks-playlist
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<SnapshotResponse> RemoveItems(string playlistId, PlaylistRemoveItemsRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-add-tracks-to-playlist
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<SnapshotResponse> AddItems(string playlistId, PlaylistAddItemsRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlists-tracks
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlists-tracks
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<PlaylistTrack<IPlayableItem>>> GetItems(string playlistId, PlaylistGetItemsRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-create-playlist
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<FullPlaylist> Create(string userId, PlaylistCreateRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-upload-custom-playlist-cover
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<bool> UploadCover(string playlistId, string base64JpgData);
|
||||
|
||||
/// <summary>
|
||||
/// Get the current image associated with a specific playlist.
|
||||
/// </summary>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist-cover
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<List<Image>> GetCovers(string playlistId);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-list-users-playlists
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<SimplePlaylist>> GetUsers(string userId);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-list-users-playlists
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<SimplePlaylist>> GetUsers(string userId, PlaylistGetUsersRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get a playlist owned by a Spotify user.
|
||||
/// </summary>
|
||||
/// <param name="playlistId">The Spotify ID for the playlist.</param>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
||||
Task<FullPlaylist> Get(string playlistId);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-playlist
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
|
||||
Task<FullPlaylist> Get(string playlistId, PlaylistGetRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-replace-playlists-tracks
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<bool> ReplaceItems(string playlistId, PlaylistReplaceItemsRequest request);
|
||||
|
||||
/// <summary>
|
||||
/// Get a list of the playlists owned or followed by the current Spotify user.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-list-of-current-users-playlists
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<SimplePlaylist>> CurrentUsers();
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-list-of-current-users-playlists
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<Paging<SimplePlaylist>> CurrentUsers(PlaylistCurrentUsersRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-change-playlist-details
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<bool> ChangeDetails(string playlistId, PlaylistChangeDetailsRequest request);
|
||||
|
||||
/// <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>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-reorder-playlists-tracks
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<SnapshotResponse> ReorderItems(string playlistId, PlaylistReorderItemsRequest request);
|
||||
}
|
||||
}
|
||||
|
@ -4,6 +4,15 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public interface ISearchClient
|
||||
{
|
||||
/// <summary>
|
||||
/// Get Spotify Catalog information about albums, artists, playlists,
|
||||
/// tracks, shows or episodes that match a keyword string.
|
||||
/// </summary>
|
||||
/// <param name="request">The request-model which contains required and optional parameters.</param>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-search
|
||||
/// </remarks>
|
||||
/// <returns></returns>
|
||||
Task<SearchResponse> Item(SearchRequest request);
|
||||
}
|
||||
}
|
||||
|
@ -3,7 +3,7 @@ using System;
|
||||
|
||||
namespace SpotifyAPI.Web.Http
|
||||
{
|
||||
public class SimpleHTTPLogger : IHTTPLogger
|
||||
public class SimpleConsoleHTTPLogger : IHTTPLogger
|
||||
{
|
||||
private const string OnRequestFormat = "\n{0} {1} [{2}] {3}";
|
||||
|
@ -4,6 +4,15 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistAddItemsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="uris">
|
||||
/// A JSON array of the Spotify URIs to add.
|
||||
/// For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh",
|
||||
/// "spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
|
||||
/// A maximum of 100 items can be added in one request.
|
||||
/// </param>
|
||||
public PlaylistAddItemsRequest(IList<string> uris)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uris, nameof(uris));
|
||||
@ -11,9 +20,23 @@ namespace SpotifyAPI.Web
|
||||
Uris = uris;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A JSON array of the Spotify URIs to add.
|
||||
/// For example: {"uris": ["spotify:track:4iV5W9uYEdYUVa79Axb7Rh",
|
||||
/// "spotify:track:1301WleyT98MSxVHPZCA6M", "spotify:episode:512ojhOuo1ktJprKbVcKyQ"]}
|
||||
/// A maximum of 100 items can be added in one request.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("uris")]
|
||||
public IList<string> Uris { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The position to insert the items, a zero-based index.
|
||||
/// For example, to insert the items in the first position: position=0 ;
|
||||
/// to insert the items in the third position: position=2. If omitted, the items will be appended to the playlist.
|
||||
/// Items are added in the order they appear in the uris array.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("position")]
|
||||
public int? Position { get; set; }
|
||||
}
|
||||
|
@ -2,15 +2,32 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistChangeDetailsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
/// The new name for the playlist, for example "My New Playlist Title"
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("name")]
|
||||
public string? Name { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true the playlist will be public, if false it will be private.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("public")]
|
||||
public bool? Public { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("collaborative")]
|
||||
public bool? Collaborative { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Value for playlist description as displayed in Spotify Clients and in the Web API.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("description")]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
@ -2,6 +2,12 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistCreateRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
||||
/// <param name="name">
|
||||
/// The name for the new playlist, for example "Your Coolest Playlist" .
|
||||
/// This name does not need to be unique; a user may have several playlists with the same name.
|
||||
/// </param>
|
||||
public PlaylistCreateRequest(string name)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyString(name, nameof(name));
|
||||
@ -9,15 +15,36 @@ namespace SpotifyAPI.Web
|
||||
Name = name;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The name for the new playlist, for example "Your Coolest Playlist" .
|
||||
/// This name does not need to be unique; a user may have several playlists with the same name.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("name")]
|
||||
public string Name { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to true . If true the playlist will be public, if false it will be private.
|
||||
/// To be able to create private playlists, the user must have granted the playlist-modify-private scope
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("public")]
|
||||
public bool? Public { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Defaults to false . If true the playlist will be collaborative.
|
||||
/// Note that to create a collaborative playlist you must also set public to false .
|
||||
/// To create collaborative playlists you must have
|
||||
/// granted playlist-modify-private and playlist-modify-public scopes .
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("collaborative")]
|
||||
public bool? Collaborative { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// value for playlist description as displayed in Spotify Clients and in the Web API.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("description")]
|
||||
public string? Description { get; set; }
|
||||
}
|
||||
|
@ -2,9 +2,18 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistCurrentUsersRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum number of playlists to return. Default: 20. Minimum: 1. Maximum: 50.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("limit")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The index of the first playlist to return.
|
||||
/// Default: 0 (the first object). Maximum offset: 100.000. Use with limit to get the next set of playlists.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("offset")]
|
||||
public int? Offset { get; set; }
|
||||
}
|
||||
|
@ -5,6 +5,17 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistGetItemsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="types">
|
||||
/// A comma-separated list of item types that your client supports
|
||||
/// besides the default track type. Valid types are: track and episode.
|
||||
/// Note: This parameter was introduced to allow existing clients to maintain
|
||||
/// their current behaviour and might be deprecated in the future. In addition to
|
||||
/// providing this parameter, make sure that your client properly handles cases of new types in the
|
||||
/// future by checking against the type field of each object. Defaults to ALL
|
||||
/// </param>
|
||||
public PlaylistGetItemsRequest(AdditionalTypes types = AdditionalTypes.All)
|
||||
{
|
||||
Ensure.ArgumentNotNull(types, nameof(types));
|
||||
@ -13,15 +24,44 @@ namespace SpotifyAPI.Web
|
||||
Fields = new List<string>();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Filters for the query: a comma-separated list of the fields to return.
|
||||
/// If omitted, all fields are returned. For example, to get just the total number of items and the request limit:
|
||||
/// fields=total,limit
|
||||
/// A dot separator can be used to specify non-reoccurring fields, while parentheses can be used to specify
|
||||
/// reoccurring fields within objects. For example, to get just the added date and user ID of the adder:
|
||||
/// fields=items(added_at,added_by.id)
|
||||
/// Use multiple parentheses to drill down into nested objects, for example:
|
||||
/// fields=items(track(name,href,album(name,href)))
|
||||
/// Fields can be excluded by prefixing them with an exclamation mark, for example:
|
||||
/// fields=items.track.album(!external_urls,images)
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("fields")]
|
||||
public IList<string> Fields { get; }
|
||||
|
||||
/// <summary>
|
||||
/// The maximum number of items to return. Default: 100. Minimum: 1. Maximum: 100.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("limit")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The index of the first item to return. Default: 0 (the first object).
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("offset")]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An ISO 3166-1 alpha-2 country code or the string from_token.
|
||||
/// Provide this parameter if you want to apply Track Relinking. For episodes, if a valid user access token is
|
||||
/// specified in the request header, the country associated with the user account will take priority over this
|
||||
/// parameter. Note: If neither market or user country are provided,
|
||||
/// the episode is considered unavailable for the client.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("market")]
|
||||
public string? Market { get; set; }
|
||||
|
||||
|
@ -2,9 +2,18 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistGetUsersRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
/// The maximum number of playlists to return. Default: 20. Minimum: 1. Maximum: 50.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("limit")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The index of the first playlist to return. Default: 0 (the first object).
|
||||
/// Maximum offset: 100.000. Use with limit to get the next set of playlists.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("offset")]
|
||||
public int? Offset { get; set; }
|
||||
}
|
||||
|
@ -5,6 +5,15 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistRemoveItemsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="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.
|
||||
/// </param>
|
||||
public PlaylistRemoveItemsRequest(IList<Item> tracks)
|
||||
{
|
||||
Ensure.ArgumentNotNullOrEmptyList(tracks, nameof(tracks));
|
||||
@ -12,9 +21,22 @@ namespace SpotifyAPI.Web
|
||||
Tracks = tracks;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("tracks")]
|
||||
public IList<Item> Tracks { get; }
|
||||
|
||||
/// <summary>
|
||||
/// 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.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("snapshot_id")]
|
||||
public string? SnapshotId { get; set; }
|
||||
|
||||
|
@ -2,21 +2,60 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistReorderItemsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="rangeStart">
|
||||
/// The position of the first item to be reordered.
|
||||
/// </param>
|
||||
/// <param name="insertBefore">
|
||||
/// The position where the items should be inserted.
|
||||
/// To reorder the items to the end of the playlist,
|
||||
/// simply set insert_before to the position after the last item.
|
||||
/// Examples: To reorder the first item to the last position in a playlist with 10 items,
|
||||
/// set range_start to 0, and insert_before to 10. To reorder the last item in a playlist
|
||||
/// with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.
|
||||
/// </param>
|
||||
public PlaylistReorderItemsRequest(int rangeStart, int insertBefore)
|
||||
{
|
||||
RangeStart = rangeStart;
|
||||
InsertBefore = insertBefore;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// The position of the first item to be reordered.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("range_start")]
|
||||
public int RangeStart { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The position where the items should be inserted.
|
||||
/// To reorder the items to the end of the playlist,
|
||||
/// simply set insert_before to the position after the last item.
|
||||
/// Examples: To reorder the first item to the last position in a playlist with 10 items,
|
||||
/// set range_start to 0, and insert_before to 10. To reorder the last item in a playlist
|
||||
/// with 10 items to the start of the playlist, set range_start to 9, and insert_before to 0.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("insert_before")]
|
||||
public int InsertBefore { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The amount of items to be reordered. Defaults to 1 if not set.
|
||||
/// The range of items to be reordered begins from the range_start position, and
|
||||
/// includes the range_length subsequent items.
|
||||
/// Example: To move the items at index 9-10 to the start of the playlist,
|
||||
/// range_start is set to 9, and range_length is set to 2.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("range_length")]
|
||||
public int? RangeLength { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The playlist’s snapshot ID against which you want to make the changes.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("snapshot_id")]
|
||||
public string? SnapshotId { get; set; }
|
||||
}
|
||||
|
@ -4,6 +4,13 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class PlaylistReplaceItemsRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="uris">
|
||||
/// A comma-separated list of Spotify URIs to set, can be track or episode URIs.
|
||||
/// A maximum of 100 items can be set in one request.
|
||||
/// </param>
|
||||
public PlaylistReplaceItemsRequest(List<string> uris)
|
||||
{
|
||||
Ensure.ArgumentNotNull(uris, nameof(uris));
|
||||
@ -11,6 +18,11 @@ namespace SpotifyAPI.Web
|
||||
Uris = uris;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A comma-separated list of Spotify URIs to set, can be track or episode URIs.
|
||||
/// A maximum of 100 items can be set in one request.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[BodyParam("uris")]
|
||||
public IList<string> Uris { get; }
|
||||
}
|
||||
|
@ -4,6 +4,20 @@ namespace SpotifyAPI.Web
|
||||
{
|
||||
public class SearchRequest : RequestParams
|
||||
{
|
||||
/// <summary>
|
||||
///
|
||||
/// </summary>
|
||||
/// <param name="type">
|
||||
/// A comma-separated list of item types to search across.
|
||||
/// Valid types are: album , artist, playlist, track, show and episode.
|
||||
/// Search results include hits from all the specified item types.
|
||||
/// </param>
|
||||
/// <param name="query">
|
||||
/// Search query keywords and optional field filters and operators.
|
||||
/// </param>
|
||||
/// <remarks>
|
||||
/// https://developer.spotify.com/documentation/web-api/reference/search/search/
|
||||
/// </remarks>
|
||||
public SearchRequest(Types type, string query)
|
||||
{
|
||||
Ensure.ArgumentNotNull(type, nameof(type));
|
||||
@ -13,21 +27,67 @@ namespace SpotifyAPI.Web
|
||||
Query = query;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// A comma-separated list of item types to search across.
|
||||
/// Valid types are: album , artist, playlist, track, show and episode.
|
||||
/// Search results include hits from all the specified item types.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("type")]
|
||||
public Types Type { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Search query keywords and optional field filters and operators.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("q")]
|
||||
public string Query { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// An ISO 3166-1 alpha-2 country code or the string from_token.
|
||||
/// If a country code is specified, only content that is playable in that market is returned.
|
||||
/// Note:
|
||||
/// - Playlist results are not affected by the market parameter.
|
||||
/// - If market is set to from_token, and a valid access token is
|
||||
/// specified in the request header, only content playable in the country
|
||||
/// associated with the user account, is returned.
|
||||
/// - Users can view the country that is associated with their account in the
|
||||
/// account settings. A user must grant access to the user-read-private scope
|
||||
/// prior to when the access token is issued.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("market")]
|
||||
public string? Market { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Maximum number of results to return.
|
||||
/// Default: 20
|
||||
/// Minimum: 1
|
||||
/// Maximum: 50
|
||||
/// Note: The limit is applied within each type, not on the total response.
|
||||
/// For example, if the limit value is 3 and the type is artist,album,
|
||||
/// the response contains 3 artists and 3 albums.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("limit")]
|
||||
public int? Limit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The index of the first result to return.
|
||||
/// Default: 0 (the first result). Maximum offset (including limit): 2,000.
|
||||
/// Use with limit to get the next page of search results.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("offset")]
|
||||
public int? Offset { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Possible values: audio
|
||||
/// If include_external = audio is specified the response
|
||||
/// will include any relevant audio content that is hosted externally.
|
||||
/// By default external content is filtered out from responses.
|
||||
/// </summary>
|
||||
/// <value></value>
|
||||
[QueryParam("include_external")]
|
||||
public IncludeExternals? IncludeExternal { get; set; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user