@retroachievements/api 1.5.1 → 1.5.3
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/achievement/models/achievement-type.model.d.ts +1 -0
- package/dist/achievement/models/index.d.ts +1 -0
- 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/game/getGameExtended.d.ts +1 -1
- package/dist/game/models/game-extended-achievement-entity.model.d.ts +2 -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/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/achievement/models/achievement-type.model.ts +5 -0
- package/src/achievement/models/index.ts +1 -0
- 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 +5 -5
- 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/game-extended-achievement-entity.model.ts +3 -0
- 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/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/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
|
@@ -23,7 +23,7 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
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: GetAchievementUnlocksResponse = {
|
|
@@ -35,7 +35,7 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
35
35
|
TrueRatio: "6",
|
|
36
36
|
Author: "Scott",
|
|
37
37
|
DateCreated: "2012-11-02 00:03:12",
|
|
38
|
-
DateModified: "2022-06-11 16:52:35"
|
|
38
|
+
DateModified: "2022-06-11 16:52:35",
|
|
39
39
|
},
|
|
40
40
|
Console: { ID: "1", Title: "Mega Drive" },
|
|
41
41
|
Game: { ID: "1", Title: "Sonic the Hedgehog" },
|
|
@@ -46,9 +46,9 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
46
46
|
User: "Tiotroll2022",
|
|
47
47
|
RAPoints: "348",
|
|
48
48
|
DateAwarded: "2023-01-29 21:45:41",
|
|
49
|
-
HardcoreMode: "0"
|
|
50
|
-
}
|
|
51
|
-
]
|
|
49
|
+
HardcoreMode: "0",
|
|
50
|
+
},
|
|
51
|
+
],
|
|
52
52
|
};
|
|
53
53
|
|
|
54
54
|
let requestUrl = "";
|
|
@@ -64,7 +64,7 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
64
64
|
const response = await getAchievementUnlocks(authorization, {
|
|
65
65
|
achievementId: 18_000,
|
|
66
66
|
count: 1,
|
|
67
|
-
offset: 1
|
|
67
|
+
offset: 1,
|
|
68
68
|
});
|
|
69
69
|
|
|
70
70
|
// ASSERT
|
|
@@ -81,7 +81,7 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
81
81
|
trueRatio: 6,
|
|
82
82
|
author: "Scott",
|
|
83
83
|
dateCreated: "2012-11-02 00:03:12",
|
|
84
|
-
dateModified: "2022-06-11 16:52:35"
|
|
84
|
+
dateModified: "2022-06-11 16:52:35",
|
|
85
85
|
},
|
|
86
86
|
console: { id: 1, title: "Mega Drive" },
|
|
87
87
|
game: { id: 1, title: "Sonic the Hedgehog" },
|
|
@@ -92,9 +92,9 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
92
92
|
user: "Tiotroll2022",
|
|
93
93
|
raPoints: 348,
|
|
94
94
|
dateAwarded: "2023-01-29 21:45:41",
|
|
95
|
-
hardcoreMode: false
|
|
96
|
-
}
|
|
97
|
-
]
|
|
95
|
+
hardcoreMode: false,
|
|
96
|
+
},
|
|
97
|
+
],
|
|
98
98
|
});
|
|
99
99
|
});
|
|
100
100
|
});
|
|
@@ -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
|
AchievementUnlocksMetadata,
|
|
11
|
-
GetAchievementUnlocksResponse
|
|
11
|
+
GetAchievementUnlocksResponse,
|
|
12
12
|
} from "./models";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -76,6 +76,6 @@ export const getAchievementUnlocks = async (
|
|
|
76
76
|
|
|
77
77
|
return serializeProperties(rawResponse, {
|
|
78
78
|
shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"],
|
|
79
|
-
shouldMapToBooleans: ["HardcoreMode"]
|
|
79
|
+
shouldMapToBooleans: ["HardcoreMode"],
|
|
80
80
|
});
|
|
81
81
|
};
|
|
@@ -6,7 +6,7 @@ import { setupServer } from "msw/node";
|
|
|
6
6
|
import { apiBaseUrl } from "../utils/internal";
|
|
7
7
|
import { buildAuthorization } from "../utils/public";
|
|
8
8
|
import { getConsoleIds } from "./getConsoleIds";
|
|
9
|
-
import type { GetConsoleIdsResponse } from "./models";
|
|
9
|
+
import type { ConsoleId, GetConsoleIdsResponse } from "./models";
|
|
10
10
|
|
|
11
11
|
const server = setupServer();
|
|
12
12
|
|
|
@@ -25,13 +25,28 @@ describe("Function: getConsoleIds", () => {
|
|
|
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: GetConsoleIdsResponse = [
|
|
32
|
-
{
|
|
33
|
-
|
|
34
|
-
|
|
32
|
+
{
|
|
33
|
+
ID: "1",
|
|
34
|
+
Name: "Mega Drive",
|
|
35
|
+
IconURL:
|
|
36
|
+
"https://static.retroachievements.org/assets/images/system/md.png",
|
|
37
|
+
},
|
|
38
|
+
{
|
|
39
|
+
ID: "2",
|
|
40
|
+
Name: "Nintendo 64",
|
|
41
|
+
IconURL:
|
|
42
|
+
"https://static.retroachievements.org/assets/images/system/n64.png",
|
|
43
|
+
},
|
|
44
|
+
{
|
|
45
|
+
ID: "3",
|
|
46
|
+
Name: "SNES",
|
|
47
|
+
IconURL:
|
|
48
|
+
"https://static.retroachievements.org/assets/images/system/snes.png",
|
|
49
|
+
},
|
|
35
50
|
];
|
|
36
51
|
|
|
37
52
|
server.use(
|
|
@@ -44,10 +59,27 @@ describe("Function: getConsoleIds", () => {
|
|
|
44
59
|
const response = await getConsoleIds(authorization);
|
|
45
60
|
|
|
46
61
|
// ASSERT
|
|
47
|
-
|
|
48
|
-
{
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
62
|
+
const expectedResponse: ConsoleId[] = [
|
|
63
|
+
{
|
|
64
|
+
id: 1,
|
|
65
|
+
name: "Mega Drive",
|
|
66
|
+
iconUrl:
|
|
67
|
+
"https://static.retroachievements.org/assets/images/system/md.png",
|
|
68
|
+
},
|
|
69
|
+
{
|
|
70
|
+
id: 2,
|
|
71
|
+
name: "Nintendo 64",
|
|
72
|
+
iconUrl:
|
|
73
|
+
"https://static.retroachievements.org/assets/images/system/n64.png",
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: 3,
|
|
77
|
+
name: "SNES",
|
|
78
|
+
iconUrl:
|
|
79
|
+
"https://static.retroachievements.org/assets/images/system/snes.png",
|
|
80
|
+
},
|
|
81
|
+
];
|
|
82
|
+
|
|
83
|
+
expect(response).toEqual(expectedResponse);
|
|
52
84
|
});
|
|
53
85
|
});
|
|
@@ -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 { ConsoleId, GetConsoleIdsResponse } from "./models";
|
|
@@ -22,8 +22,12 @@ import type { ConsoleId, GetConsoleIdsResponse } from "./models";
|
|
|
22
22
|
*
|
|
23
23
|
* @returns An array containing a complete list of console ID
|
|
24
24
|
* and name pairs for RetroAchievements.org.
|
|
25
|
-
* ```
|
|
26
|
-
* {
|
|
25
|
+
* ```json
|
|
26
|
+
* {
|
|
27
|
+
* id: "1",
|
|
28
|
+
* name: "Mega Drive",
|
|
29
|
+
* iconUrl: "https://static.retroachievements.org/assets/images/system/md.png"
|
|
30
|
+
* }
|
|
27
31
|
* ```
|
|
28
32
|
*/
|
|
29
33
|
export const getConsoleIds = async (
|
|
@@ -38,6 +42,6 @@ export const getConsoleIds = async (
|
|
|
38
42
|
const rawResponse = await call<GetConsoleIdsResponse>({ url });
|
|
39
43
|
|
|
40
44
|
return serializeProperties(rawResponse, {
|
|
41
|
-
shouldCastToNumbers: ["ID"]
|
|
45
|
+
shouldCastToNumbers: ["ID"],
|
|
42
46
|
});
|
|
43
47
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getGameList", () => {
|
|
|
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: GetGameListResponse = [
|
|
@@ -42,9 +42,9 @@ describe("Function: getGameList", () => {
|
|
|
42
42
|
ForumTopicID: 1972,
|
|
43
43
|
Hashes: [
|
|
44
44
|
"32e1a15161ef1f070b023738353bde51",
|
|
45
|
-
"9b04970a603ace521c7cca2acaf69804"
|
|
46
|
-
]
|
|
47
|
-
}
|
|
45
|
+
"9b04970a603ace521c7cca2acaf69804",
|
|
46
|
+
],
|
|
47
|
+
},
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
server.use(
|
|
@@ -56,7 +56,7 @@ describe("Function: getGameList", () => {
|
|
|
56
56
|
// ACT
|
|
57
57
|
const response = await getGameList(authorization, {
|
|
58
58
|
consoleId: 1,
|
|
59
|
-
shouldRetrieveGameHashes: true
|
|
59
|
+
shouldRetrieveGameHashes: true,
|
|
60
60
|
});
|
|
61
61
|
|
|
62
62
|
// ASSERT
|
|
@@ -74,9 +74,9 @@ describe("Function: getGameList", () => {
|
|
|
74
74
|
forumTopicId: 1972,
|
|
75
75
|
hashes: [
|
|
76
76
|
"32e1a15161ef1f070b023738353bde51",
|
|
77
|
-
"9b04970a603ace521c7cca2acaf69804"
|
|
78
|
-
]
|
|
79
|
-
}
|
|
77
|
+
"9b04970a603ace521c7cca2acaf69804",
|
|
78
|
+
],
|
|
79
|
+
},
|
|
80
80
|
]);
|
|
81
81
|
});
|
|
82
82
|
});
|
|
@@ -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 { GameList, GetGameListResponse } from "./models";
|
|
@@ -63,7 +63,7 @@ export const getGameList = async (
|
|
|
63
63
|
const {
|
|
64
64
|
consoleId,
|
|
65
65
|
shouldOnlyRetrieveGamesWithAchievements,
|
|
66
|
-
shouldRetrieveGameHashes
|
|
66
|
+
shouldRetrieveGameHashes,
|
|
67
67
|
} = payload;
|
|
68
68
|
|
|
69
69
|
let callPayload: Record<string, any> = { i: consoleId };
|
|
@@ -71,7 +71,7 @@ export const getGameList = async (
|
|
|
71
71
|
if (shouldOnlyRetrieveGamesWithAchievements !== undefined) {
|
|
72
72
|
callPayload = {
|
|
73
73
|
...callPayload,
|
|
74
|
-
f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0
|
|
74
|
+
f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0,
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
@@ -89,6 +89,6 @@ export const getGameList = async (
|
|
|
89
89
|
const rawResponse = await call<GetGameListResponse>({ url });
|
|
90
90
|
|
|
91
91
|
return serializeProperties(rawResponse, {
|
|
92
|
-
shouldCastToNumbers: ["ID", "ConsoleID"]
|
|
92
|
+
shouldCastToNumbers: ["ID", "ConsoleID"],
|
|
93
93
|
});
|
|
94
94
|
};
|
|
@@ -8,7 +8,7 @@ import { buildAuthorization } from "../utils/public";
|
|
|
8
8
|
import { getAchievementOfTheWeek } from "./getAchievementOfTheWeek";
|
|
9
9
|
import type {
|
|
10
10
|
AchievementOfTheWeek,
|
|
11
|
-
GetAchievementOfTheWeekResponse
|
|
11
|
+
GetAchievementOfTheWeekResponse,
|
|
12
12
|
} from "./models";
|
|
13
13
|
|
|
14
14
|
const server = setupServer();
|
|
@@ -28,7 +28,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
28
28
|
// ARRANGE
|
|
29
29
|
const authorization = buildAuthorization({
|
|
30
30
|
userName: "mockUserName",
|
|
31
|
-
webApiKey: "mockWebApiKey"
|
|
31
|
+
webApiKey: "mockWebApiKey",
|
|
32
32
|
});
|
|
33
33
|
|
|
34
34
|
const mockResponse: GetAchievementOfTheWeekResponse = {
|
|
@@ -42,7 +42,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
42
42
|
DateCreated: "2021-08-08 17:47:46",
|
|
43
43
|
DateModified: "2021-08-09 12:20:05",
|
|
44
44
|
BadgeName: "185805",
|
|
45
|
-
BadgeURL: "/Badge/185805.png"
|
|
45
|
+
BadgeURL: "/Badge/185805.png",
|
|
46
46
|
},
|
|
47
47
|
Console: { ID: "39", Title: "Saturn" },
|
|
48
48
|
ForumTopic: { ID: "14767" },
|
|
@@ -54,10 +54,10 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
54
54
|
User: "Tirbaba2",
|
|
55
55
|
RAPoints: "72",
|
|
56
56
|
DateAwarded: "2022-10-10 01:42:19",
|
|
57
|
-
HardcoreMode: "1"
|
|
58
|
-
}
|
|
57
|
+
HardcoreMode: "1",
|
|
58
|
+
},
|
|
59
59
|
],
|
|
60
|
-
UnlocksCount: "40"
|
|
60
|
+
UnlocksCount: "40",
|
|
61
61
|
};
|
|
62
62
|
|
|
63
63
|
server.use(
|
|
@@ -80,7 +80,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
80
80
|
dateCreated: "2021-08-08 17:47:46",
|
|
81
81
|
dateModified: "2021-08-09 12:20:05",
|
|
82
82
|
badgeName: "185805",
|
|
83
|
-
badgeUrl: "/Badge/185805.png"
|
|
83
|
+
badgeUrl: "/Badge/185805.png",
|
|
84
84
|
},
|
|
85
85
|
console: { id: 39, title: "Saturn" },
|
|
86
86
|
forumTopic: { id: 14_767 },
|
|
@@ -92,10 +92,10 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
92
92
|
user: "Tirbaba2",
|
|
93
93
|
raPoints: 72,
|
|
94
94
|
dateAwarded: "2022-10-10 01:42:19",
|
|
95
|
-
hardcoreMode: true
|
|
96
|
-
}
|
|
95
|
+
hardcoreMode: true,
|
|
96
|
+
},
|
|
97
97
|
],
|
|
98
|
-
unlocksCount: 40
|
|
98
|
+
unlocksCount: 40,
|
|
99
99
|
};
|
|
100
100
|
|
|
101
101
|
// ASSERT
|
|
@@ -106,7 +106,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
106
106
|
// ARRANGE
|
|
107
107
|
const authorization = buildAuthorization({
|
|
108
108
|
userName: "mockUserName",
|
|
109
|
-
webApiKey: "mockWebApiKey"
|
|
109
|
+
webApiKey: "mockWebApiKey",
|
|
110
110
|
});
|
|
111
111
|
|
|
112
112
|
const mockResponse: GetAchievementOfTheWeekResponse = {
|
|
@@ -120,7 +120,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
120
120
|
DateCreated: "2021-08-08 17:47:46",
|
|
121
121
|
DateModified: "2021-08-09 12:20:05",
|
|
122
122
|
BadgeName: "185805",
|
|
123
|
-
BadgeURL: "/Badge/185805.png"
|
|
123
|
+
BadgeURL: "/Badge/185805.png",
|
|
124
124
|
},
|
|
125
125
|
Console: { ID: "39", Title: "Saturn" },
|
|
126
126
|
ForumTopic: { ID: "14767" },
|
|
@@ -132,10 +132,10 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
132
132
|
User: "Tirbaba2",
|
|
133
133
|
RAPoints: "72",
|
|
134
134
|
DateAwarded: "2022-10-10 01:42:19",
|
|
135
|
-
HardcoreMode: "0"
|
|
136
|
-
}
|
|
135
|
+
HardcoreMode: "0",
|
|
136
|
+
},
|
|
137
137
|
],
|
|
138
|
-
UnlocksCount: "40"
|
|
138
|
+
UnlocksCount: "40",
|
|
139
139
|
};
|
|
140
140
|
|
|
141
141
|
server.use(
|
|
@@ -158,7 +158,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
158
158
|
dateCreated: "2021-08-08 17:47:46",
|
|
159
159
|
dateModified: "2021-08-09 12:20:05",
|
|
160
160
|
badgeName: "185805",
|
|
161
|
-
badgeUrl: "/Badge/185805.png"
|
|
161
|
+
badgeUrl: "/Badge/185805.png",
|
|
162
162
|
},
|
|
163
163
|
console: { id: 39, title: "Saturn" },
|
|
164
164
|
forumTopic: { id: 14_767 },
|
|
@@ -170,10 +170,10 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
170
170
|
user: "Tirbaba2",
|
|
171
171
|
raPoints: 72,
|
|
172
172
|
dateAwarded: "2022-10-10 01:42:19",
|
|
173
|
-
hardcoreMode: false
|
|
174
|
-
}
|
|
173
|
+
hardcoreMode: false,
|
|
174
|
+
},
|
|
175
175
|
],
|
|
176
|
-
unlocksCount: 40
|
|
176
|
+
unlocksCount: 40,
|
|
177
177
|
};
|
|
178
178
|
|
|
179
179
|
// ASSERT
|
|
@@ -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
|
AchievementOfTheWeek,
|
|
10
|
-
GetAchievementOfTheWeekResponse
|
|
10
|
+
GetAchievementOfTheWeekResponse,
|
|
11
11
|
} from "./models";
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -75,8 +75,8 @@ export const getAchievementOfTheWeek = async (
|
|
|
75
75
|
"TrueRatio",
|
|
76
76
|
"TotalPlayers",
|
|
77
77
|
"RAPoints",
|
|
78
|
-
"UnlocksCount"
|
|
78
|
+
"UnlocksCount",
|
|
79
79
|
],
|
|
80
|
-
shouldMapToBooleans: ["HardcoreMode"]
|
|
80
|
+
shouldMapToBooleans: ["HardcoreMode"],
|
|
81
81
|
});
|
|
82
82
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getActiveClaims", () => {
|
|
|
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: GetSetClaimsResponse = [
|
|
@@ -46,8 +46,8 @@ describe("Function: getActiveClaims", () => {
|
|
|
46
46
|
DoneTime: "2023-01-03 20:29:45",
|
|
47
47
|
Updated: "2022-10-03 20:29:45",
|
|
48
48
|
MinutesLeft: 112_285,
|
|
49
|
-
UserIsJrDev: 1
|
|
50
|
-
}
|
|
49
|
+
UserIsJrDev: 1,
|
|
50
|
+
},
|
|
51
51
|
];
|
|
52
52
|
|
|
53
53
|
server.use(
|
|
@@ -78,8 +78,8 @@ describe("Function: getActiveClaims", () => {
|
|
|
78
78
|
doneTime: "2023-01-03 20:29:45",
|
|
79
79
|
updated: "2022-10-03 20:29:45",
|
|
80
80
|
minutesLeft: 112_285,
|
|
81
|
-
userIsJrDev: true
|
|
82
|
-
}
|
|
81
|
+
userIsJrDev: true,
|
|
82
|
+
},
|
|
83
83
|
]);
|
|
84
84
|
});
|
|
85
85
|
});
|
|
@@ -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 { GetSetClaimsResponse, SetClaim } from "./models";
|
|
@@ -56,6 +56,6 @@ export const getActiveClaims = async (
|
|
|
56
56
|
const rawResponse = await call<GetSetClaimsResponse>({ url });
|
|
57
57
|
|
|
58
58
|
return serializeProperties(rawResponse, {
|
|
59
|
-
shouldMapToBooleans: ["UserIsJrDev"]
|
|
59
|
+
shouldMapToBooleans: ["UserIsJrDev"],
|
|
60
60
|
});
|
|
61
61
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getClaims", () => {
|
|
|
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: GetSetClaimsResponse = [
|
|
@@ -46,8 +46,8 @@ describe("Function: getClaims", () => {
|
|
|
46
46
|
DoneTime: "2023-01-03 20:29:45",
|
|
47
47
|
Updated: "2022-10-03 20:29:45",
|
|
48
48
|
MinutesLeft: 112_285,
|
|
49
|
-
UserIsJrDev: 1
|
|
50
|
-
}
|
|
49
|
+
UserIsJrDev: 1,
|
|
50
|
+
},
|
|
51
51
|
];
|
|
52
52
|
|
|
53
53
|
server.use(
|
|
@@ -78,8 +78,8 @@ describe("Function: getClaims", () => {
|
|
|
78
78
|
doneTime: "2023-01-03 20:29:45",
|
|
79
79
|
updated: "2022-10-03 20:29:45",
|
|
80
80
|
minutesLeft: 112_285,
|
|
81
|
-
userIsJrDev: true
|
|
82
|
-
}
|
|
81
|
+
userIsJrDev: true,
|
|
82
|
+
},
|
|
83
83
|
]);
|
|
84
84
|
});
|
|
85
85
|
});
|
package/src/feed/getClaims.ts
CHANGED
|
@@ -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 { GetSetClaimsResponse, SetClaim } from "./models";
|
|
@@ -16,18 +16,18 @@ export const getClaims = async (
|
|
|
16
16
|
const { claimKind } = payload;
|
|
17
17
|
|
|
18
18
|
const url = buildRequestUrl(apiBaseUrl, "/API_GetClaims.php", authorization, {
|
|
19
|
-
k: claimKindValueMap[claimKind]
|
|
19
|
+
k: claimKindValueMap[claimKind],
|
|
20
20
|
});
|
|
21
21
|
|
|
22
22
|
const rawResponse = await call<GetSetClaimsResponse>({ url });
|
|
23
23
|
|
|
24
24
|
return serializeProperties(rawResponse, {
|
|
25
|
-
shouldMapToBooleans: ["UserIsJrDev"]
|
|
25
|
+
shouldMapToBooleans: ["UserIsJrDev"],
|
|
26
26
|
});
|
|
27
27
|
};
|
|
28
28
|
|
|
29
29
|
const claimKindValueMap: Record<ClaimKind, `${number}`> = {
|
|
30
30
|
completed: "1",
|
|
31
31
|
dropped: "2",
|
|
32
|
-
expired: "3"
|
|
32
|
+
expired: "3",
|
|
33
33
|
};
|
|
@@ -23,7 +23,7 @@ describe("Function: getTopTenUsers", () => {
|
|
|
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: GetTopTenUsersResponse = [
|
|
@@ -36,7 +36,7 @@ describe("Function: getTopTenUsers", () => {
|
|
|
36
36
|
{ "1": "donutweegee", "2": "204701", "3": "587221" },
|
|
37
37
|
{ "1": "AmericanNinja", "2": "202980", "3": "567618" },
|
|
38
38
|
{ "1": "Infernum", "2": "202171", "3": "689967" },
|
|
39
|
-
{ "1": "FabricioPrie", "2": "196974", "3": "450436" }
|
|
39
|
+
{ "1": "FabricioPrie", "2": "196974", "3": "450436" },
|
|
40
40
|
];
|
|
41
41
|
|
|
42
42
|
server.use(
|
|
@@ -53,49 +53,49 @@ describe("Function: getTopTenUsers", () => {
|
|
|
53
53
|
{
|
|
54
54
|
userName: "MaxMilyin",
|
|
55
55
|
totalPoints: 346_289,
|
|
56
|
-
totalRatioPoints: 995_092
|
|
56
|
+
totalRatioPoints: 995_092,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
59
|
userName: "HippopotamusRex",
|
|
60
60
|
totalPoints: 312_118,
|
|
61
|
-
totalRatioPoints: 1_151_351
|
|
61
|
+
totalRatioPoints: 1_151_351,
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
64
|
userName: "Sarconius",
|
|
65
65
|
totalPoints: 257_862,
|
|
66
|
-
totalRatioPoints: 1_181_770
|
|
66
|
+
totalRatioPoints: 1_181_770,
|
|
67
67
|
},
|
|
68
68
|
{ userName: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 },
|
|
69
69
|
{
|
|
70
70
|
userName: "Andrey199650",
|
|
71
71
|
totalPoints: 240_101,
|
|
72
|
-
totalRatioPoints: 567_522
|
|
72
|
+
totalRatioPoints: 567_522,
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
75
|
userName: "Wendigo",
|
|
76
76
|
totalPoints: 227_903,
|
|
77
|
-
totalRatioPoints: 1_099_685
|
|
77
|
+
totalRatioPoints: 1_099_685,
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
80
|
userName: "donutweegee",
|
|
81
81
|
totalPoints: 204_701,
|
|
82
|
-
totalRatioPoints: 587_221
|
|
82
|
+
totalRatioPoints: 587_221,
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
85
|
userName: "AmericanNinja",
|
|
86
86
|
totalPoints: 202_980,
|
|
87
|
-
totalRatioPoints: 567_618
|
|
87
|
+
totalRatioPoints: 567_618,
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
90
|
userName: "Infernum",
|
|
91
91
|
totalPoints: 202_171,
|
|
92
|
-
totalRatioPoints: 689_967
|
|
92
|
+
totalRatioPoints: 689_967,
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
95
|
userName: "FabricioPrie",
|
|
96
96
|
totalPoints: 196_974,
|
|
97
|
-
totalRatioPoints: 450_436
|
|
98
|
-
}
|
|
97
|
+
totalRatioPoints: 450_436,
|
|
98
|
+
},
|
|
99
99
|
]);
|
|
100
100
|
});
|
|
101
101
|
});
|
|
@@ -3,7 +3,7 @@ import type { AuthObject } from "../utils/public";
|
|
|
3
3
|
import type {
|
|
4
4
|
GetTopTenUsersResponse,
|
|
5
5
|
TopTenUsers,
|
|
6
|
-
TopTenUsersEntity
|
|
6
|
+
TopTenUsersEntity,
|
|
7
7
|
} from "./models";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -43,7 +43,7 @@ export const getTopTenUsers = async (
|
|
|
43
43
|
sanitizedTopTenUsers.push({
|
|
44
44
|
userName: rawUser["1"],
|
|
45
45
|
totalPoints: Number(rawUser["2"]),
|
|
46
|
-
totalRatioPoints: Number(rawUser["3"])
|
|
46
|
+
totalRatioPoints: Number(rawUser["3"]),
|
|
47
47
|
});
|
|
48
48
|
}
|
|
49
49
|
|