This commit is contained in:
Jonas Dellinger 2020-05-30 23:32:06 +02:00
parent 5da15c1c29
commit c34167ecb4
9 changed files with 210 additions and 0 deletions

View File

@ -73,26 +73,129 @@ namespace SpotifyAPI.Web
/// <returns></returns>
Task<CurrentlyPlayingContext> GetCurrentPlayback(PlayerCurrentPlaybackRequest request);
/// <summary>
/// Seeks to the given position in the users currently playing track.
/// </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-seek-to-position-in-currently-playing-track
/// </remarks>
/// <returns></returns>
Task<bool> SeekTo(PlayerSeekToRequest request);
/// <summary>
/// Skips to previous track in the users queue.
/// </summary>
/// <remarks>
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-skip-users-playback-to-previous-track
/// </remarks>
/// <returns></returns>
Task<bool> SkipPrevious();
/// <summary>
/// Skips to previous track in the users queue.
/// </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-skip-users-playback-to-previous-track
/// </remarks>
/// <returns></returns>
Task<bool> SkipPrevious(PlayerSkipPreviousRequest request);
/// <summary>
/// Start a new context or resume current playback on the users active device.
/// </summary>
/// <remarks>
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-start-a-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> ResumePlayback();
/// <summary>
/// Start a new context or resume current playback on the users active device.
/// </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-start-a-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> ResumePlayback(PlayerResumePlaybackRequest request);
/// <summary>
/// Pause playback on the users account.
/// </summary>
/// <remarks>
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-pause-a-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> PausePlayback();
/// <summary>
/// Pause playback on the users account.
/// </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-pause-a-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> PausePlayback(PlayerPausePlaybackRequest request);
/// <summary>
/// Set the volume for the users current playback device.
/// </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-set-volume-for-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> SetVolume(PlayerVolumeRequest request);
/// <summary>
/// Get tracks from the current users recently played tracks. Note: Currently doesnt support podcast episodes.
/// </summary>
/// <remarks>
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-recently-played
/// </remarks>
/// <returns></returns>
Task<CursorPaging<PlayHistoryItem>> GetRecentlyPlayed();
/// <summary>
/// Get tracks from the current users recently played tracks. Note: Currently doesnt support podcast episodes.
/// </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-recently-played
/// </remarks>
/// <returns></returns>
Task<CursorPaging<PlayHistoryItem>> GetRecentlyPlayed(PlayerRecentlyPlayedRequest request);
/// <summary>
/// Get information about a users available devices.
/// </summary>
/// <remarks>
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-users-available-devices
/// </remarks>
/// <returns></returns>
Task<DeviceResponse> GetAvailableDevices();
/// <summary>
/// Toggle shuffle on or off for users playback.
/// </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-toggle-shuffle-for-users-playback
/// </remarks>
/// <returns></returns>
Task<bool> SetShuffle(PlayerShuffleRequest request);
/// <summary>
/// Add an item to the end of the users current playback queue.
/// </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-add-to-queue
/// </remarks>
/// <returns></returns>
Task<bool> AddToQueue(PlayerAddToQueueRequest request);
}
}

View File

