using System.Globalization;
using System.Threading;
using System.Threading.Tasks;
using TMDbLib.Objects.General;
using TMDbLib.Objects.TvShows;
using TMDbLib.Rest;
namespace TMDbLib.Client
{
public partial class TMDbClient
{
///
/// Retrieves a network by it's TMDb id. A network is a distributor of media content ex. HBO, AMC
///
/// The id of the network object to retrieve
/// A cancellation token
public async Task GetNetworkAsync(int networkId, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("network/{networkId}");
req.AddUrlSegment("networkId", networkId.ToString(CultureInfo.InvariantCulture));
Network response = await req.GetOfT(cancellationToken).ConfigureAwait(false);
return response;
}
///
/// Gets the logos of a network given a TMDb id
///
/// The TMDb id of the network
/// A cancellation token
public async Task GetNetworkImagesAsync(int networkId, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("network/{networkId}/images");
req.AddUrlSegment("networkId", networkId.ToString(CultureInfo.InvariantCulture));
NetworkLogos response = await req.GetOfT(cancellationToken).ConfigureAwait(false);
return response;
}
///
/// Gets the alternative names of a network given a TMDb id
///
/// The TMDb id of the network
/// A cancellation token
public async Task GetNetworkAlternativeNamesAsync(int networkId, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("network/{networkId}/alternative_names");
req.AddUrlSegment("networkId", networkId.ToString(CultureInfo.InvariantCulture));
AlternativeNames response = await req.GetOfT(cancellationToken).ConfigureAwait(false);
return response;
}
}
}