From e62ea5c826cdba83bd99d09b05f00b65d66f92a5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?M=C3=A1rk=20=C3=81ngy=C3=A1n?= Date: Wed, 11 Jan 2023 19:21:49 +0100 Subject: [PATCH] localized trending calls --- TMDbLib/Client/TMDbClientTrending.cs | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/TMDbLib/Client/TMDbClientTrending.cs b/TMDbLib/Client/TMDbClientTrending.cs index f0134a6..265c49f 100644 --- a/TMDbLib/Client/TMDbClientTrending.cs +++ b/TMDbLib/Client/TMDbClientTrending.cs @@ -10,39 +10,45 @@ namespace TMDbLib.Client { public partial class TMDbClient { - public async Task> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default) + public async Task> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default) { RestRequest req = _client.Create("trending/movie/{time_window}"); req.AddUrlSegment("time_window", timeWindow.GetDescription()); if (page >= 1) req.AddQueryString("page", page.ToString()); + if (language != null) + req.AddQueryString("language", language); SearchContainer resp = await req.GetOfT>(cancellationToken).ConfigureAwait(false); return resp; } - public async Task> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default) + public async Task> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default) { RestRequest req = _client.Create("trending/tv/{time_window}"); req.AddUrlSegment("time_window", timeWindow.GetDescription()); if (page >= 1) req.AddQueryString("page", page.ToString()); + if (language != null) + req.AddQueryString("language", language); SearchContainer resp = await req.GetOfT>(cancellationToken).ConfigureAwait(false); return resp; } - public async Task> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default) + public async Task> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default) { RestRequest req = _client.Create("trending/person/{time_window}"); req.AddUrlSegment("time_window", timeWindow.GetDescription()); if (page >= 1) req.AddQueryString("page", page.ToString()); + if (language != null) + req.AddQueryString("language", language); SearchContainer resp = await req.GetOfT>(cancellationToken).ConfigureAwait(false);