diff --git a/.gitignore b/.gitignore index 6abe5ec..73b3124 100644 --- a/.gitignore +++ b/.gitignore @@ -147,3 +147,4 @@ Desktop.ini /IF.Lastfm.sln.ide project.lock.json .claude +.idea diff --git a/src/IF.Lastfm.Core/Api/Commands/User/GetRecentStationsCommand.cs b/src/IF.Lastfm.Core/Api/Commands/User/GetRecentStationsCommand.cs index 8ef7c63..7bb2511 100644 --- a/src/IF.Lastfm.Core/Api/Commands/User/GetRecentStationsCommand.cs +++ b/src/IF.Lastfm.Core/Api/Commands/User/GetRecentStationsCommand.cs @@ -39,7 +39,7 @@ public override async Task> HandleResponse(HttpRespons var stations = stationsToken.Children().Select(LastStation.ParseJToken).ToList(); - var pageresponse = PageResponse.CreateSuccessResponse(stations); + var pageresponse = new PageResponse(stations); var attrToken = jtoken.SelectToken("@attr"); pageresponse.AddPageInfoFromJToken(attrToken); diff --git a/src/IF.Lastfm.Core/Api/Helpers/PageResponse.cs b/src/IF.Lastfm.Core/Api/Helpers/PageResponse.cs index f3629c9..94ccf4d 100644 --- a/src/IF.Lastfm.Core/Api/Helpers/PageResponse.cs +++ b/src/IF.Lastfm.Core/Api/Helpers/PageResponse.cs @@ -36,6 +36,7 @@ public PageResponse() : this(Enumerable.Empty()) public PageResponse(IEnumerable content) { + Status = LastResponseStatus.Successful; Page = 1; TotalPages = 1; Content = new ReadOnlyCollection(content.ToList()); @@ -92,9 +93,7 @@ public static PageResponse CreateErrorResponse(LastResponseStatus status) internal static PageResponse CreateErrorResponse(string json, HttpResponseMessage httpResponse) { - LastResponseStatus status; - string message; - LastFm.IsResponseValid(json, out status, out message); + LastFm.IsResponseValid(json, out var status, out var message); var r = new PageResponse { Status = status, @@ -120,17 +119,6 @@ internal static PageResponse CreateErrorResponse(string json, HttpResponseMes return r; } - [Obsolete] - public static PageResponse CreateSuccessResponse(IEnumerable content) - { - var r = new PageResponse(content) - { - Status = LastResponseStatus.Successful - }; - - return r; - } - public static PageResponse CreateSuccessResponse(JToken itemsToken, Func parseToken) { return CreateSuccessResponse(itemsToken, null, parseToken, LastPageResultsType.None); @@ -162,7 +150,7 @@ public static IEnumerable ParseItemsToken(JToken itemsToken, Func return items; } - + public static PageResponse CreateSuccessResponse(JToken itemsToken, JToken pageInfoToken, Func parseToken, LastPageResultsType pageResultsType) { var items = ParseItemsToken(itemsToken, parseToken); diff --git a/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj b/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj index 1179eef..98f3e4a 100644 --- a/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj +++ b/src/IF.Lastfm.Core/IF.Lastfm.Core.csproj @@ -2,7 +2,7 @@ Lastream.Lastfm - 1.0.0 + 1.0.1 Lastream Last.fm SDK Last.fm SDK for modern .NET platforms. Maintained fork of Inflatable.Lastfm.