@retroachievements/api 1.5.0 → 1.5.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. package/dist/api.cjs.map +1 -1
  2. package/dist/api.modern.js.map +1 -1
  3. package/dist/api.module.js.map +1 -1
  4. package/dist/api.umd.js.map +1 -1
  5. package/dist/console/getConsoleIds.d.ts +6 -2
  6. package/dist/console/models/console-id.model.d.ts +1 -0
  7. package/dist/console/models/get-console-ids-response.model.d.ts +1 -0
  8. package/dist/feed/getAchievementOfTheWeek.d.ts +3 -1
  9. package/dist/feed/models/achievement-of-the-week.model.d.ts +2 -0
  10. package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +2 -0
  11. package/dist/user/getAchievementsEarnedBetween.d.ts +2 -1
  12. package/dist/user/getAchievementsEarnedOnDay.d.ts +2 -1
  13. package/dist/user/models/achievement-type.model.d.ts +1 -0
  14. package/dist/user/models/dated-user-achievement.model.d.ts +2 -0
  15. package/dist/user/models/dated-user-achievements-response.model.d.ts +2 -0
  16. package/dist/user/models/index.d.ts +1 -0
  17. package/package.json +2 -4
  18. package/src/__playground.ts +1 -1
  19. package/src/achievement/getAchievementUnlocks.test.ts +10 -10
  20. package/src/achievement/getAchievementUnlocks.ts +3 -3
  21. package/src/console/getConsoleIds.test.ts +42 -10
  22. package/src/console/getConsoleIds.ts +8 -4
  23. package/src/console/getGameList.test.ts +8 -8
  24. package/src/console/getGameList.ts +4 -4
  25. package/src/console/models/console-id.model.ts +1 -0
  26. package/src/console/models/get-console-ids-response.model.ts +5 -1
  27. package/src/feed/getAchievementOfTheWeek.test.ts +40 -25
  28. package/src/feed/getAchievementOfTheWeek.ts +7 -5
  29. package/src/feed/getActiveClaims.test.ts +5 -5
  30. package/src/feed/getActiveClaims.ts +2 -2
  31. package/src/feed/getClaims.test.ts +5 -5
  32. package/src/feed/getClaims.ts +4 -4
  33. package/src/feed/getTopTenUsers.test.ts +12 -12
  34. package/src/feed/getTopTenUsers.ts +2 -2
  35. package/src/feed/models/achievement-of-the-week.model.ts +2 -0
  36. package/src/feed/models/claim-set-type.enum.ts +1 -1
  37. package/src/feed/models/claim-status.enum.ts +1 -1
  38. package/src/feed/models/claim-type.enum.ts +1 -1
  39. package/src/feed/models/get-achievement-of-the-week-response.model.ts +2 -0
  40. package/src/game/getAchievementCount.test.ts +3 -3
  41. package/src/game/getAchievementCount.ts +1 -1
  42. package/src/game/getAchievementDistribution.test.ts +12 -12
  43. package/src/game/getAchievementDistribution.ts +2 -2
  44. package/src/game/getGame.test.ts +3 -3
  45. package/src/game/getGame.ts +3 -3
  46. package/src/game/getGameExtended.test.ts +7 -7
  47. package/src/game/getGameExtended.ts +4 -4
  48. package/src/game/getGameRankAndScore.test.ts +6 -6
  49. package/src/game/getGameRankAndScore.ts +4 -4
  50. package/src/game/getGameRating.test.ts +5 -5
  51. package/src/game/getGameRating.ts +1 -1
  52. package/src/game/models/achievement-distribution-flags.enum.ts +1 -1
  53. package/src/game/models/get-game-extended-response.model.ts +1 -1
  54. package/src/ticket/getTicketData.test.ts +31 -31
  55. package/src/ticket/getTicketData.ts +5 -5
  56. package/src/user/getAchievementsEarnedBetween.test.ts +17 -10
  57. package/src/user/getAchievementsEarnedBetween.ts +6 -5
  58. package/src/user/getAchievementsEarnedOnDay.test.ts +17 -10
  59. package/src/user/getAchievementsEarnedOnDay.ts +6 -5
  60. package/src/user/getGameInfoAndUserProgress.test.ts +8 -8
  61. package/src/user/getGameInfoAndUserProgress.ts +5 -5
  62. package/src/user/getUserAwards.test.ts +7 -7
  63. package/src/user/getUserAwards.ts +1 -1
  64. package/src/user/getUserClaims.test.ts +6 -6
  65. package/src/user/getUserClaims.ts +3 -3
  66. package/src/user/getUserCompletedGames.test.ts +8 -8
  67. package/src/user/getUserCompletedGames.ts +4 -4
  68. package/src/user/getUserCompletionProgress.test.ts +8 -8
  69. package/src/user/getUserCompletionProgress.ts +3 -3
  70. package/src/user/getUserGameRankAndScore.test.ts +6 -6
  71. package/src/user/getUserGameRankAndScore.ts +3 -3
  72. package/src/user/getUserPoints.test.ts +3 -3
  73. package/src/user/getUserPoints.ts +1 -1
  74. package/src/user/getUserProfile.test.ts +4 -4
  75. package/src/user/getUserProfile.ts +3 -3
  76. package/src/user/getUserProgress.test.ts +8 -8
  77. package/src/user/getUserProgress.ts +3 -3
  78. package/src/user/getUserRecentAchievements.test.ts +6 -6
  79. package/src/user/getUserRecentAchievements.ts +3 -3
  80. package/src/user/getUserRecentlyPlayedGames.test.ts +6 -6
  81. package/src/user/getUserRecentlyPlayedGames.ts +4 -4
  82. package/src/user/getUserSummary.test.ts +27 -27
  83. package/src/user/getUserSummary.ts +4 -4
  84. package/src/user/models/achievement-type.model.ts +5 -0
  85. package/src/user/models/dated-user-achievement.model.ts +3 -0
  86. package/src/user/models/dated-user-achievements-response.model.ts +3 -0
  87. package/src/user/models/game-info-and-user-progress.model.ts +1 -1
  88. package/src/user/models/get-game-info-and-user-progress-response.model.ts +1 -1
  89. package/src/user/models/index.ts +1 -0
  90. package/src/utils/internal/buildRequestUrl.test.ts +2 -2
  91. package/src/utils/internal/buildRequestUrl.ts +1 -1
  92. package/src/utils/internal/call.test.ts +1 -1
  93. package/src/utils/internal/call.ts +1 -1
  94. package/src/utils/internal/serializeProperties.test.ts +20 -20
  95. package/src/utils/internal/serializeProperties.ts +1 -1
  96. package/src/utils/public/buildAuthorization.test.ts +1 -1
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { GetUserPointsResponse, UserPoints } from "./models";
@@ -23,7 +23,7 @@ describe("Function: getUserProfile", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetUserProfileResponse = {
@@ -42,7 +42,7 @@ describe("Function: getUserProfile", () => {
42
42
  Untracked: 0,
43
43
  ID: 16_446,
44
44
  UserWallActive: 1,
45
- Motto: "Join me on Twitch! GameSquadSquad for live RA"
45
+ Motto: "Join me on Twitch! GameSquadSquad for live RA",
46
46
  };
47
47
 
48
48
  server.use(
@@ -53,7 +53,7 @@ describe("Function: getUserProfile", () => {
53
53
 
54
54
  // ACT
55
55
  const response = await getUserProfile(authorization, {
56
- userName: "WCopeland"
56
+ userName: "WCopeland",
57
57
  });
58
58
 
59
59
  // ASSERT
@@ -73,7 +73,7 @@ describe("Function: getUserProfile", () => {
73
73
  untracked: false,
74
74
  id: 16_446,
75
75
  userWallActive: true,
76
- motto: "Join me on Twitch! GameSquadSquad for live RA"
76
+ motto: "Join me on Twitch! GameSquadSquad for live RA",
77
77
  });
78
78
  });
79
79
  });
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { GetUserProfileResponse, UserProfile } from "./models";
@@ -48,8 +48,8 @@ export const getUserProfile = async (
48
48
  "TotalPoints",
49
49
  "TotalSoftcorePoints",
50
50
  "TotalTruePoints",
51
- "Permissions"
51
+ "Permissions",
52
52
  ],
53
- shouldMapToBooleans: ["Untracked", "UserWallActive"]
53
+ shouldMapToBooleans: ["Untracked", "UserWallActive"],
54
54
  });
