using System.Threading;
using System.Threading.Tasks;
using TMDbLib.Objects.General;
using TMDbLib.Rest;
namespace TMDbLib.Client
{
public partial class TMDbClient
{
///
/// Returns a list of all of the countries TMDb has watch provider (OTT/streaming) data for.
///
/// A cancellation token
/// Uses to translate data
public async Task> GetWatchProviderRegionsAsync(CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("watch/providers/regions");
if (DefaultLanguage != null)
req.AddParameter("language", DefaultLanguage);
ResultContainer response = await req.GetOfT>(cancellationToken).ConfigureAwait(false);
return response;
}
///
/// Returns a list of the watch provider (OTT/streaming) data TMDb has available for movies.
///
/// A cancellation token
/// Uses and to filter or translate data
public async Task> GetMovieWatchProvidersAsync(CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("watch/providers/movie");
if (DefaultLanguage != null)
req.AddParameter("language", DefaultLanguage);
if (DefaultCountry != null)
req.AddParameter("watch_region", DefaultCountry);
ResultContainer response = await req.GetOfT>(cancellationToken).ConfigureAwait(false);
return response;
}
///
/// Returns a list of the watch provider (OTT/streaming) data TMDb has available for shows.
///
/// A cancellation token
/// Uses and to filter or translate data
public async Task> GetTvWatchProvidersAsync(CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("watch/providers/tv");
if (DefaultLanguage != null)
req.AddParameter("language", DefaultLanguage);
if (DefaultCountry != null)
req.AddParameter("watch_region", DefaultCountry);
ResultContainer response = await req.GetOfT>(cancellationToken).ConfigureAwait(false);
return response;
}
}
}