Skip to content

Commit

Permalink
updated language handling logic in ClientTrending methods
Browse files Browse the repository at this point in the history
  • Loading branch information
Szajkop committed Jan 5, 2024
1 parent ee9aefe commit c7f50e3
Showing 1 changed file with 13 additions and 10 deletions.
23 changes: 13 additions & 10 deletions TMDbLib/Client/TMDbClientTrending.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindo

if (page >= 1)
req.AddQueryString("page", page.ToString());
if (language != null)
req.AddQueryString("language", language);

if (!string.IsNullOrWhiteSpace(DefaultLanguage))
if (!string.IsNullOrWhiteSpace(language))
req.AddQueryString("language", language);
else if (!string.IsNullOrWhiteSpace(DefaultLanguage))
req.AddParameter("language", DefaultLanguage);

SearchContainer<SearchMovie> resp = await req.GetOfT<SearchContainer<SearchMovie>>(cancellationToken).ConfigureAwait(false);
Expand All @@ -36,10 +36,10 @@ public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeW

if (page >= 1)
req.AddQueryString("page", page.ToString());
if (language != null)
req.AddQueryString("language", language);

if (!string.IsNullOrWhiteSpace(DefaultLanguage))
if (!string.IsNullOrWhiteSpace(language))
req.AddQueryString("language", language);
else if (!string.IsNullOrWhiteSpace(DefaultLanguage))
req.AddParameter("language", DefaultLanguage);

SearchContainer<SearchTv> resp = await req.GetOfT<SearchContainer<SearchTv>>(cancellationToken).ConfigureAwait(false);
Expand All @@ -54,10 +54,10 @@ public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWind

if (page >= 1)
req.AddQueryString("page", page.ToString());
if (language != null)
req.AddQueryString("language", language);

if (!string.IsNullOrWhiteSpace(DefaultLanguage))
if (!string.IsNullOrWhiteSpace(language))
req.AddQueryString("language", language);
else if (!string.IsNullOrWhiteSpace(DefaultLanguage))
req.AddParameter("language", DefaultLanguage);

SearchContainer<SearchPerson> resp = await req.GetOfT<SearchContainer<SearchPerson>>(cancellationToken).ConfigureAwait(false);
Expand All @@ -72,8 +72,11 @@ public async Task<SearchContainer<SearchBase>> GetTrendingAllAsync(TimeWindow ti

if (page >= 1)
req.AddQueryString("page", page.ToString());
if (language != null)

if (!string.IsNullOrWhiteSpace(language))
req.AddQueryString("language", language);
else if (!string.IsNullOrWhiteSpace(DefaultLanguage))
req.AddParameter("language", DefaultLanguage);

SearchContainer<SearchBase> resp = await req.GetOfT<SearchContainer<SearchBase>>(cancellationToken).ConfigureAwait(false);

Expand Down

0 comments on commit c7f50e3

Please sign in to comment.