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

Commit 2f2541a

Browse files
[v2] Add season images (#674)
1 parent eb62bd0 commit 2f2541a

File tree

12 files changed

+468
-4
lines changed

12 files changed

+468
-4
lines changed

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

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -207,6 +207,7 @@ internal static JsonSerializerContext GetContext<TJsonObjectType>()
207207
{
208208
typeof(TraktSeason),
209209
typeof(TraktSeasonIDs),
210+
typeof(TraktSeasonImages),
210211
typeof(TraktSeasonMinimal)
211212
});
212213

@@ -318,6 +319,7 @@ internal static JsonSerializerContext GetContext<TJsonObjectType>()
318319
private static readonly HashSet<Type> s_seasonsJsonTypes = [
319320
typeof(TraktSeason),
320321
typeof(TraktSeasonIDs),
322+
typeof(TraktSeasonImages),
321323
typeof(TraktSeasonMinimal)
322324
];
323325

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

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@ namespace TraktNET
66
{
77
[ExcludeFromCodeCoverage]
88
[JsonSerializable(typeof(TraktSeason))]
9+
[JsonSerializable(typeof(IReadOnlyList<TraktSeason>))]
910
[JsonSerializable(typeof(TraktSeasonIDs))]
11+
[JsonSerializable(typeof(IReadOnlyList<TraktSeasonIDs>))]
12+
[JsonSerializable(typeof(TraktSeasonImages))]
13+
[JsonSerializable(typeof(IReadOnlyList<TraktSeasonImages>))]
1014
[JsonSerializable(typeof(TraktSeasonMinimal))]
15+
[JsonSerializable(typeof(IReadOnlyList<TraktSeasonMinimal>))]
1116
public sealed partial class SeasonsJsonSerializerContext : JsonSerializerContext
1217
{
1318
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
namespace TraktNET
2+
{
3+
/// <summary>A collection of Trakt season image URLs.</summary>
4+
public record class TraktSeasonImages
5+
{
6+
/// <summary>A List of Poster image URLs.</summary>
7+
public List<string>? Poster { get; set; }
8+
9+
/// <summary>A List of Thumbnail image URLs.</summary>
10+
public List<string>? Thumb { get; set; }
11+
}
12+
}

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,11 @@ public record class TraktSeasonMinimal
1414
/// </summary>
1515
[JsonPropertyName("ids")]
1616
public TraktSeasonIDs? IDs { get; set; }
17+
18+
/// <summary>
19+
/// The collection of image URLs for the season.
20+
/// See also <seealso cref="TraktSeasonImages" />.
21+
/// </summary>
22+
public TraktSeasonImages? Images { get; set; }
1723
}
1824
}
File renamed without changes.

src/tests/libs/JsonData/Seasons/season_with_episodes.json renamed to src/tests/libs/JsonData/Seasons/season_full_episodes.json

