diff --git a/SpotifyAPI.Web/Clients/Interfaces/IOAuthClient.cs b/SpotifyAPI.Web/Clients/Interfaces/IOAuthClient.cs index df1fd4b5..7c490578 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IOAuthClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IOAuthClient.cs @@ -2,6 +2,9 @@ using System.Threading.Tasks; namespace SpotifyAPI.Web { + /// + /// An OAuth Client, which allows to get inital and updated tokens from the Spotify Service + /// public interface IOAuthClient { /// @@ -9,6 +12,9 @@ namespace SpotifyAPI.Web /// If the token is expired, simply call the funtion again to get a new token /// /// + /// + /// https://developer.spotify.com/documentation/general/guides/authorization-guide/#client-credentials-flow + /// /// Task RequestToken(ClientCredentialsRequest request); @@ -16,8 +22,20 @@ namespace SpotifyAPI.Web /// Refresh an already received token via Authorization Code Auth /// /// + /// + /// https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow + /// /// Task RequestToken(AuthorizationCodeRefreshRequest request); + + /// + /// Reequest an initial token via Authorization Code Auth + /// + /// + /// + /// https://developer.spotify.com/documentation/general/guides/authorization-guide/#authorization-code-flow + /// + /// Task RequestToken(AuthorizationCodeTokenRequest request); } } diff --git a/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs b/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs index cccd1b5b..5bf23feb 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IPaginator.cs @@ -6,17 +6,62 @@ using SpotifyAPI.Web.Http; namespace SpotifyAPI.Web { + /// + /// A paginator allows to cycle through all resources of the spotify API + /// public interface IPaginator { - Task> PaginateAll(Paging firstPage, IAPIConnector connector); - Task> PaginateAll( + /// + /// Fetches all pages and returns them grouped in a list + /// + /// The first page. Will be included in the result list! + /// An API Connector to make requests to spotify + /// Paging Type + /// A list containing all pages, including the firstPage + Task> PaginateAll(Paging firstPage, IAPIConnector connector); + + /// + /// Fetches all pages and returns them grouped in a list. + /// Supports a mapping method which takes care of JSON mapping problems. + /// To give an example, the Search method always returns the paging objects nested in a key. The mapper functions + /// tells the paginate function where to find the actual paging object in the response. + /// + /// The first page. Will be included in the result list! + /// A function which returns the actual paging object in another response object + /// An API Connector to make requests to spotify + /// Paging Type + /// Outer response Type + /// A list containing all pages, including the firstPage + Task> PaginateAll( Paging firstPage, Func> mapper, IAPIConnector connector ); #if NETSTANDARD2_1 + /// + /// Fetches all pages and returns one by one using IAsyncEnumerable + /// + /// The first page. Will be included in the result list! + /// An API Connector to make requests to spotify + /// A CancellationToken + /// Paging Type + /// IAsyncEnumerable Paginate(Paging firstPage, IAPIConnector connector, CancellationToken cancel = default); + + /// + /// Fetches all pages and returns them grouped in a list. + /// Supports a mapping method which takes care of JSON mapping problems. + /// To give an example, the Search method always returns the paging objects nested in a key. The mapper functions + /// tells the paginate function where to find the actual paging object in the response. + /// + /// The first page. Will be included in the result list! + /// A function which returns the actual paging object in another response object + /// An API Connector to make requests to spotify + /// A CancellationToken + /// Paging Type + /// Outer response Type + /// IAsyncEnumerable Paginate( Paging firstPage, Func> mapper, diff --git a/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs b/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs index c2445bc1..34c4d2b3 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IPersonalizationClient.cs @@ -4,10 +4,42 @@ namespace SpotifyAPI.Web { public interface IPersonalizationClient { + /// + /// Get the current user’s top tracks based on calculated affinity. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-users-top-artists-and-tracks + /// + /// Task> GetTopTracks(); + + /// + /// Get the current user’s top tracks based on calculated affinity. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-users-top-artists-and-tracks + /// + /// Task> GetTopTracks(PersonalizationTopRequest request); + /// + /// Get the current user’s top artists based on calculated affinity. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-users-top-artists-and-tracks + /// + /// Task> GetTopArtists(); + + /// + /// Get the current user’s top artists based on calculated affinity. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-users-top-artists-and-tracks + /// + /// Task> GetTopArtists(PersonalizationTopRequest request); } } diff --git a/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs b/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs index 70a5eb27..38ed50c5 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/IPlayerClient.cs @@ -5,16 +5,72 @@ namespace SpotifyAPI.Web { public interface IPlayerClient { + /// + /// Skips to next track in the user’s queue. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-skip-users-playback-to-next-track + /// + /// Task SkipNext(); + + /// + /// Skips to next 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-next-track + /// + /// Task SkipNext(PlayerSkipNextRequest request); + /// + /// Set the repeat mode for the user’s playback. Options are repeat-track, repeat-context, and off. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-set-repeat-mode-on-users-playback + /// + /// Task SetRepeat(PlayerSetRepeatRequest request); + /// + /// Transfer playback to a new device and determine if it should start playing. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-transfer-a-users-playback + /// + /// Task TransferPlayback(PlayerTransferPlaybackRequest request); + /// + /// Get the object currently being played on the user’s Spotify account. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-the-users-currently-playing-track + /// + /// Task GetCurrentlyPlaying(PlayerCurrentlyPlayingRequest request); + /// + /// Get information about the user’s current playback state, including track or episode, progress, and active device. + /// + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-information-about-the-users-current-playback + /// + /// Task GetCurrentPlayback(); + + /// + /// Get information about the user’s current playback state, including track or episode, progress, and active device. + /// + /// The request-model which contains required and optional parameters. + /// + /// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-information-about-the-users-current-playback + /// + /// Task GetCurrentPlayback(PlayerCurrentPlaybackRequest request); Task SeekTo(PlayerSeekToRequest request); diff --git a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs index 32c1c8ac..abff6dde 100644 --- a/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; +using SpotifyAPI.Web.Http; namespace SpotifyAPI.Web { @@ -34,15 +35,17 @@ namespace SpotifyAPI.Web ILibraryClient Library { get; } - Task> PaginateAll(Paging firstPage); - Task> PaginateAll(Paging firstPage, IPaginator paginator); - Task> PaginateAll(Func>> getFirstPage); - Task> PaginateAll(Func>> getFirstPage, IPaginator paginator); + IResponse? LastResponse { get; } - Task> PaginateAll(Paging firstPage, Func> mapper); - Task> PaginateAll(Paging firstPage, Func> mapper, IPaginator paginator); - Task> PaginateAll(Func>> getFirstPage, Func> mapper); - Task> PaginateAll(Func>> getFirstPage, Func> mapper, IPaginator paginator); + Task> PaginateAll(Paging firstPage); + Task> PaginateAll(Paging firstPage, IPaginator paginator); + Task> PaginateAll(Func>> getFirstPage); + Task> PaginateAll(Func>> getFirstPage, IPaginator paginator); + + Task> PaginateAll(Paging firstPage, Func> mapper); + Task> PaginateAll(Paging firstPage, Func> mapper, IPaginator paginator); + Task> PaginateAll(Func>> getFirstPage, Func> mapper); + Task> PaginateAll(Func>> getFirstPage, Func> mapper, IPaginator paginator); #if NETSTANDARD2_1 IAsyncEnumerable Paginate(Paging firstPage); diff --git a/SpotifyAPI.Web/Clients/SimplePaginator.cs b/SpotifyAPI.Web/Clients/SimplePaginator.cs index 58747dcc..b50a16cf 100644 --- a/SpotifyAPI.Web/Clients/SimplePaginator.cs +++ b/SpotifyAPI.Web/Clients/SimplePaginator.cs @@ -18,7 +18,7 @@ namespace SpotifyAPI.Web return Task.FromResult(true); } - public async Task> PaginateAll(Paging firstPage, IAPIConnector connector) + public async Task> PaginateAll(Paging firstPage, IAPIConnector connector) { Ensure.ArgumentNotNull(firstPage, nameof(firstPage)); Ensure.ArgumentNotNull(connector, nameof(connector)); @@ -35,7 +35,7 @@ namespace SpotifyAPI.Web return results; } - public async Task> PaginateAll( + public async Task> PaginateAll( Paging firstPage, Func> mapper, IAPIConnector connector ) { diff --git a/SpotifyAPI.Web/Clients/SpotifyClient.cs b/SpotifyAPI.Web/Clients/SpotifyClient.cs index 461501f2..a30982a7 100644 --- a/SpotifyAPI.Web/Clients/SpotifyClient.cs +++ b/SpotifyAPI.Web/Clients/SpotifyClient.cs @@ -29,6 +29,11 @@ namespace SpotifyAPI.Web config.RetryHandler, config.HTTPLogger ); + _apiConnector.ResponseReceived += (sender, response) => + { + LastResponse = response; + }; + DefaultPaginator = config.DefaultPaginator; UserProfile = new UserProfileClient(_apiConnector); Browse = new BrowseClient(_apiConnector); @@ -73,19 +78,21 @@ namespace SpotifyAPI.Web public ILibraryClient Library { get; } - public Task> PaginateAll(Paging firstPage) + public IResponse? LastResponse { get; private set; } + + public Task> PaginateAll(Paging firstPage) { return DefaultPaginator.PaginateAll(firstPage, _apiConnector); } - public Task> PaginateAll(Paging firstPage, IPaginator paginator) + public Task> PaginateAll(Paging firstPage, IPaginator paginator) { Ensure.ArgumentNotNull(paginator, nameof(paginator)); return paginator.PaginateAll(firstPage, _apiConnector); } - public async Task> PaginateAll(Func>> getFirstPage) + public async Task> PaginateAll(Func>> getFirstPage) { Ensure.ArgumentNotNull(getFirstPage, nameof(getFirstPage)); @@ -94,7 +101,7 @@ namespace SpotifyAPI.Web ).ConfigureAwait(false); } - public async Task> PaginateAll(Func>> getFirstPage, IPaginator paginator) + public async Task> PaginateAll(Func>> getFirstPage, IPaginator paginator) { Ensure.ArgumentNotNull(getFirstPage, nameof(getFirstPage)); Ensure.ArgumentNotNull(paginator, nameof(paginator)); @@ -104,7 +111,7 @@ namespace SpotifyAPI.Web ).ConfigureAwait(false); } - public Task> PaginateAll( + public Task> PaginateAll( Paging firstPage, Func> mapper ) @@ -112,7 +119,7 @@ namespace SpotifyAPI.Web return DefaultPaginator.PaginateAll(firstPage, mapper, _apiConnector); } - public async Task> PaginateAll( + public async Task> PaginateAll( Func>> getFirstPage, Func> mapper ) @@ -122,7 +129,7 @@ namespace SpotifyAPI.Web return await DefaultPaginator.PaginateAll(await getFirstPage().ConfigureAwait(false), mapper, _apiConnector).ConfigureAwait(false); } - public Task> PaginateAll( + public Task> PaginateAll( Paging firstPage, Func> mapper, IPaginator paginator) @@ -132,7 +139,7 @@ namespace SpotifyAPI.Web return paginator.PaginateAll(firstPage, mapper, _apiConnector); } - public async Task> PaginateAll( + public async Task> PaginateAll( Func>> getFirstPage, Func> mapper, IPaginator paginator diff --git a/SpotifyAPI.Web/Http/APIConnector.cs b/SpotifyAPI.Web/Http/APIConnector.cs index 00a25022..991cd5bd 100644 --- a/SpotifyAPI.Web/Http/APIConnector.cs +++ b/SpotifyAPI.Web/Http/APIConnector.cs @@ -15,6 +15,8 @@ namespace SpotifyAPI.Web.Http private readonly IRetryHandler? _retryHandler; private readonly IHTTPLogger? _httpLogger; + public event EventHandler? ResponseReceived; + public APIConnector(Uri baseAddress, IAuthenticator authenticator) : this(baseAddress, authenticator, new NewtonsoftJSONSerializer(), new NetHttpClient(), null, null) { } @@ -198,6 +200,7 @@ namespace SpotifyAPI.Web.Http _httpLogger?.OnRequest(request); IResponse response = await _httpClient.DoRequest(request).ConfigureAwait(false); _httpLogger?.OnResponse(response); + ResponseReceived?.Invoke(this, response); if (_retryHandler != null) { response = await _retryHandler.HandleRetry(request, response, async (newRequest) => @@ -205,6 +208,7 @@ namespace SpotifyAPI.Web.Http await ApplyAuthenticator(request).ConfigureAwait(false); var newResponse = await _httpClient.DoRequest(request).ConfigureAwait(false); _httpLogger?.OnResponse(newResponse); + ResponseReceived?.Invoke(this, response); return newResponse; }).ConfigureAwait(false); } diff --git a/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs b/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs index 7f193a3a..9fd12944 100644 --- a/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs +++ b/SpotifyAPI.Web/Http/Interfaces/IAPIConnector.cs @@ -14,6 +14,8 @@ namespace SpotifyAPI.Web.Http // IHTTPClient HTTPClient { get; } + event EventHandler? ResponseReceived; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")] Task Get(Uri uri); [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")] diff --git a/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs b/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs index c2fb6cc2..ce3debb4 100644 --- a/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AuthorizationCodeRefreshRequest.cs @@ -5,6 +5,12 @@ namespace SpotifyAPI.Web /// public class AuthorizationCodeRefreshRequest { + /// + /// + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard) + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard) + /// The refresh token received from an earlier authorization code grant public AuthorizationCodeRefreshRequest(string clientId, string clientSecret, string refreshToken) { Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId)); @@ -16,8 +22,22 @@ namespace SpotifyAPI.Web RefreshToken = refreshToken; } + /// + /// The refresh token received from an earlier authorization code grant + /// + /// public string RefreshToken { get; } + + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard) + /// + /// public string ClientId { get; } + + /// + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard) + /// + /// public string ClientSecret { get; } } } diff --git a/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs b/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs index 831e4af0..10cf0d31 100644 --- a/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs +++ b/SpotifyAPI.Web/Models/Request/AuthorizationCodeTokenRequest.cs @@ -6,6 +6,13 @@ namespace SpotifyAPI.Web /// public class AuthorizationCodeTokenRequest { + /// + /// + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard). + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard). + /// The code received from the spotify response. + /// The redirectUri which was used to initiate the authentication. public AuthorizationCodeTokenRequest(string clientId, string clientSecret, string code, Uri redirectUri) { Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId)); @@ -19,9 +26,28 @@ namespace SpotifyAPI.Web RedirectUri = redirectUri; } + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard). + /// + /// public string ClientId { get; } + + /// + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard). + /// + /// public string ClientSecret { get; } + + /// + /// The code received from the spotify response. + /// + /// public string Code { get; } + + /// + /// The redirectUri which was used to initiate the authentication. + /// + /// public Uri RedirectUri { get; } } } diff --git a/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs b/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs index b4a12a3a..bb4bedd2 100644 --- a/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs +++ b/SpotifyAPI.Web/Models/Request/ClientCredentialsRequest.cs @@ -5,6 +5,11 @@ namespace SpotifyAPI.Web /// public class ClientCredentialsRequest { + /// + /// + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard) + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard) public ClientCredentialsRequest(string clientId, string clientSecret) { Ensure.ArgumentNotNullOrEmptyString(clientId, nameof(clientId)); @@ -13,7 +18,17 @@ namespace SpotifyAPI.Web ClientId = clientId; ClientSecret = clientSecret; } + + /// + /// The Client ID of your Spotify Application (See Spotify Dev Dashboard) + /// + /// public string ClientId { get; } + + /// + /// The Client Secret of your Spotify Application (See Spotify Dev Dashboard) + /// + /// public string ClientSecret { get; } } } diff --git a/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs b/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs index 2db90af8..d4e1f262 100644 --- a/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PersonalizationTopRequest.cs @@ -2,12 +2,26 @@ namespace SpotifyAPI.Web { public class PersonalizationTopRequest : RequestParams { + /// + /// The number of entities to return. Default: 20. Minimum: 1. Maximum: 50. For example: limit=2 + /// + /// [QueryParam("limit")] public int? Limit { get; set; } + /// + /// The index of the first entity to return. Default: 0 (i.e., the first track). Use with limit to get the next set of entities. + /// + /// [QueryParam("offset")] public int? Offset { get; set; } + /// + /// Over what time frame the affinities are computed. Valid values: long_term + /// (calculated from several years of data and including all new data as it becomes available), + /// medium_term (approximately last 6 months), short_term (approximately last 4 weeks). Default: medium_term + /// + /// [QueryParam("time_range")] public TimeRange? TimeRangeParam { get; set; } diff --git a/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs index 435cab06..c5936273 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerCurrentPlaybackRequest.cs @@ -4,6 +4,17 @@ namespace SpotifyAPI.Web { public class PlayerCurrentPlaybackRequest : RequestParams { + /// + /// + /// + /// + /// A comma-separated list of item types that your client supports besides the default track type. + /// Valid types are: track and episode. An unsupported type in the response is expected to be represented + /// as null value in the item field. 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 currently_playing_type field. + /// public PlayerCurrentPlaybackRequest(AdditionalTypes types = AdditionalTypes.All) { Ensure.ArgumentNotNull(types, nameof(types)); diff --git a/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs index a394ac98..022d3fae 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerCurrentlyPlayingRequest.cs @@ -4,20 +4,38 @@ namespace SpotifyAPI.Web { public class PlayerCurrentlyPlayingRequest : RequestParams { - public PlayerCurrentlyPlayingRequest(string market, AdditionalTypes types = AdditionalTypes.All) + + /// + /// A comma-separated list of item types that your client supports besides the default track type. + /// Valid types are: track and episode. An unsupported type in the response is expected to be represented + /// as null value in the item field. 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 currently_playing_type field. Defaults to AdditionalTypes.All + /// + /// + public PlayerCurrentlyPlayingRequest(AdditionalTypes types = AdditionalTypes.All) { - Ensure.ArgumentNotNullOrEmptyString(market, nameof(market)); Ensure.ArgumentNotNull(types, nameof(types)); - Market = market; AdditionalTypesParam = types; } + /// + /// An ISO 3166-1 alpha-2 country code or the string from_token. + /// Provide this parameter if you want to apply Track Relinking. + /// + /// [QueryParam("market")] - public string Market { get; } + public string? Market { get; set; } /// - /// This is set to `"track", "episode"` by default. + /// A comma-separated list of item types that your client supports besides the default track type. + /// Valid types are: track and episode. An unsupported type in the response is expected to be represented + /// as null value in the item field. 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 currently_playing_type field. Defaults to AdditionalTypes.All /// /// [QueryParam("additional_types")] diff --git a/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs index 9ec23043..7ab28346 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSetRepeatRequest.cs @@ -2,6 +2,11 @@ namespace SpotifyAPI.Web { public class PlayerSetRepeatRequest : RequestParams { + /// + /// + /// track, context or off. track will repeat the current track. context will repeat the current context. + /// off will turn repeat off. + /// public PlayerSetRepeatRequest(State state) { Ensure.ArgumentNotNull(state, nameof(state)); @@ -9,9 +14,18 @@ namespace SpotifyAPI.Web StateParam = state; } + /// + /// 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; } + /// + /// track, context or off. track will repeat the current track. context will repeat the current context. + /// off will turn repeat off. + /// + /// [QueryParam("state")] public State StateParam { get; } diff --git a/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs index 9c7e6288..5a33fcd9 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerSkipNextRequest.cs @@ -2,6 +2,10 @@ namespace SpotifyAPI.Web { public class PlayerSkipNextRequest : 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/PlayerTransferPlaybackRequest.cs b/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs index d61fee75..d0ba154b 100644 --- a/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs +++ b/SpotifyAPI.Web/Models/Request/PlayerTransferPlaybackRequest.cs @@ -4,6 +4,15 @@ namespace SpotifyAPI.Web { public class PlayerTransferPlaybackRequest : RequestParams { + /// + /// + /// + /// + /// A JSON array containing the ID of the device on which playback should be started/transferred. + /// For example:{device_ids:["74ASZWbe4lXaubB36ztrGX"]} + /// Note: Although an array is accepted, only a single device_id is currently supported. + /// Supplying more than one will return 400 Bad Request + /// public PlayerTransferPlaybackRequest(IList deviceIds) { Ensure.ArgumentNotNullOrEmptyList(deviceIds, nameof(deviceIds)); @@ -11,9 +20,20 @@ namespace SpotifyAPI.Web DeviceIds = deviceIds; } + /// + /// A JSON array containing the ID of the device on which playback should be started/transferred. + /// For example:{device_ids:["74ASZWbe4lXaubB36ztrGX"]} + /// Note: Although an array is accepted, only a single device_id is currently supported. + /// Supplying more than one will return 400 Bad Request + /// + /// [BodyParam("device_ids")] public IList DeviceIds { get; } + /// + /// true: ensure playback happens on new device. false or not provided: keep the current playback state. + /// + /// [BodyParam("play")] public bool? Play { get; set; } }