Skip to content

Commit

Permalink
Merge pull request jellyfin#416 from SirSparkles/patch-1
Browse files Browse the repository at this point in the history
Fix for jellyfin#411
  • Loading branch information
LordMike committed Oct 4, 2022
2 parents 27db2bb + 75e3c8a commit 4b10d74
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 7 deletions.
9 changes: 5 additions & 4 deletions TMDbLib/Client/TMDbClientTrending.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
using TMDbLib.Objects.Search;
using TMDbLib.Objects.Trending;
using TMDbLib.Rest;
using TMDbLib.Utilities;

namespace TMDbLib.Client
{
Expand All @@ -12,7 +13,7 @@ public partial class TMDbClient
public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("trending/movie/{time_window}");
req.AddUrlSegment("time_window", timeWindow.ToString());
req.AddUrlSegment("time_window", timeWindow.GetDescription());

if (page >= 1)
req.AddQueryString("page", page.ToString());
Expand All @@ -25,7 +26,7 @@ public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindo
public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("trending/tv/{time_window}");
req.AddUrlSegment("time_window", timeWindow.ToString());
req.AddUrlSegment("time_window", timeWindow.GetDescription());

if (page >= 1)
req.AddQueryString("page", page.ToString());
Expand All @@ -38,7 +39,7 @@ public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeW
public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("trending/person/{time_window}");
req.AddUrlSegment("time_window", timeWindow.ToString());
req.AddUrlSegment("time_window", timeWindow.GetDescription());

if (page >= 1)
req.AddQueryString("page", page.ToString());
Expand All @@ -48,4 +49,4 @@ public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWind
return resp;
}
}
}
}
11 changes: 8 additions & 3 deletions TMDbLib/Objects/Trending/TimeWindow.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
namespace TMDbLib.Objects.Trending
using TMDbLib.Utilities;

namespace TMDbLib.Objects.Trending
{
public enum TimeWindow
{
Day, Week
[EnumValue("day")]
Day,
[EnumValue("week")]
Week
}
}
}

0 comments on commit 4b10d74

Please sign in to comment.