@ -2,6 +2,10 @@ namespace SpotifyAPI.Web
{
public class PlayerAddToQueueRequest : RequestParams
{
/// <summary>
///
/// </summary>
/// <param name="uri">The uri of the item to add to the queue. Must be a track or an episode uri.</param>
public PlayerAddToQueueRequest(string uri)
{
Ensure.ArgumentNotNullOrEmptyString(uri, nameof(uri));
@ -9,9 +13,18 @@ namespace SpotifyAPI.Web
Uri = uri;
}
/// <summary>
/// The uri of the item to add to the queue. Must be a track or an episode uri.
/// </summary>
/// <value></value>
[QueryParam("uri")]
public string Uri { get; }
/// <summary>
/// The id of the device this command is targeting.
/// If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}

View File

@ -2,6 +2,10 @@ namespace SpotifyAPI.Web
{
public class PlayerPausePlaybackRequest : RequestParams
{
/// <summary>
/// The id of the device this command is targeting. If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}

View File

@ -2,12 +2,26 @@ namespace SpotifyAPI.Web
{
public class PlayerRecentlyPlayedRequest : RequestParams
{
/// <summary>
/// The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50.
/// </summary>
/// <value></value>
[QueryParam("limit")]
public int? Limit { get; set; }
/// <summary>
/// A Unix timestamp in milliseconds. Returns all items after (but not including) this cursor position.
/// If after is specified, before must not be specified.
/// </summary>
/// <value></value>
[QueryParam("after")]
public long? After { get; set; }
/// <summary>
/// A Unix timestamp in milliseconds. Returns all items before (but not including) this cursor position.
/// If before is specified, after must not be specified.
/// </summary>
/// <value></value>
[QueryParam("before")]
public long? Before { get; set; }
}

View File

@ -5,27 +5,55 @@ namespace SpotifyAPI.Web
{
public class PlayerResumePlaybackRequest : RequestParams
{
/// <summary>
/// The id of the device this command is targeting. If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[BodyParam("context_uri")]
public string? ContextUri { get; set; }
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")]
[BodyParam("uris")]
public IList<string>? Uris { get; set; }
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[BodyParam("offset")]
public Offset? OffsetParam { get; set; }
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[BodyParam("position_ms")]
public int? PositionMs { get; set; }
public class Offset
{
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)]
public string? Uri { get; set; }
/// <summary>
/// Undocumented by Spotify Beta Docs
/// </summary>
/// <value></value>
[JsonProperty("position", NullValueHandling = NullValueHandling.Ignore)]
public int? Position { get; set; }
}

View File

@ -2,14 +2,32 @@ namespace SpotifyAPI.Web
{
public class PlayerSeekToRequest : RequestParams
{
/// <summary>
///
/// </summary>
/// <param name="positionMs">
/// The position in milliseconds to seek to. Must be a positive number.
/// Passing in a position that is greater than the length of the track will
/// cause the player to start playing the next song.
/// </param>
public PlayerSeekToRequest(long positionMs)
{
PositonMs = positionMs;
}
/// <summary>
/// The position in milliseconds to seek to. Must be a positive number.
/// Passing in a position that is greater than the length of the track will cause
/// the player to start playing the next song.
/// </summary>
/// <value></value>
[QueryParam("position_ms")]
public long PositonMs { get; }
/// <summary>
/// The id of the device this command is targeting. If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}

View File

@ -2,14 +2,27 @@ namespace SpotifyAPI.Web
{
public class PlayerShuffleRequest : RequestParams
{
/// <summary>
///
/// </summary>
/// <param name="state">true : Shuffle users playback false : Do not shuffle users playback.</param>
public PlayerShuffleRequest(bool state)
{
State = state;
}
/// <summary>
/// true : Shuffle users playback false : Do not shuffle users playback.
/// </summary>
/// <value></value>
[QueryParam("state")]
public bool State { get; }
/// <summary>
/// The id of the device this command is targeting. If not supplied,
/// the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}

View File

@ -2,6 +2,11 @@ namespace SpotifyAPI.Web
{
public class PlayerSkipPreviousRequest : RequestParams
{
/// <summary>
/// The id of the device this command is targeting.
/// If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}

View File

@ -2,14 +2,26 @@ namespace SpotifyAPI.Web
{
public class PlayerVolumeRequest : RequestParams
{
/// <summary>
///
/// </summary>
/// <param name="volumePercent">The volume to set. Must be a value from 0 to 100 inclusive.</param>
public PlayerVolumeRequest(int volumePercent)
{
VolumePercent = volumePercent;
}
/// <summary>
/// The volume to set. Must be a value from 0 to 100 inclusive.
/// </summary>
/// <value></value>
[QueryParam("volume_percent")]
public int VolumePercent { get; }
/// <summary>
/// The id of the device this command is targeting. If not supplied, the users currently active device is the target.
/// </summary>
/// <value></value>
[QueryParam("device_id")]
public string? DeviceId { get; set; }
}