Merge pull request #321 from FrederikBolding/missing-tv-show-methods

Added a few missing tv show methods
This commit is contained in:
Michael Bisbjerg 2020-03-12 13:25:01 +01:00 committed by GitHub
commit c64abcaef6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 44 additions and 10 deletions

View File

@ -103,6 +103,14 @@ namespace TMDbLib.Client
return response;
}
public async Task<ResultContainer<TvEpisodeInfo>> GetTvEpisodesScreenedTheatricallyAsync(int tvShowId, CancellationToken cancellationToken = default(CancellationToken))
{
RestRequest req = _client.Create("tv/{tv_id}/screened_theatrically");
req.AddUrlSegment("tv_id", tvShowId.ToString(CultureInfo.InvariantCulture));
return await req.ExecuteGet<ResultContainer<TvEpisodeInfo>>(cancellationToken).ConfigureAwait(false);
}
/// <summary>
/// Returns a credits object for the specified episode.
/// </summary>

View File

@ -3,17 +3,11 @@ using System;
namespace TMDbLib.Objects.TvShows
{
public class TvEpisodeBase
public class TvEpisodeBase : TvEpisodeInfo
{
[JsonProperty("air_date")]
public DateTime? AirDate { get; set; }
[JsonProperty("episode_number")]
public int EpisodeNumber { get; set; }
[JsonProperty("id")]
public int? Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
@ -23,9 +17,6 @@ namespace TMDbLib.Objects.TvShows
[JsonProperty("production_code")]
public string ProductionCode { get; set; }
[JsonProperty("season_number")]
public int SeasonNumber { get; set; }
[JsonProperty("show_id")]
public int ShowId { get; set; }

View File

@ -0,0 +1,16 @@
using Newtonsoft.Json;
namespace TMDbLib.Objects.TvShows
{
public class TvEpisodeInfo
{
[JsonProperty("id")]
public int? Id { get; set; }
[JsonProperty("season_number")]
public int SeasonNumber { get; set; }
[JsonProperty("episode_number")]
public int EpisodeNumber { get; set; }
}
}

View File

@ -260,5 +260,18 @@ namespace TMDbLibTests
Assert.Null(tvEpisode);
}
[Fact]
public void TestTvEpisodesScreenedTheatrically()
{
ResultContainer<TvEpisodeInfo> results = Config.Client.GetTvEpisodesScreenedTheatricallyAsync(IdHelper.GameOfThrones).Result;
Assert.Equal(IdHelper.GameOfThrones, results.Id);
TvEpisodeInfo single = results.Results.FirstOrDefault(s => s.Id == 63103);
Assert.NotNull(single);
Assert.Equal(4, single.SeasonNumber);
Assert.Equal(10, single.EpisodeNumber);
}
}
}

View File

@ -442,6 +442,12 @@ namespace TMDbLibTests
Assert.NotNull(tvShow);
}
[Fact]
public void TestTvShowReviews()
{
TestHelpers.SearchPages(i => Config.Client.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i).Result);
}
[Fact]
public void TestTvShowLists()
{