Skip to content

Commit 5ae1266

Browse files
committed
Pagination implementation adapted - Less methods,more defaults JohnnyCrazy#451
1 parent 7445d3c commit 5ae1266

11 files changed

Lines changed: 564 additions & 97 deletions

File tree

‎SpotifyAPI.Web.Examples/Example.CLI.PersistentConfig/Program.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ private static async Task Start()
5959
var me = await spotify.UserProfile.Current();
6060
Console.WriteLine($"Welcome {me.DisplayName} ({me.Id}), your authenticated!");
6161

62-
var playlists = await spotify.PaginateAll(() => spotify.Playlists.CurrentUsers());
62+
var playlists = await spotify.PaginateAll(spotify.Playlists.CurrentUsers());
6363
Console.WriteLine($"Total Playlists in your Account: {playlists.Count}");
6464

6565
_server.Dispose();

‎SpotifyAPI.Web/Clients/Interfaces/IShowsClient.cs‎

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,60 @@ namespace SpotifyAPI.Web
44
{
55
public interface IShowsClient
66
{
7+
/// <summary>
8+
/// Get Spotify catalog information for a single show identified by its unique Spotify ID.
9+
/// </summary>
10+
/// <param name="showId">The Spotify ID for the show.</param>
11+
/// <remarks>
12+
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-show
13+
/// </remarks>
14+
/// <returns></returns>
715
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
816
Task<FullShow> Get(string showId);
17+
18+
/// <summary>
19+
/// Get Spotify catalog information for a single show identified by its unique Spotify ID.
20+
/// </summary>
21+
/// <param name="showId">The Spotify ID for the show.</param>
22+
/// <param name="request">The request-model which contains required and optional parameters.</param>
23+
/// <remarks>
24+
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-show
25+
/// </remarks>
26+
/// <returns></returns>
927
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Naming", "CA1716")]
1028
Task<FullShow> Get(string showId, ShowRequest request);
1129

30+
/// <summary>
31+
/// Get Spotify catalog information for several shows based on their Spotify IDs.
32+
/// </summary>
33+
/// <param name="request">The request-model which contains required and optional parameters.</param>
34+
/// <remarks>
35+
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-multiple-shows
36+
/// </remarks>
37+
/// <returns></returns>
1238
Task<ShowsResponse> GetSeveral(ShowsRequest request);
1339

40+
/// <summary>
41+
/// Get Spotify catalog information about an show’s episodes.
42+
/// Optional parameters can be used to limit the number of episodes returned.
43+
/// </summary>
44+
/// <param name="showId">The Spotify ID for the show.</param>
45+
/// <remarks>
46+
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-shows-episodes
47+
/// </remarks>
48+
/// <returns></returns>
1449
Task<Paging<SimpleEpisode>> GetEpisodes(string showId);
50+
51+
/// <summary>
52+
/// Get Spotify catalog information about an show’s episodes.
53+
/// Optional parameters can be used to limit the number of episodes returned.
54+
/// </summary>
55+
/// <param name="showId">The Spotify ID for the show.</param>
56+
/// <param name="request">The request-model which contains required and optional parameters.</param>
57+
/// <remarks>
58+
/// https://developer.spotify.com/documentation/web-api/reference-beta/#endpoint-get-a-shows-episodes
59+
/// </remarks>
60+
/// <returns></returns>
1561
Task<Paging<SimpleEpisode>> GetEpisodes(string showId, ShowEpisodesRequest request);
1662
}
1763
}

‎SpotifyAPI.Web/Clients/Interfaces/ISpotifyClient.cs‎

Lines changed: 258 additions & 17 deletions
Large diffs are not rendered by default.

‎SpotifyAPI.Web/Clients/SpotifyClient.cs‎

Lines changed: 207 additions & 75 deletions
Large diffs are not rendered by default.

