Merge pull request #434 from Szajkop/master

Add default language to trending queries
This commit is contained in:
Tim Eisele 2024-01-05 16:13:39 +01:00 committed by GitHub
commit 3bf0087833
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1,6 +1,7 @@
using System.Threading;
using System.Threading.Tasks;
using TMDbLib.Objects.General;
using TMDbLib.Objects.Languages;
using TMDbLib.Objects.Search;
using TMDbLib.Objects.Trending;
using TMDbLib.Rest;
@ -17,8 +18,11 @@ namespace TMDbLib.Client
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<SearchMovie> resp = await req.GetOfT<SearchContainer<SearchMovie>>(cancellationToken).ConfigureAwait(false);
@ -32,8 +36,11 @@ namespace TMDbLib.Client
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<SearchTv> resp = await req.GetOfT<SearchContainer<SearchTv>>(cancellationToken).ConfigureAwait(false);
@ -47,8 +54,11 @@ namespace TMDbLib.Client
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<SearchPerson> resp = await req.GetOfT<SearchContainer<SearchPerson>>(cancellationToken).ConfigureAwait(false);
@ -62,8 +72,11 @@ namespace TMDbLib.Client
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);