File renamed without changes.
Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
{
2+
"number": 1,
3+
"ids": {
4+
"trakt": 3963,
5+
"tvdb": 364731,
6+
"tmdb": 3624,
7+
"tvrage": null
8+
},
9+
"rating": 8.96076,
10+
"votes": 4970,
11+
"episode_count": 10,
12+
"aired_episodes": 10,
13+
"title": "Season 1",
14+
"overview": "Trouble is brewing in the Seven Kingdoms of Westeros.",
15+
"first_aired": "2011-04-18T01:00:00.000Z",
16+
"updated_at": "2024-03-23T06:24:59.000Z",
17+
"network": "HBO",
18+
"episodes": [
19+
{
20+
"season": 1,
21+
"number": 1,
22+
"title": "Winter Is Coming",
23+
"ids": {
24+
"trakt": 73640,
25+
"tvdb": 3254641,
26+
"imdb": "tt1480055",
27+
"tmdb": 63056,
28+
"tvrage": null
29+
}
30+
},
31+
{
32+
"season": 1,
33+
"number": 2,
34+
"title": "The Kingsroad",
35+
"ids": {
36+
"trakt": 73641,
37+
"tvdb": 3436411,
38+
"imdb": "tt1668746",
39+
"tmdb": 63057,
40+
"tvrage": null
41+
}
42+
},
43+
{
44+
"season": 1,
45+
"number": 3,
46+
"title": "Lord Snow",
47+
"ids": {
48+
"trakt": 73642,
49+
"tvdb": 3436421,
50+
"imdb": "tt1829962",
51+
"tmdb": 63058,
52+
"tvrage": null
53+
}
54+
},
55+
{
56+
"season": 1,
57+
"number": 4,
58+
"title": "Cripples, Bastards, and Broken Things",
59+
"ids": {
60+
"trakt": 73643,
61+
"tvdb": 3436431,
62+
"imdb": "tt1829963",
63+
"tmdb": 63059,
64+
"tvrage": null
65+
}
66+
},
67+
{
68+
"season": 1,
69+
"number": 5,
70+
"title": "The Wolf and the Lion",
71+
"ids": {
72+
"trakt": 73644,
73+
"tvdb": 3436441,
74+
"imdb": "tt1829964",
75+
"tmdb": 63060,
76+
"tvrage": null
77+
}
78+
},
79+
{
80+
"season": 1,
81+
"number": 6,
82+
"title": "A Golden Crown",
83+
"ids": {
84+
"trakt": 73645,
85+
"tvdb": 3436451,
86+
"imdb": "tt1837862",
87+
"tmdb": 63061,
88+
"tvrage": null
89+
}
90+
},
91+
{
92+
"season": 1,
93+
"number": 7,
94+
"title": "You Win or You Die",
95+
"ids": {
96+
"trakt": 73646,
97+
"tvdb": 3436461,
98+
"imdb": "tt1837863",
99+
"tmdb": 63062,
100+
"tvrage": null
101+
}
102+
},
103+
{
104+
"season": 1,
105+
"number": 8,
106+
"title": "The Pointy End",
107+
"ids": {
108+
"trakt": 73647,
109+
"tvdb": 3360391,
110+
"imdb": "tt1837864",
111+
"tmdb": 63063,
112+
"tvrage": null
113+
}
114+
},
115+
{
116+
"season": 1,
117+
"number": 9,
118+
"title": "Baelor",
119+
"ids": {
120+
"trakt": 73648,
121+
"tvdb": 4063481,
122+
"imdb": "tt1851398",
123+
"tmdb": 63064,
124+
"tvrage": null
125+
}
126+
},
127+
{
128+
"season": 1,
129+
"number": 10,
130+
"title": "Fire and Blood",
131+
"ids": {
132+
"trakt": 73649,
133+
"tvdb": 4063491,
134+
"imdb": "tt1851397",
135+
"tmdb": 63065,
136+
"tvrage": null
137+
}
138+
}
139+
],
140+
"images": {
141+
"poster": [
142+
"walter-r2.trakt.tv/images/seasons/000/003/963/posters/thumb/15e611179e.jpg.webp"
143+
],
144+
"thumb": [
145+
"walter-r2.trakt.tv/images/seasons/000/003/963/thumbs/medium/6c996deed7.jpg.webp"
146+
]
147+
}
148+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
{
2+
"number": 1,
3+
"ids": {
4+
"trakt": 3963,
5+
"tvdb": 364731,
6+
"tmdb": 3624,
7+
"tvrage": null
8+
},
9+
"rating": 8.96076,
10+
"votes": 4970,
11+
"episode_count": 10,
12+
"aired_episodes": 10,
13+
"title": "Season 1",
14+
"overview": "Trouble is brewing in the Seven Kingdoms of Westeros.",
15+
"first_aired": "2011-04-18T01:00:00.000Z",
16+
"updated_at": "2024-03-23T06:24:59.000Z",
17+
"network": "HBO",
18+
"images": {
19+
"poster": [
20+
"walter-r2.trakt.tv/images/seasons/000/003/963/posters/thumb/15e611179e.jpg.webp"
21+
],
22+
"thumb": [
23+
"walter-r2.trakt.tv/images/seasons/000/003/963/thumbs/medium/6c996deed7.jpg.webp"
24+
]
25+
}
26+
}
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
{
2+
"number": 1,
3+
"ids": {
4+
"trakt": 3963,
5+
"tvdb": 364731,
6+
"tmdb": 3624,
7+
"tvrage": null
8+
},
9+
"images": {
10+
"poster": [
11+
"walter-r2.trakt.tv/images/seasons/000/003/963/posters/thumb/15e611179e.jpg.webp"
12+
],
13+
"thumb": [
14+
"walter-r2.trakt.tv/images/seasons/000/003/963/thumbs/medium/6c996deed7.jpg.webp"
15+
]
16+
}
17+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
{
2+
"poster": [
3+
"walter-r2.trakt.tv/images/seasons/000/003/963/posters/thumb/15e611179e.jpg.webp"
4+
],
5+
"thumb": [
6+
"walter-r2.trakt.tv/images/seasons/000/003/963/thumbs/medium/6c996deed7.jpg.webp"
7+
]
8+
}

0 commit comments

Comments
 (0)