@retroachievements/api 1.5.1 → 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.
- package/dist/api.cjs.map +1 -1
- package/dist/api.modern.js.map +1 -1
- package/dist/api.module.js.map +1 -1
- package/dist/api.umd.js.map +1 -1
- package/dist/console/getConsoleIds.d.ts +6 -2
- package/dist/console/models/console-id.model.d.ts +1 -0
- package/dist/console/models/get-console-ids-response.model.d.ts +1 -0
- package/dist/user/models/achievement-type.model.d.ts +1 -0
- package/dist/user/models/dated-user-achievement.model.d.ts +2 -1
- package/dist/user/models/dated-user-achievements-response.model.d.ts +2 -1
- package/dist/user/models/index.d.ts +1 -0
- package/package.json +2 -4
- package/src/__playground.ts +1 -1
- package/src/achievement/getAchievementUnlocks.test.ts +10 -10
- package/src/achievement/getAchievementUnlocks.ts +3 -3
- package/src/console/getConsoleIds.test.ts +42 -10
- package/src/console/getConsoleIds.ts +8 -4
- package/src/console/getGameList.test.ts +8 -8
- package/src/console/getGameList.ts +4 -4
- package/src/console/models/console-id.model.ts +1 -0
- package/src/console/models/get-console-ids-response.model.ts +5 -1
- package/src/feed/getAchievementOfTheWeek.test.ts +19 -19
- package/src/feed/getAchievementOfTheWeek.ts +4 -4
- package/src/feed/getActiveClaims.test.ts +5 -5
- package/src/feed/getActiveClaims.ts +2 -2
- package/src/feed/getClaims.test.ts +5 -5
- package/src/feed/getClaims.ts +4 -4
- package/src/feed/getTopTenUsers.test.ts +12 -12
- package/src/feed/getTopTenUsers.ts +2 -2
- package/src/feed/models/claim-set-type.enum.ts +1 -1
- package/src/feed/models/claim-status.enum.ts +1 -1
- package/src/feed/models/claim-type.enum.ts +1 -1
- package/src/game/getAchievementCount.test.ts +3 -3
- package/src/game/getAchievementCount.ts +1 -1
- package/src/game/getAchievementDistribution.test.ts +12 -12
- package/src/game/getAchievementDistribution.ts +2 -2
- package/src/game/getGame.test.ts +3 -3
- package/src/game/getGame.ts +3 -3
- package/src/game/getGameExtended.test.ts +7 -7
- package/src/game/getGameExtended.ts +4 -4
- package/src/game/getGameRankAndScore.test.ts +6 -6
- package/src/game/getGameRankAndScore.ts +4 -4
- package/src/game/getGameRating.test.ts +5 -5
- package/src/game/getGameRating.ts +1 -1
- package/src/game/models/achievement-distribution-flags.enum.ts +1 -1
- package/src/game/models/get-game-extended-response.model.ts +1 -1
- package/src/ticket/getTicketData.test.ts +31 -31
- package/src/ticket/getTicketData.ts +5 -5
- package/src/user/getAchievementsEarnedBetween.test.ts +7 -7
- package/src/user/getAchievementsEarnedBetween.ts +4 -4
- package/src/user/getAchievementsEarnedOnDay.test.ts +7 -7
- package/src/user/getAchievementsEarnedOnDay.ts +4 -4
- package/src/user/getGameInfoAndUserProgress.test.ts +8 -8
- package/src/user/getGameInfoAndUserProgress.ts +5 -5
- package/src/user/getUserAwards.test.ts +7 -7
- package/src/user/getUserAwards.ts +1 -1
- package/src/user/getUserClaims.test.ts +6 -6
- package/src/user/getUserClaims.ts +3 -3
- package/src/user/getUserCompletedGames.test.ts +8 -8
- package/src/user/getUserCompletedGames.ts +4 -4
- package/src/user/getUserCompletionProgress.test.ts +8 -8
- package/src/user/getUserCompletionProgress.ts +3 -3
- package/src/user/getUserGameRankAndScore.test.ts +6 -6
- package/src/user/getUserGameRankAndScore.ts +3 -3
- package/src/user/getUserPoints.test.ts +3 -3
- package/src/user/getUserPoints.ts +1 -1
- package/src/user/getUserProfile.test.ts +4 -4
- package/src/user/getUserProfile.ts +3 -3
- package/src/user/getUserProgress.test.ts +8 -8
- package/src/user/getUserProgress.ts +3 -3
- package/src/user/getUserRecentAchievements.test.ts +6 -6
- package/src/user/getUserRecentAchievements.ts +3 -3
- package/src/user/getUserRecentlyPlayedGames.test.ts +6 -6
- package/src/user/getUserRecentlyPlayedGames.ts +4 -4
- package/src/user/getUserSummary.test.ts +27 -27
- package/src/user/getUserSummary.ts +4 -4
- package/src/user/models/achievement-type.model.ts +5 -0
- package/src/user/models/dated-user-achievement.model.ts +3 -1
- package/src/user/models/dated-user-achievements-response.model.ts +3 -1
- package/src/user/models/game-info-and-user-progress.model.ts +1 -1
- package/src/user/models/get-game-info-and-user-progress-response.model.ts +1 -1
- package/src/user/models/index.ts +1 -0
- package/src/utils/internal/buildRequestUrl.test.ts +2 -2
- package/src/utils/internal/buildRequestUrl.ts +1 -1
- package/src/utils/internal/call.test.ts +1 -1
- package/src/utils/internal/call.ts +1 -1
- package/src/utils/internal/serializeProperties.test.ts +20 -20
- package/src/utils/internal/serializeProperties.ts +1 -1
- package/src/utils/public/buildAuthorization.test.ts +1 -1
|
@@ -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
|
};
|
|
@@ -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,5 +16,5 @@ export type DatedUserAchievement = {
|
|
|
14
16
|
cumulScore: number;
|
|
15
17
|
badgeUrl: string;
|
|
16
18
|
gameUrl: string;
|
|
17
|
-
type:
|
|
19
|
+
type: AchievementType;
|
|
18
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,7 +16,7 @@ interface DatedUserAchievementResponseEntity {
|
|
|
14
16
|
CumulScore: number;
|
|
15
17
|
BadgeURL: string;
|
|
16
18
|
GameURL: string;
|
|
17
|
-
Type:
|
|
19
|
+
Type: AchievementType;
|
|
18
20
|
}
|
|
19
21
|
|
|
20
22
|
export type DatedUserAchievementsResponse =
|
package/src/user/models/index.ts
CHANGED
|
@@ -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)) {
|
|
@@ -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 });
|
|
@@ -15,7 +15,7 @@ describe("Util: serializeProperties", () => {
|
|
|
15
15
|
GameID: 100,
|
|
16
16
|
AchievementIDs: [1, 2, 3, 4, 5],
|
|
17
17
|
RAPoints: 100,
|
|
18
|
-
ConsoleName: "PlayStation Portable"
|
|
18
|
+
ConsoleName: "PlayStation Portable",
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
// ACT
|
|
@@ -27,7 +27,7 @@ describe("Util: serializeProperties", () => {
|
|
|
27
27
|
gameId: 100,
|
|
28
28
|
achievementIds: [1, 2, 3, 4, 5],
|
|
29
29
|
raPoints: 100,
|
|
30
|
-
consoleName: "PlayStation Portable"
|
|
30
|
+
consoleName: "PlayStation Portable",
|
|
31
31
|
});
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -39,8 +39,8 @@ describe("Util: serializeProperties", () => {
|
|
|
39
39
|
GameID: 100,
|
|
40
40
|
AchievementIDs: [1, 2, 3, 4, 5],
|
|
41
41
|
RAPoints: 100,
|
|
42
|
-
ConsoleName: "PlayStation Portable"
|
|
43
|
-
}
|
|
42
|
+
ConsoleName: "PlayStation Portable",
|
|
43
|
+
},
|
|
44
44
|
];
|
|
45
45
|
|
|
46
46
|
// ACT
|
|
@@ -53,8 +53,8 @@ describe("Util: serializeProperties", () => {
|
|
|
53
53
|
gameId: 100,
|
|
54
54
|
achievementIds: [1, 2, 3, 4, 5],
|
|
55
55
|
raPoints: 100,
|
|
56
|
-
consoleName: "PlayStation Portable"
|
|
57
|
-
}
|
|
56
|
+
consoleName: "PlayStation Portable",
|
|
57
|
+
},
|
|
58
58
|
]);
|
|
59
59
|
});
|
|
60
60
|
|
|
@@ -68,8 +68,8 @@ describe("Util: serializeProperties", () => {
|
|
|
68
68
|
ConsoleName: "PlayStation Portable",
|
|
69
69
|
UserMeta: {
|
|
70
70
|
Name: "xelnia",
|
|
71
|
-
Points: 100
|
|
72
|
-
}
|
|
71
|
+
Points: 100,
|
|
72
|
+
},
|
|
73
73
|
};
|
|
74
74
|
|
|
75
75
|
// ACT
|
|
@@ -84,8 +84,8 @@ describe("Util: serializeProperties", () => {
|
|
|
84
84
|
consoleName: "PlayStation Portable",
|
|
85
85
|
userMeta: {
|
|
86
86
|
name: "xelnia",
|
|
87
|
-
points: 100
|
|
88
|
-
}
|
|
87
|
+
points: 100,
|
|
88
|
+
},
|
|
89
89
|
});
|
|
90
90
|
});
|
|
91
91
|
|
|
@@ -95,13 +95,13 @@ describe("Util: serializeProperties", () => {
|
|
|
95
95
|
UserName: "xelnia",
|
|
96
96
|
Points: "500",
|
|
97
97
|
Metadata: {
|
|
98
|
-
TitleID: "100"
|
|
99
|
-
}
|
|
98
|
+
TitleID: "100",
|
|
99
|
+
},
|
|
100
100
|
};
|
|
101
101
|
|
|
102
102
|
// ACT
|
|
103
103
|
const sanitizedObject = serializeProperties(originalObject, {
|
|
104
|
-
shouldCastToNumbers: ["TitleID", "Points"]
|
|
104
|
+
shouldCastToNumbers: ["TitleID", "Points"],
|
|
105
105
|
});
|
|
106
106
|
|
|
107
107
|
// ASSERT
|
|
@@ -109,8 +109,8 @@ describe("Util: serializeProperties", () => {
|
|
|
109
109
|
userName: "xelnia",
|
|
110
110
|
points: 500,
|
|
111
111
|
metadata: {
|
|
112
|
-
titleId: 100
|
|
113
|
-
}
|
|
112
|
+
titleId: 100,
|
|
113
|
+
},
|
|
114
114
|
});
|
|
115
115
|
});
|
|
116
116
|
|
|
@@ -120,13 +120,13 @@ describe("Util: serializeProperties", () => {
|
|
|
120
120
|
UserName: "xelnia",
|
|
121
121
|
HardcoreMode: "0",
|
|
122
122
|
Metadata: {
|
|
123
|
-
IsCoolGuy: "1"
|
|
124
|
-
}
|
|
123
|
+
IsCoolGuy: "1",
|
|
124
|
+
},
|
|
125
125
|
};
|
|
126
126
|
|
|
127
127
|
// ACT
|
|
128
128
|
const sanitizedObject = serializeProperties(originalObject, {
|
|
129
|
-
shouldMapToBooleans: ["HardcoreMode", "IsCoolGuy"]
|
|
129
|
+
shouldMapToBooleans: ["HardcoreMode", "IsCoolGuy"],
|
|
130
130
|
});
|
|
131
131
|
|
|
132
132
|
// ASSERT
|
|
@@ -134,8 +134,8 @@ describe("Util: serializeProperties", () => {
|
|
|
134
134
|
userName: "xelnia",
|
|
135
135
|
hardcoreMode: false,
|
|
136
136
|
metadata: {
|
|
137
|
-
isCoolGuy: true
|
|
138
|
-
}
|
|
137
|
+
isCoolGuy: true,
|
|
138
|
+
},
|
|
139
139
|
});
|
|
140
140
|
});
|
|
141
141
|
});
|