Skip to content

Commit c64abca

Browse files
authored
Merge pull request #321 from FrederikBolding/missing-tv-show-methods
Added a few missing tv show methods
2 parents cbdf51c + 80e5370 commit c64abca

File tree

5 files changed

+44
-10
lines changed

5 files changed

+44
-10
lines changed

TMDbLib/Client/TMDbClientTvEpisodes.cs

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,14 @@ public partial class TMDbClient
103103
return response;
104104
}
105105

106+
public async Task<ResultContainer<TvEpisodeInfo>> GetTvEpisodesScreenedTheatricallyAsync(int tvShowId, CancellationToken cancellationToken = default(CancellationToken))
107+
{
108+
RestRequest req = _client.Create("tv/{tv_id}/screened_theatrically");
109+
req.AddUrlSegment("tv_id", tvShowId.ToString(CultureInfo.InvariantCulture));
110+
111+
return await req.ExecuteGet<ResultContainer<TvEpisodeInfo>>(cancellationToken).ConfigureAwait(false);
112+
}
113+
106114
/// <summary>
107115
/// Returns a credits object for the specified episode.
108116
/// </summary>

TMDbLib/Objects/TvShows/TvEpisodeBase.cs

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,11 @@
33

44
namespace TMDbLib.Objects.TvShows
55
{
6-
public class TvEpisodeBase
6+
public class TvEpisodeBase : TvEpisodeInfo
77
{
88
[JsonProperty("air_date")]
99
public DateTime? AirDate { get; set; }
1010

11-
[JsonProperty("episode_number")]
12-
public int EpisodeNumber { get; set; }
13-
14-
[JsonProperty("id")]
15-
public int? Id { get; set; }
16-
1711
[JsonProperty("name")]
1812
public string Name { get; set; }
1913

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

26-
[JsonProperty("season_number")]
27-
public int SeasonNumber { get; set; }
28-
2920
[JsonProperty("show_id")]
3021
public int ShowId { get; set; }
3122

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
using Newtonsoft.Json;
2+
3+
namespace TMDbLib.Objects.TvShows
4+
{
5+
public class TvEpisodeInfo
6+
{
7+
[JsonProperty("id")]
8+
public int? Id { get; set; }
9+
10+
[JsonProperty("season_number")]
11+
public int SeasonNumber { get; set; }
12+
13+
[JsonProperty("episode_number")]
14+
public int EpisodeNumber { get; set; }
15+
}
16+
}

TMDbLibTests/ClientTvEpisodeTests.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -260,5 +260,18 @@ public void TestTvEpisodeMissing()
260260

261261
Assert.Null(tvEpisode);
262262
}
263+
264+
[Fact]
265+
public void TestTvEpisodesScreenedTheatrically()
266+
{
267+
ResultContainer<TvEpisodeInfo> results = Config.Client.GetTvEpisodesScreenedTheatricallyAsync(IdHelper.GameOfThrones).Result;
268+
269+
Assert.Equal(IdHelper.GameOfThrones, results.Id);
270+
271+
TvEpisodeInfo single = results.Results.FirstOrDefault(s => s.Id == 63103);
272+
Assert.NotNull(single);
273+
Assert.Equal(4, single.SeasonNumber);
274+
Assert.Equal(10, single.EpisodeNumber);
275+
}
263276
}
264277
}

TMDbLibTests/ClientTvShowTests.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -442,6 +442,12 @@ public void TestTvShowLatest()
442442
Assert.NotNull(tvShow);
443443
}
444444

445+
[Fact]
446+
public void TestTvShowReviews()
447+
{
448+
TestHelpers.SearchPages(i => Config.Client.GetTvShowReviewsAsync(IdHelper.BreakingBad, page: i).Result);
449+
}
450+
445451
[Fact]
446452
public void TestTvShowLists()
447453
{

0 commit comments

Comments
 (0)