Skip to content

Commit

Permalink
Merge pull request #321 from FrederikBolding/missing-tv-show-methods
Browse files Browse the repository at this point in the history
Added a few missing tv show methods
  • Loading branch information
LordMike authored Mar 12, 2020
2 parents cbdf51c + 80e5370 commit c64abca
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 10 deletions.
8 changes: 8 additions & 0 deletions TMDbLib/Client/TMDbClientTvEpisodes.cs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,14 @@ public partial class TMDbClient
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>
Expand Down
11 changes: 1 addition & 10 deletions TMDbLib/Objects/TvShows/TvEpisodeBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,17 +3,11 @@

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; }

Expand All @@ -23,9 +17,6 @@ public class TvEpisodeBase
[JsonProperty("production_code")]
public string ProductionCode { get; set; }

[JsonProperty("season_number")]
public int SeasonNumber { get; set; }

[JsonProperty("show_id")]
public int ShowId { get; set; }

Expand Down
16 changes: 16 additions & 0 deletions TMDbLib/Objects/TvShows/TvEpisodeInfo.cs
Original file line number Diff line number Diff line change
@@ -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; }
}
}
13 changes: 13 additions & 0 deletions TMDbLibTests/ClientTvEpisodeTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -260,5 +260,18 @@ public void TestTvEpisodeMissing()

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);
}
}
}
6 changes: 6 additions & 0 deletions TMDbLibTests/ClientTvShowTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -442,6 +442,12 @@ public void TestTvShowLatest()
Assert.NotNull(tvShow);
}

[Fact]
public void TestTvShowReviews()
{
TestHelpers.SearchPages(i => Config.Client.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i).Result);
}

[Fact]
public void TestTvShowLists()
{
Expand Down

0 comments on commit c64abca

Please sign in to comment.