Skip to content
This repository was archived by the owner on Mar 16, 2025. It is now read-only.

Commit 47f246d

Browse files
[v2] Add episode images (#674)
1 parent 2f2541a commit 47f246d

File tree

13 files changed

+222
-16
lines changed

13 files changed

+222
-16
lines changed

src/libs/Trakt.NET/Internal/Json/SerializerContexts/EpisodesJsonSerializerContext.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,15 @@ namespace TraktNET
66
{
77
[ExcludeFromCodeCoverage]
88
[JsonSerializable(typeof(TraktEpisode))]
9+
[JsonSerializable(typeof(IReadOnlyList<TraktEpisode>))]
910
[JsonSerializable(typeof(TraktEpisodeIDs))]
11+
[JsonSerializable(typeof(IReadOnlyList<TraktEpisodeIDs>))]
12+
[JsonSerializable(typeof(TraktEpisodeImages))]
13+
[JsonSerializable(typeof(IReadOnlyList<TraktEpisodeImages>))]
1014
[JsonSerializable(typeof(TraktEpisodeMinimal))]
15+
[JsonSerializable(typeof(IReadOnlyList<TraktEpisodeMinimal>))]
1116
[JsonSerializable(typeof(TraktEpisodeTranslation))]
17+
[JsonSerializable(typeof(IReadOnlyList<TraktEpisodeTranslation>))]
1218
public sealed partial class EpisodesJsonSerializerContext : JsonSerializerContext
1319
{
1420
}

src/libs/Trakt.NET/Internal/Json/SerializerContexts/JsonSerializerContextFactory.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ internal static JsonSerializerContext GetContext<TJsonObjectType>()
150150
{
151151
typeof(TraktEpisode),
152152
typeof(TraktEpisodeIDs),
153+
typeof(TraktEpisodeImages),
153154
typeof(TraktEpisodeMinimal),
154155
typeof(TraktEpisodeTranslation)
155156
});
@@ -267,6 +268,7 @@ internal static JsonSerializerContext GetContext<TJsonObjectType>()
267268
private static readonly HashSet<Type> s_episodeJsonTypes = [
268269
typeof(TraktEpisode),
269270
typeof(TraktEpisodeIDs),
271+
typeof(TraktEpisodeImages),
270272
typeof(TraktEpisodeMinimal),
271273
typeof(TraktEpisodeTranslation)
272274
];
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace TraktNET
2+
{
3+
/// <summary>A collection of Trakt episode image URLs.</summary>
4+
public record class TraktEpisodeImages
5+
{
6+
/// <summary>A list of Screenshot image URLs.</summary>
7+
public List<string>? Screenshot { get; set; }
8+
}
9+
}

src/libs/Trakt.NET/Json/Episodes/TraktEpisodeMinimal.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,12 @@ public record class TraktEpisodeMinimal
2121
[JsonPropertyName("ids")]
2222
public TraktEpisodeIDs? IDs { get; set; }
2323

24+
/// <summary>
25+
/// The collection of image URLs for the episode.
26+
/// See also <seealso cref="TraktEpisodeImages" />.
27+
/// </summary>
28+
public TraktEpisodeImages? Images { get; set; }
29+
2430
/// <summary>Gets a string representation of the episode.</summary>
2531
/// <returns>A string representation of the episode.</returns>
2632
public override string ToString()

src/libs/Trakt.NET/Json/Movies/TraktMovieImages.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ namespace TraktNET
33
/// <summary>A collection of Trakt movie image URLs.</summary>
44
public record class TraktMovieImages
55
{
6-
/// <summary>A List of Fanart image URLs.</summary>
6+
/// <summary>A list of Fanart image URLs.</summary>
77
public List<string>? Fanart { get; set; }
88

9-
/// <summary>A List of Poster image URLs.</summary>
9+
/// <summary>A list of Poster image URLs.</summary>
1010
public List<string>? Poster { get; set; }
1111

12-
/// <summary>A List of Logo image URLs.</summary>
12+
/// <summary>A list of Logo image URLs.</summary>
1313
public List<string>? Logo { get; set; }
1414

15-
/// <summary>A List of Clearart image URLs.</summary>
15+
/// <summary>A list of Clearart image URLs.</summary>
1616
public List<string>? Clearart { get; set; }
1717

18-
/// <summary>A List of Banner image URLs.</summary>
18+
/// <summary>A list of Banner image URLs.</summary>
1919
public List<string>? Banner { get; set; }
2020

21-
/// <summary>A List of Thumbnail image URLs.</summary>
21+
/// <summary>A list of Thumbnail image URLs.</summary>
2222
public List<string>? Thumb { get; set; }
2323
}
2424
}