55
55
  };
@@ -23,7 +23,7 @@ describe("Function: getUserProgress", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetUserProgressResponse = {
@@ -33,7 +33,7 @@ describe("Function: getUserProgress", () => {
33
33
  NumAchieved: "4",
34
34
  ScoreAchieved: "80",
35
35
  NumAchievedHardcore: "4",
36
- ScoreAchievedHardcore: "80"
36
+ ScoreAchievedHardcore: "80",
37
37
  },
38
38
  "14402": {
39
39
  NumPossibleAchievements: "10",
@@ -41,8 +41,8 @@ describe("Function: getUserProgress", () => {
41
41
  NumAchieved: "4",
42
42
  ScoreAchieved: "80",
43
43
  NumAchievedHardcore: "4",
44
- ScoreAchievedHardcore: "80"
45
- }
44
+ ScoreAchievedHardcore: "80",
45
+ },
46
46
  };
47
47
 
48
48
  server.use(
@@ -54,7 +54,7 @@ describe("Function: getUserProgress", () => {
54
54
  // ACT
55
55
  const response = await getUserProgress(authorization, {
56
56
  userName: "xelnia",
57
- gameIds: [1, 14_402]
57
+ gameIds: [1, 14_402],
58
58
  });
59
59
 
60
60
  // ASSERT
@@ -65,7 +65,7 @@ describe("Function: getUserProgress", () => {
65
65
  numAchieved: 4,
66
66
  scoreAchieved: 80,
67
67
  numAchievedHardcore: 4,
68
- scoreAchievedHardcore: 80
68
+ scoreAchievedHardcore: 80,
69
69
  },
70
70
  "14402": {
71
71
  numPossibleAchievements: 10,
@@ -73,8 +73,8 @@ describe("Function: getUserProgress", () => {
73
73
  numAchieved: 4,
74
74
  scoreAchieved: 80,
75
75
  numAchievedHardcore: 4,
76
- scoreAchievedHardcore: 80
77
- }
76
+ scoreAchievedHardcore: 80,
77
+ },
78
78
  });
79
79
  });
80
80
  });
@@ -3,7 +3,7 @@ import {
3
3
  apiBaseUrl,
4
4
  buildRequestUrl,
5
5
  call,
6
- serializeProperties
6
+ serializeProperties,
7
7
  } from "../utils/internal";
8
8
  import type { AuthObject } from "../utils/public";
9
9
  import type { GetUserProgressResponse, UserProgress } from "./models";
@@ -73,7 +73,7 @@ export const getUserProgress = async (
73
73
  "NumAchieved",
74
74
  "ScoreAchieved",
75
75
  "NumAchievedHardcore",
76
- "ScoreAchievedHardcore"
77
- ]
76
+ "ScoreAchievedHardcore",
77
+ ],
78
78
  });
