@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.
- 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/feed/getAchievementOfTheWeek.d.ts +3 -1
- package/dist/feed/models/achievement-of-the-week.model.d.ts +2 -0
- package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +2 -0
- package/dist/user/getAchievementsEarnedBetween.d.ts +2 -1
- package/dist/user/getAchievementsEarnedOnDay.d.ts +2 -1
- package/dist/user/models/achievement-type.model.d.ts +1 -0
- package/dist/user/models/dated-user-achievement.model.d.ts +2 -0
- package/dist/user/models/dated-user-achievements-response.model.d.ts +2 -0
- 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 +40 -25
- package/src/feed/getAchievementOfTheWeek.ts +7 -5
- 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/achievement-of-the-week.model.ts +2 -0
- 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/feed/models/get-achievement-of-the-week-response.model.ts +2 -0
- 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 +17 -10
- package/src/user/getAchievementsEarnedBetween.ts +6 -5
- package/src/user/getAchievementsEarnedOnDay.test.ts +17 -10
- package/src/user/getAchievementsEarnedOnDay.ts +6 -5
- 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 -0
- package/src/user/models/dated-user-achievements-response.model.ts +3 -0
- 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 {
|
|
@@ -12,7 +12,7 @@ import type {
|
|
|
12
12
|
MostTicketedGames,
|
|
13
13
|
RecentTickets,
|
|
14
14
|
TicketEntity,
|
|
15
|
-
UserTicketStats
|
|
15
|
+
UserTicketStats,
|
|
16
16
|
} from "./models";
|
|
17
17
|
|
|
18
18
|
interface GetTicketDataAllPayloadValues {
|
|
@@ -222,9 +222,9 @@ export async function getTicketData(
|
|
|
222
222
|
"GameID",
|
|
223
223
|
"ReportType",
|
|
224
224
|
"ReportState",
|
|
225
|
-
"OpenTickets"
|
|
225
|
+
"OpenTickets",
|
|
226
226
|
],
|
|
227
|
-
shouldMapToBooleans: ["Hardcore"]
|
|
227
|
+
shouldMapToBooleans: ["Hardcore"],
|
|
228
228
|
});
|
|
229
229
|
}
|
|
230
230
|
|
|
@@ -238,7 +238,7 @@ const buildGetTicketDataQueryParams = (
|
|
|
238
238
|
gameId,
|
|
239
239
|
isGettingTicketsForUnofficialAchievements,
|
|
240
240
|
shouldReturnTicketsList,
|
|
241
|
-
achievementId
|
|
241
|
+
achievementId,
|
|
242
242
|
} = payload;
|
|
243
243
|
|
|
244
244
|
let queryParams: Record<string, string | number> = {};
|
|
@@ -4,7 +4,10 @@ import { setupServer } from "msw/node";
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
5
5
|
import { buildAuthorization } from "../utils/public";
|
|
6
6
|
import { getAchievementsEarnedBetween } from "./getAchievementsEarnedBetween";
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
DatedUserAchievement,
|
|
9
|
+
DatedUserAchievementsResponse,
|
|
10
|
+
} from "./models";
|
|
8
11
|
|
|
9
12
|
const server = setupServer();
|
|
10
13
|
|
|
@@ -23,7 +26,7 @@ describe("Function: getAchievementsEarnedBetween", () => {
|
|
|
23
26
|
// ARRANGE
|
|
24
27
|
const authorization = buildAuthorization({
|
|
25
28
|
userName: "mockUserName",
|
|
26
|
-
webApiKey: "mockWebApiKey"
|
|
29
|
+
webApiKey: "mockWebApiKey",
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
const mockResponse: DatedUserAchievementsResponse = [
|
|
@@ -42,8 +45,9 @@ describe("Function: getAchievementsEarnedBetween", () => {
|
|
|
42
45
|
ConsoleName: "PlayStation Portable",
|
|
43
46
|
CumulScore: 40,
|
|
44
47
|
BadgeURL: "/Badge/193797.png",
|
|
45
|
-
GameURL: "/game/3571"
|
|
46
|
-
|
|
48
|
+
GameURL: "/game/3571",
|
|
49
|
+
Type: "progression",
|
|
50
|
+
},
|
|
47
51
|
];
|
|
48
52
|
|
|
49
53
|
server.use(
|
|
@@ -56,11 +60,10 @@ describe("Function: getAchievementsEarnedBetween", () => {
|
|
|
56
60
|
const response = await getAchievementsEarnedBetween(authorization, {
|
|
57
61
|
userName: "xelnia",
|
|
58
62
|
fromDate: new Date("2022-10-12"),
|
|
59
|
-
toDate: new Date("2022-10-13")
|
|
63
|
+
toDate: new Date("2022-10-13"),
|
|
60
64
|
});
|
|
61
65
|
|
|
62
|
-
|
|
63
|
-
expect(response).toEqual([
|
|
66
|
+
const expectedResponse: DatedUserAchievement[] = [
|
|
64
67
|
{
|
|
65
68
|
date: "2022-10-12 07:36:31",
|
|
66
69
|
hardcoreMode: true,
|
|
@@ -76,8 +79,12 @@ describe("Function: getAchievementsEarnedBetween", () => {
|
|
|
76
79
|
consoleName: "PlayStation Portable",
|
|
77
80
|
cumulScore: 40,
|
|
78
81
|
badgeUrl: "/Badge/193797.png",
|
|
79
|
-
gameUrl: "/game/3571"
|
|
80
|
-
|
|
81
|
-
|
|
82
|
+
gameUrl: "/game/3571",
|
|
83
|
+
type: "progression",
|
|
84
|
+
},
|
|
85
|
+
];
|
|
86
|
+
|
|
87
|
+
// ASSERT
|
|
88
|
+
expect(response).toEqual(expectedResponse);
|
|
82
89
|
});
|
|
83
90
|
});
|
|
@@ -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
|
DatedUserAchievement,
|
|
10
|
-
DatedUserAchievementsResponse
|
|
10
|
+
DatedUserAchievementsResponse,
|
|
11
11
|
} from "./models";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -57,7 +57,8 @@ import type {
|
|
|
57
57
|
* consoleName: 'PlayStation Portable',
|
|
58
58
|
* cumulScore: 120,
|
|
59
59
|
* badgeUrl: '/Badge/193756.png',
|
|
60
|
-
* gameUrl: '/game/3571'
|
|
60
|
+
* gameUrl: '/game/3571',
|
|
61
|
+
* type: 'progression'
|
|
61
62
|
* }
|
|
62
63
|
* ]
|
|
63
64
|
* ```
|
|
@@ -75,7 +76,7 @@ export const getAchievementsEarnedBetween = async (
|
|
|
75
76
|
{
|
|
76
77
|
u: userName,
|
|
77
78
|
f: (fromDate.getTime() / 1000).toFixed(0),
|
|
78
|
-
t: (toDate.getTime() / 1000).toFixed(0)
|
|
79
|
+
t: (toDate.getTime() / 1000).toFixed(0),
|
|
79
80
|
}
|
|
80
81
|
);
|
|
81
82
|
|
|
@@ -83,6 +84,6 @@ export const getAchievementsEarnedBetween = async (
|
|
|
83
84
|
|
|
84
85
|
return serializeProperties(rawResponse, {
|
|
85
86
|
shouldCastToNumbers: ["AchievementID", "Points", "GameID"],
|
|
86
|
-
shouldMapToBooleans: ["HardcoreMode"]
|
|
87
|
+
shouldMapToBooleans: ["HardcoreMode"],
|
|
87
88
|
});
|
|
88
89
|
};
|
|
@@ -4,7 +4,10 @@ import { setupServer } from "msw/node";
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
5
5
|
import { buildAuthorization } from "../utils/public";
|
|
6
6
|
import { getAchievementsEarnedOnDay } from "./getAchievementsEarnedOnDay";
|
|
7
|
-
import type {
|
|
7
|
+
import type {
|
|
8
|
+
DatedUserAchievement,
|
|
9
|
+
DatedUserAchievementsResponse,
|
|
10
|
+
} from "./models";
|
|
8
11
|
|
|
9
12
|
const server = setupServer();
|
|
10
13
|
|
|
@@ -23,7 +26,7 @@ describe("Function: getAchievementsEarnedOnDay", () => {
|
|
|
23
26
|
// ARRANGE
|
|
24
27
|
const authorization = buildAuthorization({
|
|
25
28
|
userName: "mockUserName",
|
|
26
|
-
webApiKey: "mockWebApiKey"
|
|
29
|
+
webApiKey: "mockWebApiKey",
|
|
27
30
|
});
|
|
28
31
|
|
|
29
32
|
const mockResponse: DatedUserAchievementsResponse = [
|
|
@@ -42,8 +45,9 @@ describe("Function: getAchievementsEarnedOnDay", () => {
|
|
|
42
45
|
ConsoleName: "PlayStation Portable",
|
|
43
46
|
CumulScore: 40,
|
|
44
47
|
BadgeURL: "/Badge/193797.png",
|
|
45
|
-
GameURL: "/game/3571"
|
|
46
|
-
|
|
48
|
+
GameURL: "/game/3571",
|
|
49
|
+
Type: null,
|
|
50
|
+
},
|
|
47
51
|
];
|
|
48
52
|
|
|
49
53
|
server.use(
|
|
@@ -55,11 +59,10 @@ describe("Function: getAchievementsEarnedOnDay", () => {
|
|
|
55
59
|
// ACT
|
|
56
60
|
const response = await getAchievementsEarnedOnDay(authorization, {
|
|
57
61
|
userName: "xelnia",
|
|
58
|
-
onDate: new Date("2022-10-12")
|
|
62
|
+
onDate: new Date("2022-10-12"),
|
|
59
63
|
});
|
|
60
64
|
|
|
61
|
-
|
|
62
|
-
expect(response).toEqual([
|
|
65
|
+
const expectedResponse: DatedUserAchievement[] = [
|
|
63
66
|
{
|
|
64
67
|
date: "2022-10-12 07:36:31",
|
|
65
68
|
hardcoreMode: true,
|
|
@@ -75,8 +78,12 @@ describe("Function: getAchievementsEarnedOnDay", () => {
|
|
|
75
78
|
consoleName: "PlayStation Portable",
|
|
76
79
|
cumulScore: 40,
|
|
77
80
|
badgeUrl: "/Badge/193797.png",
|
|
78
|
-
gameUrl: "/game/3571"
|
|
79
|
-
|
|
80
|
-
|
|
81
|
+
gameUrl: "/game/3571",
|
|
82
|
+
type: null,
|
|
83
|
+
},
|
|
84
|
+
];
|
|
85
|
+
|
|
86
|
+
// ASSERT
|
|
87
|
+
expect(response).toEqual(expectedResponse);
|
|
81
88
|
});
|
|
82
89
|
});
|
|
@@ -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
|
DatedUserAchievement,
|
|
10
|
-
DatedUserAchievementsResponse
|
|
10
|
+
DatedUserAchievementsResponse,
|
|
11
11
|
} from "./models";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -56,7 +56,8 @@ import type {
|
|
|
56
56
|
* consoleName: 'PlayStation Portable',
|
|
57
57
|
* cumulScore: 120,
|
|
58
58
|
* badgeUrl: '/Badge/193756.png',
|
|
59
|
-
* gameUrl: '/game/3571'
|
|
59
|
+
* gameUrl: '/game/3571',
|
|
60
|
+
* type: 'progression'
|
|
60
61
|
* }
|
|
61
62
|
* ]
|
|
62
63
|
* ```
|
|
@@ -74,7 +75,7 @@ export const getAchievementsEarnedOnDay = async (
|
|
|
74
75
|
{
|
|
75
76
|
u: userName,
|
|
76
77
|
// YYYY-MM-DD
|
|
77
|
-
d: `${onDate.getFullYear()}-${onDate.getMonth() + 1}-${onDate.getDate()}
|
|
78
|
+
d: `${onDate.getFullYear()}-${onDate.getMonth() + 1}-${onDate.getDate()}`,
|
|
78
79
|
}
|
|
79
80
|
);
|
|
80
81
|
|
|
@@ -82,6 +83,6 @@ export const getAchievementsEarnedOnDay = async (
|
|
|
82
83
|
|
|
83
84
|
return serializeProperties(rawResponse, {
|
|
84
85
|
shouldCastToNumbers: ["AchievementID", "Points", "GameID"],
|
|
85
|
-
shouldMapToBooleans: ["HardcoreMode"]
|
|
86
|
+
shouldMapToBooleans: ["HardcoreMode"],
|
|
86
87
|
});
|
|
87
88
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getGameInfoAndUserProgress", () => {
|
|
|
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: GetGameInfoAndUserProgressResponse = {
|
|
@@ -64,13 +64,13 @@ describe("Function: getGameInfoAndUserProgress", () => {
|
|
|
64
64
|
DisplayOrder: "0",
|
|
65
65
|
MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582",
|
|
66
66
|
DateEarned: "2022-08-23 22:56:38",
|
|
67
|
-
DateEarnedHardcore: "2022-08-23 22:56:38"
|
|
68
|
-
}
|
|
67
|
+
DateEarnedHardcore: "2022-08-23 22:56:38",
|
|
68
|
+
},
|
|
69
69
|
},
|
|
70
70
|
NumAwardedToUser: 12,
|
|
71
71
|
NumAwardedToUserHardcore: 12,
|
|
72
72
|
UserCompletion: "100.00%",
|
|
73
|
-
UserCompletionHardcore: "100.00%"
|
|
73
|
+
UserCompletionHardcore: "100.00%",
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
server.use(
|
|
@@ -82,7 +82,7 @@ describe("Function: getGameInfoAndUserProgress", () => {
|
|
|
82
82
|
// ACT
|
|
83
83
|
const response = await getGameInfoAndUserProgress(authorization, {
|
|
84
84
|
gameId: 14_402,
|
|
85
|
-
userName: "xelnia"
|
|
85
|
+
userName: "xelnia",
|
|
86
86
|
});
|
|
87
87
|
|
|
88
88
|
// ASSERT
|
|
@@ -122,13 +122,13 @@ describe("Function: getGameInfoAndUserProgress", () => {
|
|
|
122
122
|
displayOrder: 0,
|
|
123
123
|
memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582",
|
|
124
124
|
dateEarned: "2022-08-23 22:56:38",
|
|
125
|
-
dateEarnedHardcore: "2022-08-23 22:56:38"
|
|
126
|
-
}
|
|
125
|
+
dateEarnedHardcore: "2022-08-23 22:56:38",
|
|
126
|
+
},
|
|
127
127
|
},
|
|
128
128
|
numAwardedToUser: 12,
|
|
129
129
|
numAwardedToUserHardcore: 12,
|
|
130
130
|
userCompletion: "100.00%",
|
|
131
|
-
userCompletionHardcore: "100.00%"
|
|
131
|
+
userCompletionHardcore: "100.00%",
|
|
132
132
|
});
|
|
133
133
|
});
|
|
134
134
|
});
|
|
@@ -3,12 +3,12 @@ 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 {
|
|
10
10
|
GameInfoAndUserProgress,
|
|
11
|
-
GetGameInfoAndUserProgressResponse
|
|
11
|
+
GetGameInfoAndUserProgressResponse,
|
|
12
12
|
} from "./models";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -97,7 +97,7 @@ export const getGameInfoAndUserProgress = async (
|
|
|
97
97
|
authorization,
|
|
98
98
|
{
|
|
99
99
|
g: gameId,
|
|
100
|
-
u: userName
|
|
100
|
+
u: userName,
|
|
101
101
|
}
|
|
102
102
|
);
|
|
103
103
|
|
|
@@ -113,7 +113,7 @@ export const getGameInfoAndUserProgress = async (
|
|
|
113
113
|
"DisplayOrder",
|
|
114
114
|
"NumDistinctPlayersCasual",
|
|
115
115
|
"NumDistinctPlayersHardcore",
|
|
116
|
-
"Released"
|
|
117
|
-
]
|
|
116
|
+
"Released",
|
|
117
|
+
],
|
|
118
118
|
});
|
|
119
119
|
};
|
|
@@ -23,7 +23,7 @@ describe("Function: getUserAwards", () => {
|
|
|
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: GetUserAwardsResponse = {
|
|
@@ -45,9 +45,9 @@ describe("Function: getUserAwards", () => {
|
|
|
45
45
|
Title: "WarioWare, Inc.: Mega Microgames!",
|
|
46
46
|
ConsoleName: "Game Boy Advance",
|
|
47
47
|
Flags: null,
|
|
48
|
-
ImageIcon: "/Images/034678.png"
|
|
49
|
-
}
|
|
50
|
-
]
|
|
48
|
+
ImageIcon: "/Images/034678.png",
|
|
49
|
+
},
|
|
50
|
+
],
|
|
51
51
|
};
|
|
52
52
|
|
|
53
53
|
server.use(
|
|
@@ -79,9 +79,9 @@ describe("Function: getUserAwards", () => {
|
|
|
79
79
|
title: "WarioWare, Inc.: Mega Microgames!",
|
|
80
80
|
consoleName: "Game Boy Advance",
|
|
81
81
|
flags: null,
|
|
82
|
-
imageIcon: "/Images/034678.png"
|
|
83
|
-
}
|
|
84
|
-
]
|
|
82
|
+
imageIcon: "/Images/034678.png",
|
|
83
|
+
},
|
|
84
|
+
],
|
|
85
85
|
});
|
|
86
86
|
});
|
|
87
87
|
});
|
|
@@ -24,7 +24,7 @@ describe("Function: getUserClaims", () => {
|
|
|
24
24
|
it("given a username, retrieves a list of achievement set claims for the user", async () => {
|
|
25
25
|
const authorization = buildAuthorization({
|
|
26
26
|
userName: "mockUserName",
|
|
27
|
-
webApiKey: "mockWebApiKey"
|
|
27
|
+
webApiKey: "mockWebApiKey",
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
const mockResponse: GetUserClaimsResponse = [
|
|
@@ -43,8 +43,8 @@ describe("Function: getUserClaims", () => {
|
|
|
43
43
|
Created: "2017-08-20 00:00:00",
|
|
44
44
|
DoneTime: "2017-08-20 00:00:00",
|
|
45
45
|
Updated: "2022-06-28 17:15:59",
|
|
46
|
-
MinutesLeft: "-2862348"
|
|
47
|
-
}
|
|
46
|
+
MinutesLeft: "-2862348",
|
|
47
|
+
},
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
server.use(
|
|
@@ -55,7 +55,7 @@ describe("Function: getUserClaims", () => {
|
|
|
55
55
|
|
|
56
56
|
// ACT
|
|
57
57
|
const response = await getUserClaims(authorization, {
|
|
58
|
-
userName: "Jamiras"
|
|
58
|
+
userName: "Jamiras",
|
|
59
59
|
});
|
|
60
60
|
|
|
61
61
|
// ASSERT
|
|
@@ -75,8 +75,8 @@ describe("Function: getUserClaims", () => {
|
|
|
75
75
|
created: "2017-08-20 00:00:00",
|
|
76
76
|
doneTime: "2017-08-20 00:00:00",
|
|
77
77
|
updated: "2022-06-28 17:15:59",
|
|
78
|
-
minutesLeft: -2_862_348
|
|
79
|
-
}
|
|
78
|
+
minutesLeft: -2_862_348,
|
|
79
|
+
},
|
|
80
80
|
]);
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -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 { GetUserClaimsResponse, UserClaims } from "./models";
|
|
@@ -53,7 +53,7 @@ export const getUserClaims = async (
|
|
|
53
53
|
"Status",
|
|
54
54
|
"Extension",
|
|
55
55
|
"Special",
|
|
56
|
-
"MinutesLeft"
|
|
57
|
-
]
|
|
56
|
+
"MinutesLeft",
|
|
57
|
+
],
|
|
58
58
|
});
|
|
59
59
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
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: GetUserCompletedGamesResponse = [
|
|
@@ -38,7 +38,7 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
38
38
|
MaxPossible: "26",
|
|
39
39
|
NumAwarded: "12",
|
|
40
40
|
PctWon: "0.4615",
|
|
41
|
-
HardcoreMode: "0"
|
|
41
|
+
HardcoreMode: "0",
|
|
42
42
|
},
|
|
43
43
|
{
|
|
44
44
|
GameID: "1881",
|
|
@@ -49,8 +49,8 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
49
49
|
MaxPossible: "26",
|
|
50
50
|
NumAwarded: "12",
|
|
51
51
|
PctWon: "0.4615",
|
|
52
|
-
HardcoreMode: "1"
|
|
53
|
-
}
|
|
52
|
+
HardcoreMode: "1",
|
|
53
|
+
},
|
|
54
54
|
];
|
|
55
55
|
|
|
56
56
|
server.use(
|
|
@@ -61,7 +61,7 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
61
61
|
|
|
62
62
|
// ACT
|
|
63
63
|
const response = await getUserCompletedGames(authorization, {
|
|
64
|
-
userName: "xelnia"
|
|
64
|
+
userName: "xelnia",
|
|
65
65
|
});
|
|
66
66
|
|
|
67
67
|
// ASSERT
|
|
@@ -75,7 +75,7 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
75
75
|
maxPossible: 26,
|
|
76
76
|
numAwarded: 12,
|
|
77
77
|
pctWon: 0.4615,
|
|
78
|
-
hardcoreMode: false
|
|
78
|
+
hardcoreMode: false,
|
|
79
79
|
},
|
|
80
80
|
{
|
|
81
81
|
gameId: 1881,
|
|
@@ -86,8 +86,8 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
86
86
|
maxPossible: 26,
|
|
87
87
|
numAwarded: 12,
|
|
88
88
|
pctWon: 0.4615,
|
|
89
|
-
hardcoreMode: true
|
|
90
|
-
}
|
|
89
|
+
hardcoreMode: true,
|
|
90
|
+
},
|
|
91
91
|
]);
|
|
92
92
|
});
|
|
93
93
|
});
|
|
@@ -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
|
GetUserCompletedGamesResponse,
|
|
10
|
-
UserCompletedGames
|
|
10
|
+
UserCompletedGames,
|
|
11
11
|
} from "./models";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -82,8 +82,8 @@ export const getUserCompletedGames = async (
|
|
|
82
82
|
"ConsoleID",
|
|
83
83
|
"MaxPossible",
|
|
84
84
|
"NumAwarded",
|
|
85
|
-
"PctWon"
|
|
85
|
+
"PctWon",
|
|
86
86
|
],
|
|
87
|
-
shouldMapToBooleans: ["HardcoreMode"]
|
|
87
|
+
shouldMapToBooleans: ["HardcoreMode"],
|
|
88
88
|
});
|
|
89
89
|
};
|
|
@@ -23,7 +23,7 @@ describe("Function: getUserCompletionProgress", () => {
|
|
|
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: GetUserCompletionProgressResponse = {
|
|
@@ -41,9 +41,9 @@ describe("Function: getUserCompletionProgress", () => {
|
|
|
41
41
|
NumAwardedHardcore: 8,
|
|
42
42
|
MostRecentAwardedDate: "2022-07-26T23:56:15+00:00",
|
|
43
43
|
HighestAwardKind: null,
|
|
44
|
-
HighestAwardDate: null
|
|
45
|
-
}
|
|
46
|
-
]
|
|
44
|
+
HighestAwardDate: null,
|
|
45
|
+
},
|
|
46
|
+
],
|
|
47
47
|
};
|
|
48
48
|
|
|
49
49
|
server.use(
|
|
@@ -54,7 +54,7 @@ describe("Function: getUserCompletionProgress", () => {
|
|
|
54
54
|
|
|
55
55
|
// ACT
|
|
56
56
|
const response = await getUserCompletionProgress(authorization, {
|
|
57
|
-
userName: "xelnia"
|
|
57
|
+
userName: "xelnia",
|
|
58
58
|
});
|
|
59
59
|
|
|
60
60
|
// ASSERT
|
|
@@ -73,9 +73,9 @@ describe("Function: getUserCompletionProgress", () => {
|
|
|
73
73
|
numAwardedHardcore: 8,
|
|
74
74
|
mostRecentAwardedDate: "2022-07-26T23:56:15+00:00",
|
|
75
75
|
highestAwardKind: null,
|
|
76
|
-
highestAwardDate: null
|
|
77
|
-
}
|
|
78
|
-
]
|
|
76
|
+
highestAwardDate: null,
|
|
77
|
+
},
|
|
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
|
GetUserCompletionProgressResponse,
|
|
10
|
-
UserCompletionProgress
|
|
10
|
+
UserCompletionProgress,
|
|
11
11
|
} from "./models";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -61,7 +61,7 @@ export const getUserCompletionProgress = async (
|
|
|
61
61
|
const { userName, offset, count } = payload;
|
|
62
62
|
|
|
63
63
|
const params: Record<string, string | number> = {
|
|
64
|
-
u: userName
|
|
64
|
+
u: userName,
|
|
65
65
|
};
|
|
66
66
|
if (offset) {
|
|
67
67
|
params["o"] = offset;
|
|
@@ -23,7 +23,7 @@ describe("Function: getUserGameRankAndScore", () => {
|
|
|
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: GetUserGameRankAndScoreResponse = [
|
|
@@ -31,8 +31,8 @@ describe("Function: getUserGameRankAndScore", () => {
|
|
|
31
31
|
User: "xelnia",
|
|
32
32
|
TotalScore: "1000",
|
|
33
33
|
LastAward: "2022-09-01 21:51:23",
|
|
34
|
-
UserRank: "4"
|
|
35
|
-
}
|
|
34
|
+
UserRank: "4",
|
|
35
|
+
},
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
server.use(
|
|
@@ -44,7 +44,7 @@ describe("Function: getUserGameRankAndScore", () => {
|
|
|
44
44
|
// ACT
|
|
45
45
|
const response = await getUserGameRankAndScore(authorization, {
|
|
46
46
|
userName: "xelnia",
|
|
47
|
-
gameId: 14_402
|
|
47
|
+
gameId: 14_402,
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// ASSERT
|
|
@@ -53,8 +53,8 @@ describe("Function: getUserGameRankAndScore", () => {
|
|
|
53
53
|
user: "xelnia",
|
|
54
54
|
totalScore: 1000,
|
|
55
55
|
lastAward: "2022-09-01 21:51:23",
|
|
56
|
-
userRank: 4
|
|
57
|
-
}
|
|
56
|
+
userRank: 4,
|
|
57
|
+
},
|
|
58
58
|
]);
|
|
59
59
|
});
|
|
60
60
|
});
|
|
@@ -3,12 +3,12 @@ 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 {
|
|
10
10
|
GetUserGameRankAndScoreResponse,
|
|
11
|
-
UserGameRankAndScore
|
|
11
|
+
UserGameRankAndScore,
|
|
12
12
|
} from "./models";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -65,6 +65,6 @@ export const getUserGameRankAndScore = async (
|
|
|
65
65
|
const rawResponse = await call<GetUserGameRankAndScoreResponse>({ url });
|
|
66
66
|
|
|
67
67
|
return serializeProperties(rawResponse, {
|
|
68
|
-
shouldCastToNumbers: ["TotalScore", "UserRank"]
|
|
68
|
+
shouldCastToNumbers: ["TotalScore", "UserRank"],
|
|
69
69
|
});
|
|
70
70
|
};
|
|
@@ -23,12 +23,12 @@ describe("Function: getUserPoints", () => {
|
|
|
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: GetUserPointsResponse = {
|
|
30
30
|
Points: 10_000,
|
|
31
|
-
SoftcorePoints: 5400
|
|
31
|
+
SoftcorePoints: 5400,
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
server.use(
|
|
@@ -43,7 +43,7 @@ describe("Function: getUserPoints", () => {
|
|
|
43
43
|
// ASSERT
|
|
44
44
|
expect(response).toEqual({
|
|
45
45
|
points: 10_000,
|
|
46
|
-
softcorePoints: 5400
|
|
46
|
+
softcorePoints: 5400,
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
});
|