Skip to content

Commit 5b625b3

Browse files
refactor!: Model and endpoint changes for Aug 2025 API update (#45)
Updates for August 2025 migration --------- Co-authored-by: codename-irvin <brian.budge@protonmail.com>
1 parent 0f9f4ce commit 5b625b3

31 files changed

+314
-355
lines changed

IGDB.Tests/Dumps.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ public async Task ShouldReturnDumpsList()
3131
[Fact]
3232
public async Task ShouldReturnGamesEndpointDump()
3333
{
34-
var gameDump = await _api.GetDataDumpEndpointAsync("games");
34+
var gameDump = await _api.GetDataDumpEndpointAsync(IGDBClient.Endpoints.Games);
3535

3636
Assert.NotNull(gameDump);
3737
Assert.NotNull(gameDump.S3Url);

IGDB.Tests/GameTimeToBeats.cs

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
using System;
2+
using System.Threading.Tasks;
3+
using Xunit;
4+
5+
namespace IGDB.Tests
6+
{
7+
public class GameTimeToBeats
8+
{
9+
IGDBClient _api;
10+
11+
public GameTimeToBeats()
12+
{
13+
_api = new IGDB.IGDBClient(
14+
Environment.GetEnvironmentVariable("IGDB_CLIENT_ID"),
15+
Environment.GetEnvironmentVariable("IGDB_CLIENT_SECRET")
16+
);
17+
}
18+
19+
[Fact]
20+
public async Task Should_Return_GameTimeToBeat_Data()
21+
{
22+
var games = await _api.QueryAsync<IGDB.Models.GameTimeToBeat>(IGDBClient.Endpoints.GameTimeToBeats, query: "fields *; where id = 3575;");
23+
Assert.NotNull(games);
24+
Assert.NotEmpty(games);
25+
Assert.Equal(3575, games[0].Id);
26+
Assert.Equal(201711, games[0].GameId);
27+
Assert.Equal(1, games[0].Count);
28+
Assert.Equal(14400, games[0].Hastily);
29+
Assert.Equal(28800, games[0].Normally);
30+
Assert.Equal(32400, games[0].Completely);
31+
}
32+
}
33+
}

IGDB.Tests/Games.cs

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,38 @@ public async Task ShouldReturnResponseWithSingleGameExpandedCover()
103103
Assert.Equal(756, game.Cover.Value.Width);
104104
}
105105

106+
[Fact]
107+
public async Task ShouldReturnResponseWithExpandedTableEnumFieldsForAug2025Migration()
108+
{
109+
var games = await _api.QueryAsync<Game>(IGDBClient.Endpoints.Games, "fields id,game_type.type,game_status.status; where id = 52625;");
110+
111+
Assert.NotNull(games);
112+
113+
var game = games[0];
114+
115+
Assert.NotNull(game.GameStatus.Value);
116+
Assert.Equal("Cancelled", game.GameStatus.Value.Status);
117+
118+
Assert.NotNull(game.GameType.Value);
119+
Assert.Equal("Main Game", game.GameType.Value.Type);
120+
}
121+
122+
[Fact]
123+
public async Task ShouldReturnResponseWithNonExpandedTableEnumFieldsForAug2025Migration()
124+
{
125+
var games = await _api.QueryAsync<Game>(IGDBClient.Endpoints.Games, "fields id,game_type,game_status; where id = 52625;");
126+
127+
Assert.NotNull(games);
128+
129+
var game = games[0];
130+
131+
Assert.NotNull(game.GameStatus.Id);
132+
Assert.Equal(6, game.GameStatus.Id);
133+
134+
Assert.NotNull(game.GameType.Id);
135+
Assert.Equal(0, game.GameType.Id);
136+
}
137+
106138
[Fact]
107139
public async Task ShouldReturnResponseWithUnixTimestamp()
108140
{

IGDB/IGDBApi.cs

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,23 +252,34 @@ public static bool IsInvalidTokenResponse(ApiException ex)
252252
public static class Endpoints
253253
{
254254
public const string AgeRating = "age_ratings";
255-
public const string AgeRatingContentDescriptions = "age_rating_content_descriptions";
255+
public const string AgeRatingCategories = "age_rating_categories";
256+
public const string AgeRatingContentDescriptionsV2 = "age_rating_content_descriptions_v2";
257+
public const string AgeRatingOrganizations = "age_rating_organizations";
256258
public const string AlternativeNames = "alternative_names";
257259
public const string Artworks = "artworks";
258260
public const string Characters = "characters";
261+
public const string CharacterGenders = "character_genders";
259262
public const string CharacterMugShots = "character_mug_shots";
263+
public const string CharacterSpecies = "character_species";
260264
public const string Collections = "collections";
261265
public const string Companies = "companies";
266+
public const string CompanyStatus = "company_status";
262267
public const string CompanyWebsites = "company_websites";
263268
public const string CompanyLogos = "company_logos";
264269
public const string Covers = "covers";
270+
public const string DateFormats = "date_formats";
265271
public const string ExternalGames = "external_games";
272+
public const string ExternalGameSources = "external_game_sources";
266273
public const string Franchies = "franchises";
267274
public const string Games = "games";
268275
public const string GameEngines = "game_engines";
269276
public const string GameEngineLogos = "game_engine_logos";
270277
public const string GameVersions = "game_versions";
271278
public const string GameModes = "game_modes";
279+
public const string GameReleaseFormats = "game_release_formats";
280+
public const string GameStatuses = "game_statuses";
281+
public const string GameTimeToBeats = "game_time_to_beats";
282+
public const string GameTypes = "game_types";
272283
public const string GameVersionFeatures = "game_version_features";
273284
public const string GameVersionFeatureValues = "game_version_feature_values";
274285
public const string GameVideos = "game_videos";
@@ -279,16 +290,19 @@ public static class Endpoints
279290
public const string Platforms = "platforms";
280291
public const string PlatformFamilies = "platform_families";
281292
public const string PlatformLogos = "platform_logos";
293+
public const string PlatformTypes = "platform_types";
282294
public const string PlatformVersions = "platform_versions";
283295
public const string PlatformVersionCompanies = "platform_version_companies";
284296
public const string PlatformVersionReleaseDates = "platform_version_release_dates";
285297
public const string PlatformWebsites = "platform_websites";
286298
public const string PlayerPerspectives = "player_perspectives";
287299
public const string ReleaseDates = "release_dates";
300+
public const string ReleaseDateRegions = "release_date_regions";
288301
public const string Screenshots = "screenshots";
289302
public const string Search = "search";
290303
public const string Themes = "themes";
291304
public const string Websites = "websites";
305+
public const string WebsiteTypes = "website_types";
292306
}
293307
}
294308
}