79
79
  };
@@ -23,7 +23,7 @@ describe("Function: getUserRecentAchievements", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetUserRecentAchievementsResponse = [
@@ -42,8 +42,8 @@ describe("Function: getUserRecentAchievements", () => {
42
42
  GameID: 6316,
43
43
  ConsoleName: "Game Boy",
44
44
  BadgeURL: "/Badge/121991.png",
45
- GameURL: "/game/6316"
46
- }
45
+ GameURL: "/game/6316",
46
+ },
47
47
  ];
48
48
 
49
49
  server.use(
@@ -54,7 +54,7 @@ describe("Function: getUserRecentAchievements", () => {
54
54
 
55
55
  // ACT
56
56
  const response = await getUserRecentAchievements(authorization, {
57
- userName: "xelnia"
57
+ userName: "xelnia",
58
58
  });
59
59
 
60
60
  // ASSERT
@@ -74,8 +74,8 @@ describe("Function: getUserRecentAchievements", () => {
74
74
  gameId: 6316,
75
75
  consoleName: "Game Boy",
76
76
  badgeUrl: "/Badge/121991.png",
77
- gameUrl: "/game/6316"
78
- }
77
+ gameUrl: "/game/6316",
78
+ },
79
79
  ]);
80
80
  });
81
81
  });