src/libs/Trakt.NET/Json/Seasons/TraktSeasonImages.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ namespace TraktNET
33
/// <summary>A collection of Trakt season image URLs.</summary>
44
public record class TraktSeasonImages
55
{
6-
/// <summary>A List of Poster image URLs.</summary>
6+
/// <summary>A list of Poster image URLs.</summary>
77
public List<string>? Poster { get; set; }
88

9-
/// <summary>A List of Thumbnail image URLs.</summary>
9+
/// <summary>A list of Thumbnail image URLs.</summary>
1010
public List<string>? Thumb { get; set; }
1111
}
1212
}

src/libs/Trakt.NET/Json/Shows/TraktShowImages.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@ namespace TraktNET
33
/// <summary>A collection of Trakt show image URLs.</summary>
44
public record class TraktShowImages
55
{
6-
/// <summary>A List of Fanart image URLs.</summary>
6+
/// <summary>A list of Fanart image URLs.</summary>
77
public List<string>? Fanart { get; set; }
88

9-
/// <summary>A List of Poster image URLs.</summary>
9+
/// <summary>A list of Poster image URLs.</summary>
1010
public List<string>? Poster { get; set; }
1111

12-
/// <summary>A List of Logo image URLs.</summary>
12+
/// <summary>A list of Logo image URLs.</summary>
1313
public List<string>? Logo { get; set; }
1414

15-
/// <summary>A List of Clearart image URLs.</summary>
15+
/// <summary>A list of Clearart image URLs.</summary>
1616
public List<string>? Clearart { get; set; }
1717

18-
/// <summary>A List of Banner image URLs.</summary>
18+
/// <summary>A list of Banner image URLs.</summary>
1919
public List<string>? Banner { get; set; }
2020

21-
/// <summary>A List of Thumbnail image URLs.</summary>
21+
/// <summary>A list of Thumbnail image URLs.</summary>
2222
public List<string>? Thumb { get; set; }
2323
}
2424
}
File renamed without changes.
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
{
2+
"season": 1,
3+
"number": 1,
4+
"title": "Winter Is Coming",
5+
"ids": {
6+
"trakt": 73640,
7+
"tvdb": 3254641,
8+
"imdb": "tt1480055",
9+
"tmdb": 63056,
10+
"tvrage": null
11+
},
12+
"number_abs": 1,
13+
"overview": "Jon Arryn, the Hand of the King, is dead. King Robert Baratheon plans to ask his oldest friend, Eddard Stark, to take Jon's place. Across the sea, Viserys Targaryen plans to wed his sister to a nomadic warlord in exchange for an army.",
14+
"rating": 8.08208,
15+
"votes": 14619,
16+
"comment_count": 38,
17+
"first_aired": "2011-04-18T01:00:00.000Z",
18+
"updated_at": "2024-03-22T18:44:49.000Z",
19+
"available_translations": [
20+
"ar",
21+
"bg",
22+
"bs",
23+
"ca",
24+
"cs",
25+
"da",
26+
"de",
27+
"el",
28+
"en",
29+
"es",
30+
"fa",
31+
"fi",
32+
"fr",
33+
"he",
34+
"hu",
35+
"it",
36+
"ja",
37+
"ko",
38+
"nl",
39+
"no",
40+
"pl",
41+
"pt",
42+
"ro",
43+
"ru",
44+
"sk",
45+
"sl",
46+
"sv",
47+
"tr",
48+
"uk",
49+
"zh"
50+
],
51+
"runtime": 62,
52+
"episode_type": "series_premiere",
53+
"images": {
54+
"screenshot": [
55+
"walter-r2.trakt.tv/images/episodes/000/073/640/screenshots/medium/66c1ba1793.jpg.webp"
56+
]
57+
}
58+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"season": 1,
3+
"number": 1,
4+
"title": "Winter Is Coming",
5+
"ids": {
6+
"trakt": 73640,
7+
"tvdb": 3254641,
8+
"imdb": "tt1480055",
9+
"tmdb": 63056,
10+
"tvrage": null
11+
},
12+
"images": {
13+
"screenshot": [
14+
"walter-r2.trakt.tv/images/episodes/000/073/640/screenshots/medium/66c1ba1793.jpg.webp"
15+
]
16+
}
17+
}

0 commit comments

Comments
 (0)