mirror of
https://github.com/jellyfin/TMDbLib.git
synced 2024-11-23 05:40:12 +00:00
localized trending calls
This commit is contained in:
parent
6420364178
commit
e62ea5c826
@ -10,39 +10,45 @@ namespace TMDbLib.Client
|
|||||||
{
|
{
|
||||||
public partial class TMDbClient
|
public partial class TMDbClient
|
||||||
{
|
{
|
||||||
public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
public async Task<SearchContainer<SearchMovie>> GetTrendingMoviesAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
RestRequest req = _client.Create("trending/movie/{time_window}");
|
RestRequest req = _client.Create("trending/movie/{time_window}");
|
||||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||||
|
|
||||||
if (page >= 1)
|
if (page >= 1)
|
||||||
req.AddQueryString("page", page.ToString());
|
req.AddQueryString("page", page.ToString());
|
||||||
|
if (language != null)
|
||||||
|
req.AddQueryString("language", language);
|
||||||
|
|
||||||
SearchContainer<SearchMovie> resp = await req.GetOfT<SearchContainer<SearchMovie>>(cancellationToken).ConfigureAwait(false);
|
SearchContainer<SearchMovie> resp = await req.GetOfT<SearchContainer<SearchMovie>>(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
public async Task<SearchContainer<SearchTv>> GetTrendingTvAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
RestRequest req = _client.Create("trending/tv/{time_window}");
|
RestRequest req = _client.Create("trending/tv/{time_window}");
|
||||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||||
|
|
||||||
if (page >= 1)
|
if (page >= 1)
|
||||||
req.AddQueryString("page", page.ToString());
|
req.AddQueryString("page", page.ToString());
|
||||||
|
if (language != null)
|
||||||
|
req.AddQueryString("language", language);
|
||||||
|
|
||||||
SearchContainer<SearchTv> resp = await req.GetOfT<SearchContainer<SearchTv>>(cancellationToken).ConfigureAwait(false);
|
SearchContainer<SearchTv> resp = await req.GetOfT<SearchContainer<SearchTv>>(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
return resp;
|
return resp;
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, CancellationToken cancellationToken = default)
|
public async Task<SearchContainer<SearchPerson>> GetTrendingPeopleAsync(TimeWindow timeWindow, int page = 0, string language = null, CancellationToken cancellationToken = default)
|
||||||
{
|
{
|
||||||
RestRequest req = _client.Create("trending/person/{time_window}");
|
RestRequest req = _client.Create("trending/person/{time_window}");
|
||||||
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
req.AddUrlSegment("time_window", timeWindow.GetDescription());
|
||||||
|
|
||||||
if (page >= 1)
|
if (page >= 1)
|
||||||
req.AddQueryString("page", page.ToString());
|
req.AddQueryString("page", page.ToString());
|
||||||
|
if (language != null)
|
||||||
|
req.AddQueryString("language", language);
|
||||||
|
|
||||||
SearchContainer<SearchPerson> resp = await req.GetOfT<SearchContainer<SearchPerson>>(cancellationToken).ConfigureAwait(false);
|
SearchContainer<SearchPerson> resp = await req.GetOfT<SearchContainer<SearchPerson>>(cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user