Added RecommendationGenres and NewReleases

This commit is contained in:
Jonas Dellinger 2020-05-02 13:52:01 +02:00
parent 9f6729ad60
commit 8074ff6331
6 changed files with 56 additions and 0 deletions

View File

@ -58,5 +58,22 @@ namespace SpotifyAPI.Web
return API.Get<RecommendationsResponse>(URLs.Recommendations(), request.BuildQueryParams()); return API.Get<RecommendationsResponse>(URLs.Recommendations(), request.BuildQueryParams());
} }
public Task<RecommendationGenresResponse> GetRecommendationGenres()
{
return API.Get<RecommendationGenresResponse>(URLs.Recommendations());
}
public Task<NewReleasesResponse> GetNewReleases()
{
return API.Get<NewReleasesResponse>(URLs.NewReleases());
}
public Task<NewReleasesResponse> GetNewReleases(NewReleasesRequest request)
{
Ensure.ArgumentNotNull(request, nameof(request));
return API.Get<NewReleasesResponse>(URLs.NewReleases(), request.BuildQueryParams());
}
} }
} }

View File

@ -14,5 +14,9 @@ namespace SpotifyAPI.Web
Task<CategoryPlaylistsResponse> GetCategoryPlaylists(string categoryId, CategoriesPlaylistsRequest request); Task<CategoryPlaylistsResponse> GetCategoryPlaylists(string categoryId, CategoriesPlaylistsRequest request);
Task<RecommendationsResponse> GetRecommendations(RecommendationsRequest request); Task<RecommendationsResponse> GetRecommendations(RecommendationsRequest request);
Task<RecommendationGenresResponse> GetRecommendationGenres();
Task<NewReleasesResponse> GetNewReleases();
Task<NewReleasesResponse> GetNewReleases(NewReleasesRequest request);
} }
} }

View File

@ -0,0 +1,14 @@
namespace SpotifyAPI.Web
{
public class NewReleasesRequest : RequestParams
{
[QueryParam("country")]
public string Country { get; set; }
[QueryParam("limit")]
public int? Limit { get; set; }
[QueryParam("offset")]
public int? Offset { get; set; }
}
}

View File

@ -0,0 +1,8 @@
namespace SpotifyAPI.Web
{
public class NewReleasesResponse
{
public string Message { get; set; }
public Paging<SimpleAlbum> Albums { get; set; }
}
}

View File

@ -0,0 +1,9 @@
using System.Collections.Generic;
namespace SpotifyAPI.Web
{
public class RecommendationGenresResponse
{
public List<string> Genres { get; set; }
}
}

View File

@ -19,6 +19,10 @@ namespace SpotifyAPI.Web
public static Uri Recommendations() => EUri($"recommendations"); public static Uri Recommendations() => EUri($"recommendations");
public static Uri RecommendationGenres() => EUri($"recommendations/available-genre-seeds");
public static Uri NewReleases() => EUri($"browse/new-releases");
private static Uri EUri(FormattableString path) => new Uri(path.ToString(_provider), UriKind.Relative); private static Uri EUri(FormattableString path) => new Uri(path.ToString(_provider), UriKind.Relative);
} }
} }