IGDB/Models/AgeRating.cs

Lines changed: 4 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -2,66 +2,12 @@ namespace IGDB.Models
22
{
33
public class AgeRating : IIdentifier, IHasChecksum
44
{
5-
public AgeRatingCategory? Category { get; set; }
65
public string Checksum { get; set; }
7-
public IdentitiesOrValues<AgeRatingContentDescription> ContentDescriptions { get; set; }
8-
public long? Id { get; set; }
9-
public AgeRatingTitle? Rating { get; set; }
6+
public IdentityOrValue<AgeRatingOrganization> Organization { get; set; }
7+
public IdentityOrValue<AgeRatingCategory> RatingCategory { get; set; }
8+
public IdentitiesOrValues<AgeRatingContentDescriptionV2> RatingContentDescriptions { get; set; }
109
public string RatingCoverUrl { get; set; }
1110
public string Synopsis { get; set; }
12-
}
13-
14-
public enum AgeRatingCategory
15-
{
16-
ESRB = 1,
17-
PEGI = 2,
18-
CERO = 3,
19-
USK = 4,
20-
GRAC = 5,
21-
CLASS_IND = 6,
22-
ACB = 7
23-
}
24-
25-
public enum AgeRatingTitle
26-
{
27-
Three = 1,
28-
Seven = 2,
29-
Twelve = 3,
30-
Sixteen = 4,
31-
Eighteen = 5,
32-
RP = 6,
33-
EC = 7,
34-
E = 8,
35-
E10 = 9,
36-
T = 10,
37-
M = 11,
38-
AO = 12,
39-
CERO_A = 13,
40-
CERO_B = 14,
41-
CERO_C = 15,
42-
CERO_D = 16,
43-
CERO_Z = 17,
44-
USK_0 = 18,
45-
USK_6 = 19,
46-
USK_12 = 20,
47-
USK_16 = 21,
48-
USK_18 = 22,
49-
GRAC_All = 23,
50-
GRAC_Twelve = 24,
51-
GRAC_Fifteen = 25,
52-
GRAC_Eighteen = 26,
53-
GRAC_Testing = 27,
54-
CLASS_IND_L = 28,
55-
CLASS_IND_Ten = 29,
56-
CLASS_IND_Twelve = 30,
57-
CLASS_IND_Fourteen = 31,
58-
CLASS_IND_Sixteen = 32,
59-
CLASS_IND_Eighteen = 33,
60-
ACB_G = 34,
61-
ACB_PG = 35,
62-
ACB_M = 36,
63-
ACB_MA15 = 37,
64-
ACB_R18 = 38,
65-
ACB_RC = 39,
11+
public long? Id { get; set; }
6612
}
6713
}