‎SpotifyAPI.Web/Models/Request/ShowEpisodesRequest.cs‎

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,30 @@ namespace SpotifyAPI.Web
22
{
33
public class ShowEpisodesRequest : RequestParams
44
{
5+
/// <summary>
6+
/// The maximum number of episodes to return. Default: 20. Minimum: 1. Maximum: 50.
7+
/// </summary>
8+
/// <value></value>
59
[QueryParam("limit")]
610
public int? Limit { get; set; }
711

12+
/// <summary>
13+
/// The index of the first episode to return.
14+
/// Default: 0 (the first object). Use with limit to get the next set of episodes.
15+
/// </summary>
16+
/// <value></value>
817
[QueryParam("offset")]
918
public int? Offset { get; set; }
1019

20+
/// <summary>
21+
/// An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes
22+
/// that are available in that market will be returned.
23+
/// If a valid user access token is specified in the request header,
24+
/// the country associated with the user account will take priority over this parameter.
25+
/// Note: If neither market or user country are provided, the content is considered unavailable for the client.
26+
/// Users can view the country that is associated with their account in the account settings.
27+
/// </summary>
28+
/// <value></value>
1129
[QueryParam("market")]
1230
public string? Market { get; set; }
1331
}

‎SpotifyAPI.Web/Models/Request/ShowRequest.cs‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,16 @@ namespace SpotifyAPI.Web
22
{
33
public class ShowRequest : RequestParams
44
{
5+
/// <summary>
6+
/// An ISO 3166-1 alpha-2 country code. If a country code is specified,
7+
/// only shows and episodes that are available in that market will be returned.
8+
/// If a valid user access token is specified in the request header,
9+
/// the country associated with the user account will take priority over this parameter.
10+
/// Note: If neither market or user country are provided, the content
11+
/// is considered unavailable for the client.
12+
/// Users can view the country that is associated with their account in the account settings.
13+
/// </summary>
14+
/// <value></value>
515
[QueryParam("market")]
616
public string? Market { get; set; }
717
}

‎SpotifyAPI.Web/Models/Request/ShowsRequest.cs‎

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,36 @@ namespace SpotifyAPI.Web
44
{
55
public class ShowsRequest : RequestParams
66
{
7+
/// <summary>
8+
/// Get Spotify catalog information for several shows based on their Spotify IDs.
9+
/// </summary>
10+
/// <param name="ids">
11+
/// A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.
12+
/// </param>
713
public ShowsRequest(IList<string> ids)
814
{
915
Ensure.ArgumentNotNullOrEmptyList(ids, nameof(ids));
1016

1117
Ids = ids;
1218
}
1319

20+
/// <summary>
21+
/// A comma-separated list of the Spotify IDs for the shows. Maximum: 50 IDs.
22+
/// </summary>
23+
/// <value></value>
1424
[QueryParam("ids")]
1525
public IList<string> Ids { get; }
1626

27+
/// <summary>
28+
/// An ISO 3166-1 alpha-2 country code. If a country code is specified, only shows and episodes
29+
/// that are available in that market will be returned.
30+
/// If a valid user access token is specified in the request header,
31+
/// the country associated with the user account will take priority over this parameter.
32+
/// Note: If neither market or user country are provided,
33+
/// the content is considered unavailable for the client.
34+
/// Users can view the country that is associated with their account in the account settings.
35+
/// </summary>
36+
/// <value></value>
1737
[QueryParam("market")]
1838
public string? Market { get; set; }
1939
}

‎SpotifyAPI.Web/Models/Response/CategoriesResponse.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace SpotifyAPI.Web
22
{
33
public class CategoriesResponse
44
{
5-
public Paging<Category> Categories { get; set; } = default!;
5+
public Paging<Category, CategoriesResponse> Categories { get; set; } = default!;
66
}
77
}
88

‎SpotifyAPI.Web/Models/Response/CategoryPlaylistsResponse.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ namespace SpotifyAPI.Web
22
{
33
public class CategoryPlaylistsResponse
44
{
5-
public Paging<SimplePlaylist> Playlists { get; set; } = default!;
5+
public Paging<SimplePlaylist, CategoryPlaylistsResponse> Playlists { get; set; } = default!;
66
}
77
}
88

‎SpotifyAPI.Web/Models/Response/FeaturedPlaylistsResponse.cs‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ namespace SpotifyAPI.Web
33
public class FeaturedPlaylistsResponse
44
{
55
public string Message { get; set; } = default!;
6-
public Paging<SimplePlaylist> Playlists { get; set; } = default!;
6+
public Paging<SimplePlaylist, FeaturedPlaylistsResponse> Playlists { get; set; } = default!;
77
}
88
}
99

0 commit comments

Comments
 (0)