From c34167ecb481af591de3d741d06e15fc87d86d4d Mon Sep 17 00:00:00 2001 From: Jonas Dellinger Date: Sat, 30 May 2020 23:32:06 +0200 Subject: [PATCH] More Docs #451 --- .../Clients/Interfaces/IPlayerClient.cs | 103 ++++++++++++++++++ .../Models/Request/PlayerAddToQueueRequest.cs | 13 +++ .../Request/PlayerPausePlaybackRequest.cs | 4 + .../Request/PlayerRecentlyPlayedRequest.cs | 14 +++ .../Request/PlayerResumePlaybackRequest.cs | 28 +++++ .../Models/Request/PlayerSeekToRequest.cs | 18 +++ .../Models/Request/PlayerShuffleRequest.cs | 13 +++ .../Request/PlayerSkipPreviousRequest.cs | 5 + .../Models/Request/PlayerVolumeRequest.cs | 12 ++ 9 files changed, 210 insertions(+) diff --git a/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs b/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs index 38ed50c5..615a4876 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs @@ -73,26 +73,129 @@ namespace SpotifyAPI.Web /// Task GetCurrentPlayback(PlayerCurrentPlaybackRequest request); + /// + /// Seeks to the given position in the user’s currently playing track. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-seek-to-position-in-currently-playing-track + /// + /// Task SeekTo(PlayerSeekToRequest request); + /// + /// Skips to previous track in the user’s queue. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-skip-users-playback-to-previous-track + /// + /// Task SkipPrevious(); + + /// + /// Skips to previous track in the user’s queue. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-skip-users-playback-to-previous-track + /// + /// Task SkipPrevious(PlayerSkipPreviousRequest request); + /// + /// Start a new context or resume current playback on the user’s active device. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-start-a-users-playback + /// + /// Task ResumePlayback(); + + /// + /// Start a new context or resume current playback on the user’s active device. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-start-a-users-playback + /// + /// Task ResumePlayback(PlayerResumePlaybackRequest request); + /// + /// Pause playback on the user’s account. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-pause-a-users-playback + /// + /// Task PausePlayback(); + + /// + /// Pause playback on the user’s account. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-pause-a-users-playback + /// + /// Task PausePlayback(PlayerPausePlaybackRequest request); + /// + /// Set the volume for the user’s current playback device. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-set-volume-for-users-playback + /// + /// Task SetVolume(PlayerVolumeRequest request); + /// + /// Get tracks from the current user’s recently played tracks. Note: Currently doesn’t support podcast episodes. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-recently-played + /// + /// Task> GetRecentlyPlayed(); + + /// + /// Get tracks from the current user’s recently played tracks. Note: Currently doesn’t support podcast episodes. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-recently-played + /// + /// Task> GetRecentlyPlayed(PlayerRecentlyPlayedRequest request); + /// + /// Get information about a user’s available devices. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-users-available-devices + /// + /// Task GetAvailableDevices(); + /// + /// Toggle shuffle on or off for user’s playback. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-toggle-shuffle-for-users-playback + /// + /// Task SetShuffle(PlayerShuffleRequest request); + /// + /// Add an item to the end of the user’s current playback queue. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-add-to-queue + /// + /// Task AddToQueue(PlayerAddToQueueRequest request); } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs index fecc8aac..c75d0742 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerAddToQueueRequest.cs @@ -2,6 +2,10 @@ namespace SpotifyAPI.Web { public class PlayerAddToQueueRequest : RequestParams { + /// + /// + /// + /// The uri of the item to add to the queue. Must be a track or an episode uri. public PlayerAddToQueueRequest(string uri) { Ensure.ArgumentNotNullOrEmptyString(uri, nameof(uri)); @@ -9,9 +13,18 @@ namespace SpotifyAPI.Web Uri = uri; } + /// + /// The uri of the item to add to the queue. Must be a track or an episode uri. + /// + /// [QueryParam("uri")] public string Uri { get; } + /// + /// The id of the device this command is targeting. + /// If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs index 6ebe42e0..1af4e446 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerPausePlaybackRequest.cs @@ -2,6 +2,10 @@ namespace SpotifyAPI.Web { public class PlayerPausePlaybackRequest : RequestParams { + /// + /// The id of the device this command is targeting. If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs index 32427da1..8fc55860 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerRecentlyPlayedRequest.cs @@ -2,12 +2,26 @@ namespace SpotifyAPI.Web { public class PlayerRecentlyPlayedRequest : RequestParams { + /// + /// The maximum number of items to return. Default: 20. Minimum: 1. Maximum: 50. + /// + /// [QueryParam("limit")] public int? Limit { get; set; } + /// + /// A Unix timestamp in milliseconds. Returns all items after (but not including) this cursor position. + /// If after is specified, before must not be specified. + /// + /// [QueryParam("after")] public long? After { get; set; } + /// + /// A Unix timestamp in milliseconds. Returns all items before (but not including) this cursor position. + /// If before is specified, after must not be specified. + /// + /// [QueryParam("before")] public long? Before { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs index eda8fa30..ea617ad9 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerResumePlaybackRequest.cs @@ -5,27 +5,55 @@ namespace SpotifyAPI.Web { public class PlayerResumePlaybackRequest : RequestParams { + /// + /// The id of the device this command is targeting. If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } + /// + /// Undocumented by Spotify Beta Docs + /// + /// [BodyParam("context_uri")] public string? ContextUri { get; set; } + /// + /// Undocumented by Spotify Beta Docs + /// + /// [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Usage", "CA2227")] [BodyParam("uris")] public IList? Uris { get; set; } + /// + /// Undocumented by Spotify Beta Docs + /// + /// [BodyParam("offset")] public Offset? OffsetParam { get; set; } + /// + /// Undocumented by Spotify Beta Docs + /// + /// [BodyParam("position_ms")] public int? PositionMs { get; set; } public class Offset { + /// + /// Undocumented by Spotify Beta Docs + /// + /// [JsonProperty("uri", NullValueHandling = NullValueHandling.Ignore)] public string? Uri { get; set; } + /// + /// Undocumented by Spotify Beta Docs + /// + /// [JsonProperty("position", NullValueHandling = NullValueHandling.Ignore)] public int? Position { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs index e1fa0837..1951c12a 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSeekToRequest.cs @@ -2,14 +2,32 @@ namespace SpotifyAPI.Web { public class PlayerSeekToRequest : RequestParams { + /// + /// + /// + /// + /// 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. + /// public PlayerSeekToRequest(long positionMs) { PositonMs = 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. + /// + /// [QueryParam("position_ms")] public long PositonMs { get; } + /// + /// The id of the device this command is targeting. If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs index 81afe246..4c333f8a 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerShuffleRequest.cs @@ -2,14 +2,27 @@ namespace SpotifyAPI.Web { public class PlayerShuffleRequest : RequestParams { + /// + /// + /// + /// true : Shuffle user’s playback false : Do not shuffle user’s playback. public PlayerShuffleRequest(bool state) { State = state; } + /// + /// true : Shuffle user’s playback false : Do not shuffle user’s playback. + /// + /// [QueryParam("state")] public bool State { get; } + /// + /// The id of the device this command is targeting. If not supplied, + /// the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs index 865a7437..6e6cacbb 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSkipPreviousRequest.cs @@ -2,6 +2,11 @@ namespace SpotifyAPI.Web { public class PlayerSkipPreviousRequest : RequestParams { + /// + /// The id of the device this command is targeting. + /// If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } } diff --git a/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs index 3f5b18e7..bbd5a1c9 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerVolumeRequest.cs @@ -2,14 +2,26 @@ namespace SpotifyAPI.Web { public class PlayerVolumeRequest : RequestParams { + /// + /// + /// + /// The volume to set. Must be a value from 0 to 100 inclusive. public PlayerVolumeRequest(int volumePercent) { VolumePercent = volumePercent; } + /// + /// The volume to set. Must be a value from 0 to 100 inclusive. + /// + /// [QueryParam("volume_percent")] public int VolumePercent { get; } + /// + /// The id of the device this command is targeting. If not supplied, the user’s currently active device is the target. + /// + /// [QueryParam("device_id")] public string? DeviceId { get; set; } }