@@ -2,12 +2,12 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type {
9
9
  GetUserRecentAchievementsResponse,
10
- UserRecentAchievement
10
+ UserRecentAchievement,
11
11
  } from "./models";
12
12
 
13
13
  /**
@@ -75,6 +75,6 @@ export const getUserRecentAchievements = async (
75
75
  const rawResponse = await call<GetUserRecentAchievementsResponse>({ url });
76
76
 
77
77
  return serializeProperties(rawResponse, {
78
- shouldMapToBooleans: ["HardcoreMode"]
78
+ shouldMapToBooleans: ["HardcoreMode"],
79
79
  });
80
80
  };
@@ -23,7 +23,7 @@ describe("Function: getUserRecentlyPlayedGames", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetUserRecentlyPlayedGamesResponse = [
@@ -40,8 +40,8 @@ describe("Function: getUserRecentlyPlayedGames", () => {
40
40
  ScoreAchieved: 0,
41
41
  NumAchievedHardcore: 0,
42
42
  ScoreAchievedHardcore: 0,
43
- MyVote: "2"
44
- }
43
+ MyVote: "2",
44
+ },
45
45
  ];
46
46
 
47
47
  server.use(
@@ -52,7 +52,7 @@ describe("Function: getUserRecentlyPlayedGames", () => {
52
52
 
53
53
  // ACT
54
54
  const response = await getUserRecentlyPlayedGames(authorization, {
55
- userName: "xelnia"
55
+ userName: "xelnia",
56
56
  });
57
57
 
58
58
  // ASSERT
@@ -70,8 +70,8 @@ describe("Function: getUserRecentlyPlayedGames", () => {
70
70
  scoreAchieved: 0,
71
71
  numAchievedHardcore: 0,
72
72
  scoreAchievedHardcore: 0,
73
- myVote: 2
74
- }
73
+ myVote: 2,
74
+ },
75
75
  ]);
76
76
  });
77
77
  });
@@ -2,12 +2,12 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type {
9
9
  GetUserRecentlyPlayedGamesResponse,
10
- UserRecentlyPlayedGames
10
+ UserRecentlyPlayedGames,
11
11
  } from "./models";
12
12
 
13
13
  /**
@@ -88,7 +88,7 @@ export const getUserRecentlyPlayedGames = async (
88
88
  "ScoreAchieved",
89
89
  "NumAchievedHardcore",
90
90
  "ScoreAchievedHardcore",
91
- "MyVote"
92
- ]
91
+ "MyVote",
92
+ ],
93
93
  });
94
94
  };
@@ -25,7 +25,7 @@ describe("Function: getUserSummary", () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
27
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
28
+ webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
31
31
  const mockResponse = mockGetUserSummaryResponse;
@@ -38,7 +38,7 @@ describe("Function: getUserSummary", () => {
38
38
 
39
39
  // ACT
40
40
  const response = await getUserSummary(authorization, {
41
- userName: "WCopeland"
41
+ userName: "WCopeland",
42
42
  });
43
43
 
44
44
  // ASSERT
@@ -49,7 +49,7 @@ describe("Function: getUserSummary", () => {
49
49
  // ARRANGE
50
50
  const authorization = buildAuthorization({
51
51
  userName: "mockUserName",
52
- webApiKey: "mockWebApiKey"
52
+ webApiKey: "mockWebApiKey",
53
53
  });
54
54
 
55
55
  const mockResponse = "<html><body>the api is down</body></html>";
@@ -76,7 +76,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
76
76
  ConsoleName: "PlayStation 2",
77
77
  Title: "Mortal Kombat: Deadly Alliance",
78
78
  ImageIcon: "/Images/064938.png",
79
- LastPlayed: "2023-01-27 02:05:02"
79
+ LastPlayed: "2023-01-27 02:05:02",
80
80
  },
81
81
  {
82
82
  GameID: "15922",
@@ -84,8 +84,8 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
84
84
  ConsoleName: "NES",
85
85
  Title: "~Hack~ Mega Man 3 Revamped",
86
86
  ImageIcon: "/Images/061792.png",
87
- LastPlayed: "2022-11-07 21:49:09"
88
- }
87
+ LastPlayed: "2022-11-07 21:49:09",
88
+ },
89
89
  ],
90
90
  MemberSince: "2020-02-02 20:10:35",
91
91
  LastActivity: {
@@ -95,7 +95,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
95
95
  activitytype: "1",
96
96
  User: "WCopeland",
97
97
  data: "281263",
98
- data2: "1"
98
+ data2: "1",
99
99
  },
100
100
  RichPresenceMsg: "Arcade [Match 2] - Nitara vs Drahmin (Novice difficulty)",
101
101
  LastGameID: "19020",
@@ -115,7 +115,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
115
115
  Released: "November 16, 2002",
116
116
  IsFinal: false,
117
117
  ConsoleName: "PlayStation 2",
118
- RichPresencePatch: "MockRichPresencePatch"
118
+ RichPresencePatch: "MockRichPresencePatch",
119
119
  },
120
120
  ContribCount: "0",
121
121
  ContribYield: "0",
@@ -135,7 +135,7 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
135
135
  NumAchieved: "16",
136
136
  ScoreAchieved: "95",
137
137
  NumAchievedHardcore: "16",
138
- ScoreAchievedHardcore: "95"
138
+ ScoreAchievedHardcore: "95",
139
139
  },
140
140
  "6278": {
141
141
  NumPossibleAchievements: "42",
@@ -143,8 +143,8 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
143
143
  NumAchieved: 0,
144
144
  ScoreAchieved: 0,
145
145
  NumAchievedHardcore: 0,
146
- ScoreAchievedHardcore: 0
147
- }
146
+ ScoreAchievedHardcore: 0,
147
+ },
148
148
  },
149
149
  RecentAchievements: {
150
150
  "19020": {
@@ -158,15 +158,15 @@ const mockGetUserSummaryResponse: GetUserSummaryResponse = {
158
158
  BadgeName: "311063",
159
159
  IsAwarded: "1",
160
160
  DateAwarded: "2023-01-27 02:04:36",
161
- HardcoreAchieved: "0"
162
- }
163
- }
161
+ HardcoreAchieved: "0",
162
+ },
163
+ },
164
164
  },
165
165
  Points: "18817",
166
166
  SoftcorePoints: "25",
167
167
  UserPic: "/UserPic/WCopeland.png",
168
168
  TotalRanked: 34_572,
169
- Status: "Offline"
169
+ Status: "Offline",
170
170
  };
171
171
 
172
172
  const mockExpectedSummaryValue: UserSummary = {
@@ -178,7 +178,7 @@ const mockExpectedSummaryValue: UserSummary = {
178
178
  consoleName: "PlayStation 2",
179
179
  title: "Mortal Kombat: Deadly Alliance",
180
180
  imageIcon: "/Images/064938.png",
181
- lastPlayed: "2023-01-27 02:05:02"
181
+ lastPlayed: "2023-01-27 02:05:02",
182
182
  },
183
183
  {
184
184
  gameId: 15_922,
@@ -186,8 +186,8 @@ const mockExpectedSummaryValue: UserSummary = {
186
186
  consoleName: "NES",
187
187
  title: "~Hack~ Mega Man 3 Revamped",
188
188
  imageIcon: "/Images/061792.png",
189
- lastPlayed: "2022-11-07 21:49:09"
190
- }
189
+ lastPlayed: "2022-11-07 21:49:09",
190
+ },
191
191
  ],
192
192
  memberSince: "2020-02-02 20:10:35",
193
193
  lastActivity: {
@@ -197,7 +197,7 @@ const mockExpectedSummaryValue: UserSummary = {
197
197
  activitytype: 1,
198
198
  user: "WCopeland",
199
199
  data: "281263",
200
- data2: "1"
200
+ data2: "1",
201
201
  },
202
202
  richPresenceMsg: "Arcade [Match 2] - Nitara vs Drahmin (Novice difficulty)",
203
203
  lastGameId: 19_020,
@@ -217,7 +217,7 @@ const mockExpectedSummaryValue: UserSummary = {
217
217
  released: "November 16, 2002",
218
218
  isFinal: false,
219
219
  consoleName: "PlayStation 2",
220
- richPresencePatch: "MockRichPresencePatch"
220
+ richPresencePatch: "MockRichPresencePatch",
221
221
  },
222
222
  contribCount: 0,
223
223
  contribYield: 0,
@@ -237,7 +237,7 @@ const mockExpectedSummaryValue: UserSummary = {
237
237
  numAchieved: 16,
238
238
  scoreAchieved: 95,
239
239
  numAchievedHardcore: 16,
240
- scoreAchievedHardcore: 95
240
+ scoreAchievedHardcore: 95,
241
241
  },
242
242
  "6278": {
243
243
  numPossibleAchievements: 42,
@@ -245,8 +245,8 @@ const mockExpectedSummaryValue: UserSummary = {
245
245
  numAchieved: 0,
246
246
  scoreAchieved: 0,
247
247
  numAchievedHardcore: 0,
248
- scoreAchievedHardcore: 0
249
- }
248
+ scoreAchievedHardcore: 0,
249
+ },
250
250
  },
251
251
  recentAchievements: {
252
252
  19_020: {
@@ -260,13 +260,13 @@ const mockExpectedSummaryValue: UserSummary = {
260
260
  badgeName: "311063",
261
261
  isAwarded: true,
262
262
  dateAwarded: "2023-01-27 02:04:36",
263
- hardcoreAchieved: false
264
- }
265
- }
263
+ hardcoreAchieved: false,
264
+ },
265
+ },
266
266
  },
267
267
  points: 18_817,
268
268
  softcorePoints: 25,
269
269
  userPic: "/UserPic/WCopeland.png",
270
270
  totalRanked: 34_572,
271
- status: "Offline"
271
+ status: "Offline",
272
272
  };
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { GetUserSummaryResponse, UserSummary } from "./models";
@@ -82,13 +82,13 @@ export const getUserSummary = async (
82
82
  "NumAchievedHardcore",
83
83
  "ScoreAchievedHardcore",
84
84
  "Points",
85
- "SoftcorePoints"
85
+ "SoftcorePoints",
86
86
  ],
87
87
  shouldMapToBooleans: [
88
88
  "Untracked",
89
89
  "UserWallActive",
90
90
  "IsAwarded",
91
- "HardcoreAchieved"
92
- ]
91
+ "HardcoreAchieved",
92
+ ],
93
93
  });
94
94
  };
@@ -0,0 +1,5 @@
1
+ export type AchievementType =
2
+ | "progression"
3
+ | "win_condition"
4
+ | "missable"
5
+ | null;
@@ -1,3 +1,5 @@
1
+ import type { AchievementType } from "./achievement-type.model";
2
+
1
3
  export type DatedUserAchievement = {
2
4
  date: string;
3
5
  hardcoreMode: boolean;
@@ -14,4 +16,5 @@ export type DatedUserAchievement = {
14
16
  cumulScore: number;
15
17
  badgeUrl: string;
16
18
  gameUrl: string;
19
+ type: AchievementType;
17
20
  };
@@ -1,3 +1,5 @@
1
+ import type { AchievementType } from "./achievement-type.model";
2
+
1
3
  interface DatedUserAchievementResponseEntity {
2
4
  Date: string;
3
5
  HardcoreMode: string;
@@ -14,6 +16,7 @@ interface DatedUserAchievementResponseEntity {
14
16
  CumulScore: number;
15
17
  BadgeURL: string;
16
18
  GameURL: string;
19
+ Type: AchievementType;
17
20
  }
18
21
 
19
22
  export type DatedUserAchievementsResponse =
@@ -1,6 +1,6 @@
1
1
  import type {
2
2
  GameExtended,
3
- GameExtendedAchievementEntity
3
+ GameExtendedAchievementEntity,
4
4
  } from "../../game/models";
5
5
 
6
6
  export type GameExtendedAchievementEntityWithUserProgress =
@@ -1,6 +1,6 @@
1
1
  import type {
2
2
  GameExtendedRawAchievementEntity,
3
- GetGameExtendedResponse
3
+ GetGameExtendedResponse,
4
4
  } from "../../game/models";
5
5
 
6
6
  type GetGameExtendedResponseWithoutClaims = Omit<
@@ -1,3 +1,4 @@
1
+ export * from "./achievement-type.model";
1
2
  export * from "./award-type.model";
2
3
  export * from "./dated-user-achievement.model";
3
4
  export * from "./dated-user-achievements-response.model";
@@ -15,7 +15,7 @@ describe("Util: buildRequestUrl", () => {
15
15
  baz: "myBazValue",
16
16
  limit: 10,
17
17
  offset: 2,
18
- notDefined: undefined
18
+ notDefined: undefined,
19
19
  };
20
20
 
21
21
  // ACT
@@ -40,7 +40,7 @@ describe("Util: buildRequestUrl", () => {
40
40
  // ACT
41
41
  const requestUrl = buildRequestUrl(baseUrl, endpointUrl, {
42
42
  userName: "TestUser",
43
- webApiKey: "mockWebApiKey"
43
+ webApiKey: "mockWebApiKey",
44
44
  });
45
45
 
46
46
  // ASSERT
@@ -15,7 +15,7 @@ export const buildRequestUrl = (
15
15
  // Authentication is handled purely by query params.
16
16
  const queryParamValues: Record<string, string> = {
17
17
  z: authObject.userName,
18
- y: authObject.webApiKey
18
+ y: authObject.webApiKey,
19
19
  };
20
20
 
21
21
  for (const [argKey, argValue] of Object.entries(args)) {
@@ -44,7 +44,7 @@ describe("Util: call", () => {
44
44
  server.use(
45
45
  http.get(mockRequestUrl, () =>
46
46
  HttpResponse.text("<HTML><BODY>something bad happened</BODY></HTML>", {
47
- status: 503
47
+ status: 503,
48
48
  })
49
49
  )
50
50
  );
@@ -16,7 +16,7 @@ export const call = async <
16
16
  const { url } = config;
17
17
 
18
18
  const headers = new Headers({
19
- "User-Agent": `RetroAchievements-api-js/${packageVersion}`
19
+ "User-Agent": `RetroAchievements-api-js/${packageVersion}`,
20
20
  });
21
21
 
22
22
  const rawResponse = await fetch(url, { headers });