using System.Threading;
using System.Threading.Tasks;
using TMDbLib.Objects.TvShows;
using TMDbLib.Rest;
namespace TMDbLib.Client
{
public partial class TMDbClient
{
///
/// Retrieve a collection of tv episode groups by id
///
/// Episode group id
/// If specified the api will attempt to return a localized result. ex: en,it,es
/// A cancellation token
/// The requested collection of tv episode groups
public async Task GetTvEpisodeGroupsAsync(string id, string language = null, CancellationToken cancellationToken = default)
{
RestRequest req = _client.Create("tv/episode_group/{id}");
req.AddUrlSegment("id", id);
language ??= DefaultLanguage;
if (!string.IsNullOrWhiteSpace(language))
req.AddParameter("language", language);
using RestResponse response = await req.Get(cancellationToken).ConfigureAwait(false);
if (!response.IsValid)
return null;
return await response.GetDataObject().ConfigureAwait(false);
}
}
}