IGDB/Models/AgeRatingCategory.cs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
3+
namespace IGDB.Models
4+
{
5+
public class AgeRatingCategory : ITimestamps, IIdentifier, IHasChecksum
6+
{
7+
public string Checksum { get; set; }
8+
public DateTimeOffset? CreatedAt { get; set; }
9+
public IdentityOrValue<AgeRatingOrganization> Organization { get; set; }
10+
public string Rating { get; set; }
11+
public long? Id { get; set; }
12+
public DateTimeOffset? UpdatedAt { get; set; }
13+
}
14+
}

IGDB/Models/AgeRatingContentDescription.cs

Lines changed: 0 additions & 99 deletions
This file was deleted.
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
using System;
2+
3+
namespace IGDB.Models
4+
{
5+
public class AgeRatingContentDescriptionV2 : ITimestamps, IIdentifier, IHasChecksum
6+
{
7+
public string Checksum { get; set; }
8+
public DateTimeOffset? CreatedAt { get; set; }
9+
public IdentityOrValue<AgeRatingOrganization> Organization { get; set; }
10+
public string Description { get; set; }
11+
public long? Id { get; set; }
12+
public DateTimeOffset? UpdatedAt { get; set; }
13+
}
14+
}

IGDB/Models/AgeRatingOrganization.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
namespace IGDB.Models
2+
{
3+
public class AgeRatingOrganization : IIdentifier, IHasChecksum
4+
{
5+
public string Checksum { get; set; }
6+
public string Name { get; set; }
7+
public long? Id { get; set; }
8+
}
9+
}

IGDB/Models/Character.cs

Lines changed: 2 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -5,34 +5,18 @@ namespace IGDB.Models
55
public class Character : ITimestamps, IIdentifier, IHasChecksum
66
{
77
public string[] Akas { get; set; }
8+
public IdentityOrValue<CharacterGender> CharacterGender { get; set; }
9+
public IdentityOrValue<CharacterSpecies> CharacterSpecies { get; set; }
810
public string Checksum { get; set; }
911
public string CountryName { get; set; }
1012
public DateTimeOffset? CreatedAt { get; set; }
1113
public string Description { get; set; }
1214
public IdentitiesOrValues<Game> Games { get; set; }
13-
public Gender? Gender { get; set; }
1415
public long? Id { get; set; }
1516
public IdentityOrValue<CharacterMugShot> MugShot { get; set; }
1617
public string Name { get; set; }
1718
public string Slug { get; set; }
18-
public Species? Species { get; set; }
1919
public DateTimeOffset? UpdatedAt { get; set; }
2020
public string Url { get; set; }
2121
}
22-
23-
public enum Gender
24-
{
25-
Male = 1,
26-
Female = 2,
27-
Other = 3
28-
}
29-
30-
public enum Species
31-
{
32-
Human = 1,
33-
Alien = 2,
34-
Animal = 3,
35-
Android = 4,
36-
Unknown = 5
37-
}
3822
}

0 commit comments

Comments
 (0)