@retroachievements/api 1.5.3 → 2.0.0
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/README.md +2 -2
- package/dist/achievement/getAchievementUnlocks.d.ts +1 -1
- package/dist/api.cjs +1 -1
- package/dist/api.cjs.map +1 -1
- package/dist/api.modern.js +1 -1
- package/dist/api.modern.js.map +1 -1
- package/dist/api.module.js +1 -1
- package/dist/api.module.js.map +1 -1
- package/dist/api.umd.js +1 -1
- package/dist/api.umd.js.map +1 -1
- package/dist/console/getConsoleIds.d.ts +15 -4
- package/dist/console/getGameList.d.ts +1 -1
- package/dist/console/models/fetched-system.model.d.ts +7 -0
- package/dist/console/models/get-console-ids-response.model.d.ts +2 -0
- package/dist/console/models/index.d.ts +1 -1
- package/dist/feed/getAchievementOfTheWeek.d.ts +1 -1
- package/dist/feed/getActiveClaims.d.ts +1 -1
- package/dist/feed/getTopTenUsers.d.ts +3 -3
- package/dist/feed/models/top-ten-users-entity.model.d.ts +1 -1
- package/dist/game/getAchievementCount.d.ts +1 -1
- package/dist/game/getAchievementDistribution.d.ts +1 -1
- package/dist/game/getGame.d.ts +1 -1
- package/dist/game/getGameExtended.d.ts +1 -1
- package/dist/game/getGameRankAndScore.d.ts +1 -1
- package/dist/game/getGameRating.d.ts +1 -1
- package/dist/ticket/getTicketData.d.ts +9 -9
- package/dist/user/getAchievementsEarnedBetween.d.ts +4 -4
- package/dist/user/getAchievementsEarnedOnDay.d.ts +4 -4
- package/dist/user/getGameInfoAndUserProgress.d.ts +9 -5
- package/dist/user/getUserAwards.d.ts +4 -4
- package/dist/user/getUserClaims.d.ts +4 -4
- package/dist/user/getUserCompletedGames.d.ts +4 -4
- package/dist/user/getUserCompletionProgress.d.ts +4 -4
- package/dist/user/getUserGameRankAndScore.d.ts +4 -4
- package/dist/user/getUserPoints.d.ts +4 -4
- package/dist/user/getUserProfile.d.ts +4 -4
- package/dist/user/getUserProgress.d.ts +4 -4
- package/dist/user/getUserRecentAchievements.d.ts +4 -4
- package/dist/user/getUserRecentlyPlayedGames.d.ts +4 -4
- package/dist/user/getUserSummary.d.ts +4 -4
- package/dist/user/models/game-info-and-user-progress.model.d.ts +2 -0
- package/dist/user/models/get-game-info-and-user-progress-response.model.d.ts +2 -0
- package/dist/utils/public/buildAuthorization.d.ts +1 -1
- package/dist/utils/public/models/auth-object.model.d.ts +2 -2
- package/package.json +6 -12
- package/src/__playground.ts +4 -4
- package/src/achievement/getAchievementUnlocks.test.ts +1 -1
- package/src/achievement/getAchievementUnlocks.ts +1 -1
- package/src/console/getConsoleIds.test.ts +15 -3
- package/src/console/getConsoleIds.ts +28 -6
- package/src/console/getGameList.test.ts +1 -1
- package/src/console/getGameList.ts +1 -1
- package/src/console/models/fetched-system.model.ts +7 -0
- package/src/console/models/get-console-ids-response.model.ts +2 -0
- package/src/console/models/index.ts +1 -1
- package/src/feed/getAchievementOfTheWeek.test.ts +2 -2
- package/src/feed/getAchievementOfTheWeek.ts +1 -1
- package/src/feed/getActiveClaims.test.ts +1 -1
- package/src/feed/getActiveClaims.ts +1 -1
- package/src/feed/getClaims.test.ts +1 -1
- package/src/feed/getTopTenUsers.test.ts +11 -11
- package/src/feed/getTopTenUsers.ts +4 -4
- package/src/feed/models/top-ten-users-entity.model.ts +1 -1
- package/src/game/getAchievementCount.test.ts +1 -1
- package/src/game/getAchievementCount.ts +1 -1
- package/src/game/getAchievementDistribution.test.ts +4 -4
- package/src/game/getAchievementDistribution.ts +1 -1
- package/src/game/getGame.test.ts +1 -1
- package/src/game/getGame.ts +1 -1
- package/src/game/getGameExtended.test.ts +1 -1
- package/src/game/getGameExtended.ts +1 -1
- package/src/game/getGameRankAndScore.test.ts +1 -1
- package/src/game/getGameRankAndScore.ts +1 -1
- package/src/game/getGameRating.test.ts +1 -1
- package/src/game/getGameRating.ts +1 -1
- package/src/ticket/getTicketData.test.ts +7 -7
- package/src/ticket/getTicketData.ts +13 -13
- package/src/user/getAchievementsEarnedBetween.test.ts +2 -2
- package/src/user/getAchievementsEarnedBetween.ts +6 -6
- package/src/user/getAchievementsEarnedOnDay.test.ts +2 -2
- package/src/user/getAchievementsEarnedOnDay.ts +6 -6
- package/src/user/getGameInfoAndUserProgress.test.ts +3 -3
- package/src/user/getGameInfoAndUserProgress.ts +22 -11
- package/src/user/getUserAwards.test.ts +2 -2
- package/src/user/getUserAwards.ts +6 -6
- package/src/user/getUserClaims.test.ts +2 -2
- package/src/user/getUserClaims.ts +6 -6
- package/src/user/getUserCompletedGames.test.ts +2 -2
- package/src/user/getUserCompletedGames.ts +6 -6
- package/src/user/getUserCompletionProgress.test.ts +2 -2
- package/src/user/getUserCompletionProgress.ts +6 -6
- package/src/user/getUserGameRankAndScore.test.ts +2 -2
- package/src/user/getUserGameRankAndScore.ts +6 -6
- package/src/user/getUserPoints.test.ts +2 -2
- package/src/user/getUserPoints.ts +6 -6
- package/src/user/getUserProfile.test.ts +2 -2
- package/src/user/getUserProfile.ts +6 -6
- package/src/user/getUserProgress.test.ts +2 -2
- package/src/user/getUserProgress.ts +6 -6
- package/src/user/getUserRecentAchievements.test.ts +2 -2
- package/src/user/getUserRecentAchievements.ts +6 -6
- package/src/user/getUserRecentlyPlayedGames.test.ts +2 -2
- package/src/user/getUserRecentlyPlayedGames.ts +6 -6
- package/src/user/getUserSummary.test.ts +4 -4
- package/src/user/getUserSummary.ts +6 -6
- package/src/user/models/game-info-and-user-progress.model.ts +8 -0
- package/src/user/models/get-game-info-and-user-progress-response.model.ts +8 -0
- package/src/utils/internal/buildRequestUrl.test.ts +2 -2
- package/src/utils/internal/buildRequestUrl.ts +1 -1
- package/src/utils/public/buildAuthorization.test.ts +3 -3
- package/src/utils/public/buildAuthorization.ts +4 -4
- package/src/utils/public/models/auth-object.model.ts +2 -2
- package/src/console/models/console-id.model.ts +0 -5
package/src/__playground.ts
CHANGED
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
import { buildAuthorization, getAchievementCount } from "./index";
|
|
18
18
|
|
|
19
19
|
// MODIFY THESE VALUES.
|
|
20
|
-
const
|
|
20
|
+
const username = "myUsername";
|
|
21
21
|
const webApiKey = "myWebApiKey";
|
|
22
22
|
|
|
23
23
|
const main = async () => {
|
|
@@ -25,13 +25,13 @@ const main = async () => {
|
|
|
25
25
|
|
|
26
26
|
// -- Start testing stuff here --
|
|
27
27
|
|
|
28
|
-
if (
|
|
28
|
+
if (username === "myUsername" || webApiKey === "myWebApiKey") {
|
|
29
29
|
console.error(
|
|
30
|
-
"⛔️ ERROR: In __playground.ts, modify the
|
|
30
|
+
"⛔️ ERROR: In __playground.ts, modify the username and webApiKey variables to match your RA credentials.\n"
|
|
31
31
|
);
|
|
32
32
|
}
|
|
33
33
|
|
|
34
|
-
const authorization = buildAuthorization({
|
|
34
|
+
const authorization = buildAuthorization({ username, webApiKey });
|
|
35
35
|
|
|
36
36
|
const achievementCount = await getAchievementCount(authorization, {
|
|
37
37
|
gameId: 14_402,
|
|
@@ -22,7 +22,7 @@ describe("Function: getAchievementUnlocks", () => {
|
|
|
22
22
|
it("retrieves metadata about unlocks for a target achievement", async () => {
|
|
23
23
|
// ARRANGE
|
|
24
24
|
const authorization = buildAuthorization({
|
|
25
|
-
|
|
25
|
+
username: "mockUserName",
|
|
26
26
|
webApiKey: "mockWebApiKey",
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -15,7 +15,7 @@ import type {
|
|
|
15
15
|
* A call to this function will retrieve a list of users who
|
|
16
16
|
* have earned a given achievement, targeted by the achievement's ID.
|
|
17
17
|
*
|
|
18
|
-
* @param authorization An object containing your
|
|
18
|
+
* @param authorization An object containing your username and webApiKey.
|
|
19
19
|
* This can be constructed with `buildAuthorization()`.
|
|
20
20
|
*
|
|
21
21
|
* @param payload.achievementId The target achievement we want to
|
|
@@ -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 {
|
|
9
|
+
import type { FetchedSystem, GetConsoleIdsResponse } from "./models";
|
|
10
10
|
|
|
11
11
|
const server = setupServer();
|
|
12
12
|
|
|
@@ -24,7 +24,7 @@ describe("Function: getConsoleIds", () => {
|
|
|
24
24
|
it("retrieves a list of console IDs and their names and cleans properties", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -34,18 +34,24 @@ describe("Function: getConsoleIds", () => {
|
|
|
34
34
|
Name: "Mega Drive",
|
|
35
35
|
IconURL:
|
|
36
36
|
"https://static.retroachievements.org/assets/images/system/md.png",
|
|
37
|
+
Active: true,
|
|
38
|
+
IsGameSystem: true,
|
|
37
39
|
},
|
|
38
40
|
{
|
|
39
41
|
ID: "2",
|
|
40
42
|
Name: "Nintendo 64",
|
|
41
43
|
IconURL:
|
|
42
44
|
"https://static.retroachievements.org/assets/images/system/n64.png",
|
|
45
|
+
Active: true,
|
|
46
|
+
IsGameSystem: true,
|
|
43
47
|
},
|
|
44
48
|
{
|
|
45
49
|
ID: "3",
|
|
46
50
|
Name: "SNES",
|
|
47
51
|
IconURL:
|
|
48
52
|
"https://static.retroachievements.org/assets/images/system/snes.png",
|
|
53
|
+
Active: false,
|
|
54
|
+
IsGameSystem: false,
|
|
49
55
|
},
|
|
50
56
|
];
|
|
51
57
|
|
|
@@ -59,24 +65,30 @@ describe("Function: getConsoleIds", () => {
|
|
|
59
65
|
const response = await getConsoleIds(authorization);
|
|
60
66
|
|
|
61
67
|
// ASSERT
|
|
62
|
-
const expectedResponse:
|
|
68
|
+
const expectedResponse: FetchedSystem[] = [
|
|
63
69
|
{
|
|
64
70
|
id: 1,
|
|
65
71
|
name: "Mega Drive",
|
|
66
72
|
iconUrl:
|
|
67
73
|
"https://static.retroachievements.org/assets/images/system/md.png",
|
|
74
|
+
active: true,
|
|
75
|
+
isGameSystem: true,
|
|
68
76
|
},
|
|
69
77
|
{
|
|
70
78
|
id: 2,
|
|
71
79
|
name: "Nintendo 64",
|
|
72
80
|
iconUrl:
|
|
73
81
|
"https://static.retroachievements.org/assets/images/system/n64.png",
|
|
82
|
+
active: true,
|
|
83
|
+
isGameSystem: true,
|
|
74
84
|
},
|
|
75
85
|
{
|
|
76
86
|
id: 3,
|
|
77
87
|
name: "SNES",
|
|
78
88
|
iconUrl:
|
|
79
89
|
"https://static.retroachievements.org/assets/images/system/snes.png",
|
|
90
|
+
active: false,
|
|
91
|
+
isGameSystem: false,
|
|
80
92
|
},
|
|
81
93
|
];
|
|
82
94
|
|
|
@@ -5,16 +5,22 @@ import {
|
|
|
5
5
|
serializeProperties,
|
|
6
6
|
} from "../utils/internal";
|
|
7
7
|
import type { AuthObject } from "../utils/public";
|
|
8
|
-
import type {
|
|
8
|
+
import type { FetchedSystem, GetConsoleIdsResponse } from "./models";
|
|
9
9
|
|
|
10
10
|
/**
|
|
11
11
|
* A call to this function will retrieve the complete list
|
|
12
12
|
* of console ID and name pairs on the RetroAchievements.org
|
|
13
13
|
* platform.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
|
+
* @param payload.shouldOnlyRetrieveActiveSystems If true, only systems that
|
|
19
|
+
* officially support achievements will be returned.
|
|
20
|
+
*
|
|
21
|
+
* @param payload.shouldOnlyRetrieveGameSystems If true, events and hubs will
|
|
22
|
+
* not be returned.
|
|
23
|
+
*
|
|
18
24
|
* @example
|
|
19
25
|
* ```
|
|
20
26
|
* const consoleIds = await getConsoleIds(authorization);
|
|
@@ -26,17 +32,33 @@ import type { ConsoleId, GetConsoleIdsResponse } from "./models";
|
|
|
26
32
|
* {
|
|
27
33
|
* id: "1",
|
|
28
34
|
* name: "Mega Drive",
|
|
29
|
-
* iconUrl: "https://static.retroachievements.org/assets/images/system/md.png"
|
|
35
|
+
* iconUrl: "https://static.retroachievements.org/assets/images/system/md.png",
|
|
36
|
+
* active: true,
|
|
37
|
+
* isGameSystem: true
|
|
30
38
|
* }
|
|
31
39
|
* ```
|
|
32
40
|
*/
|
|
33
41
|
export const getConsoleIds = async (
|
|
34
|
-
authorization: AuthObject
|
|
35
|
-
|
|
42
|
+
authorization: AuthObject,
|
|
43
|
+
payload?: {
|
|
44
|
+
shouldOnlyRetrieveActiveSystems: boolean;
|
|
45
|
+
shouldOnlyRetrieveGameSystems: boolean;
|
|
46
|
+
}
|
|
47
|
+
): Promise<FetchedSystem[]> => {
|
|
48
|
+
let callPayload: Record<string, any> | undefined;
|
|
49
|
+
|
|
50
|
+
if (payload?.shouldOnlyRetrieveActiveSystems) {
|
|
51
|
+
callPayload = { ...callPayload, a: 1 };
|
|
52
|
+
}
|
|
53
|
+
if (payload?.shouldOnlyRetrieveGameSystems) {
|
|
54
|
+
callPayload = { ...callPayload, g: 1 };
|
|
55
|
+
}
|
|
56
|
+
|
|
36
57
|
const url = buildRequestUrl(
|
|
37
58
|
apiBaseUrl,
|
|
38
59
|
"/API_GetConsoleIDs.php",
|
|
39
|
-
authorization
|
|
60
|
+
authorization,
|
|
61
|
+
callPayload
|
|
40
62
|
);
|
|
41
63
|
|
|
42
64
|
const rawResponse = await call<GetConsoleIdsResponse>({ url });
|
|
@@ -24,7 +24,7 @@ describe("Function: getGameList", () => {
|
|
|
24
24
|
it("retrieves a list of games and cleans their properties", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -12,7 +12,7 @@ import type { GameList, GetGameListResponse } from "./models";
|
|
|
12
12
|
* of games for a specified console on the RetroAchievements.org
|
|
13
13
|
* platform.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
18
|
* @param payload.consoleId The unique console ID to retrieve a list of
|
|
@@ -27,7 +27,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
27
27
|
it("retrieves metadata about the current achievement of the week and cleans properties", async () => {
|
|
28
28
|
// ARRANGE
|
|
29
29
|
const authorization = buildAuthorization({
|
|
30
|
-
|
|
30
|
+
username: "mockUserName",
|
|
31
31
|
webApiKey: "mockWebApiKey",
|
|
32
32
|
});
|
|
33
33
|
|
|
@@ -105,7 +105,7 @@ describe("Function: getAchievementOfTheWeek", () => {
|
|
|
105
105
|
it("properly sets the hardcore boolean value when cleaning properties", async () => {
|
|
106
106
|
// ARRANGE
|
|
107
107
|
const authorization = buildAuthorization({
|
|
108
|
-
|
|
108
|
+
username: "mockUserName",
|
|
109
109
|
webApiKey: "mockWebApiKey",
|
|
110
110
|
});
|
|
111
111
|
|
|
@@ -14,7 +14,7 @@ import type {
|
|
|
14
14
|
* A call to this function will retrieve comprehensive
|
|
15
15
|
* metadata about the current Achievement of the Week.
|
|
16
16
|
*
|
|
17
|
-
* @param authorization An object containing your
|
|
17
|
+
* @param authorization An object containing your username and webApiKey.
|
|
18
18
|
* This can be constructed with `buildAuthorization()`.
|
|
19
19
|
*
|
|
20
20
|
* @example
|
|
@@ -24,7 +24,7 @@ describe("Function: getActiveClaims", () => {
|
|
|
24
24
|
it("retrieves metadata about current active claims", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -11,7 +11,7 @@ import type { GetSetClaimsResponse, SetClaim } from "./models";
|
|
|
11
11
|
* A call to this function returns information about all
|
|
12
12
|
* (1000 max) active set claims.
|
|
13
13
|
*
|
|
14
|
-
* @param authorization An object containing your
|
|
14
|
+
* @param authorization An object containing your username and webApiKey.
|
|
15
15
|
* This can be constructed with `buildAuthorization()`.
|
|
16
16
|
*
|
|
17
17
|
* @example
|
|
@@ -24,7 +24,7 @@ describe("Function: getClaims", () => {
|
|
|
24
24
|
it("retrieves metadata about a requested kind of claims", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -22,7 +22,7 @@ describe("Function: getTopTenUsers", () => {
|
|
|
22
22
|
it("retrieves metadata about the current top ten users on the site", async () => {
|
|
23
23
|
// ARRANGE
|
|
24
24
|
const authorization = buildAuthorization({
|
|
25
|
-
|
|
25
|
+
username: "mockUserName",
|
|
26
26
|
webApiKey: "mockWebApiKey",
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -51,48 +51,48 @@ describe("Function: getTopTenUsers", () => {
|
|
|
51
51
|
// ASSERT
|
|
52
52
|
expect(response).toEqual([
|
|
53
53
|
{
|
|
54
|
-
|
|
54
|
+
username: "MaxMilyin",
|
|
55
55
|
totalPoints: 346_289,
|
|
56
56
|
totalRatioPoints: 995_092,
|
|
57
57
|
},
|
|
58
58
|
{
|
|
59
|
-
|
|
59
|
+
username: "HippopotamusRex",
|
|
60
60
|
totalPoints: 312_118,
|
|
61
61
|
totalRatioPoints: 1_151_351,
|
|
62
62
|
},
|
|
63
63
|
{
|
|
64
|
-
|
|
64
|
+
username: "Sarconius",
|
|
65
65
|
totalPoints: 257_862,
|
|
66
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
72
|
totalRatioPoints: 567_522,
|
|
73
73
|
},
|
|
74
74
|
{
|
|
75
|
-
|
|
75
|
+
username: "Wendigo",
|
|
76
76
|
totalPoints: 227_903,
|
|
77
77
|
totalRatioPoints: 1_099_685,
|
|
78
78
|
},
|
|
79
79
|
{
|
|
80
|
-
|
|
80
|
+
username: "donutweegee",
|
|
81
81
|
totalPoints: 204_701,
|
|
82
82
|
totalRatioPoints: 587_221,
|
|
83
83
|
},
|
|
84
84
|
{
|
|
85
|
-
|
|
85
|
+
username: "AmericanNinja",
|
|
86
86
|
totalPoints: 202_980,
|
|
87
87
|
totalRatioPoints: 567_618,
|
|
88
88
|
},
|
|
89
89
|
{
|
|
90
|
-
|
|
90
|
+
username: "Infernum",
|
|
91
91
|
totalPoints: 202_171,
|
|
92
92
|
totalRatioPoints: 689_967,
|
|
93
93
|
},
|
|
94
94
|
{
|
|
95
|
-
|
|
95
|
+
username: "FabricioPrie",
|
|
96
96
|
totalPoints: 196_974,
|
|
97
97
|
totalRatioPoints: 450_436,
|
|
98
98
|
},
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
* A call to this function will retrieve the current top ten users
|
|
11
11
|
* on the site.
|
|
12
12
|
*
|
|
13
|
-
* @param authorization An object containing your
|
|
13
|
+
* @param authorization An object containing your username and webApiKey.
|
|
14
14
|
* This can be constructed with `buildAuthorization()`.
|
|
15
15
|
*
|
|
16
16
|
* @example
|
|
@@ -21,8 +21,8 @@ import type {
|
|
|
21
21
|
* @returns An array containing the list of top ten users.
|
|
22
22
|
* ```json
|
|
23
23
|
* [
|
|
24
|
-
* {
|
|
25
|
-
* {
|
|
24
|
+
* { username: "MockUser", totalPoints: 350000, totalRatioPoints: 995000 },
|
|
25
|
+
* { username: "MockUser2", totalPoints: 345000, totalRatioPoints: 994000 },
|
|
26
26
|
* // ...
|
|
27
27
|
* ]
|
|
28
28
|
* ```
|
|
@@ -41,7 +41,7 @@ export const getTopTenUsers = async (
|
|
|
41
41
|
const sanitizedTopTenUsers: TopTenUsersEntity[] = [];
|
|
42
42
|
for (const rawUser of rawTopTenUsers) {
|
|
43
43
|
sanitizedTopTenUsers.push({
|
|
44
|
-
|
|
44
|
+
username: rawUser["1"],
|
|
45
45
|
totalPoints: Number(rawUser["2"]),
|
|
46
46
|
totalRatioPoints: Number(rawUser["3"]),
|
|
47
47
|
});
|
|
@@ -22,7 +22,7 @@ describe("Function: getAchievementCount", () => {
|
|
|
22
22
|
it("given a game ID, retrieves the list of achievement IDs associated with the game and cleans properties", async () => {
|
|
23
23
|
// ARRANGE
|
|
24
24
|
const authorization = buildAuthorization({
|
|
25
|
-
|
|
25
|
+
username: "mockUserName",
|
|
26
26
|
webApiKey: "mockWebApiKey",
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -12,7 +12,7 @@ import type { AchievementCount, GetAchievementCountResponse } from "./models";
|
|
|
12
12
|
* A call to this function will retrieve the list of
|
|
13
13
|
* achievement IDs for a game, targeted by game ID.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
18
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
|
@@ -23,7 +23,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
23
23
|
it("given a game ID, retrieves the achievement distribution associated with the game", async () => {
|
|
24
24
|
// ARRANGE
|
|
25
25
|
const authorization = buildAuthorization({
|
|
26
|
-
|
|
26
|
+
username: "mockUserName",
|
|
27
27
|
webApiKey: "mockWebApiKey",
|
|
28
28
|
});
|
|
29
29
|
|
|
@@ -61,7 +61,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
61
61
|
it("given flags, successfully attaches the option to the call", async () => {
|
|
62
62
|
// ARRANGE
|
|
63
63
|
const authorization = buildAuthorization({
|
|
64
|
-
|
|
64
|
+
username: "mockUserName",
|
|
65
65
|
webApiKey: "mockWebApiKey",
|
|
66
66
|
});
|
|
67
67
|
|
|
@@ -101,7 +101,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
101
101
|
it("given a truthy hardcore value, successfully attaches the option to the call", async () => {
|
|
102
102
|
// ARRANGE
|
|
103
103
|
const authorization = buildAuthorization({
|
|
104
|
-
|
|
104
|
+
username: "mockUserName",
|
|
105
105
|
webApiKey: "mockWebApiKey",
|
|
106
106
|
});
|
|
107
107
|
|
|
@@ -138,7 +138,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
138
138
|
it("given a falsy hardcore value, successfully attaches the option to the call", async () => {
|
|
139
139
|
// ARRANGE
|
|
140
140
|
const authorization = buildAuthorization({
|
|
141
|
-
|
|
141
|
+
username: "mockUserName",
|
|
142
142
|
webApiKey: "mockWebApiKey",
|
|
143
143
|
});
|
|
144
144
|
|
|
@@ -11,7 +11,7 @@ import type {
|
|
|
11
11
|
* of the number of players who have earned a specific
|
|
12
12
|
* number of achievements for a given game ID.
|
|
13
13
|
*
|
|
14
|
-
* @param authorization An object containing your
|
|
14
|
+
* @param authorization An object containing your username and webApiKey.
|
|
15
15
|
* This can be constructed with `buildAuthorization()`.
|
|
16
16
|
*
|
|
17
17
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
package/src/game/getGame.test.ts
CHANGED
|
@@ -24,7 +24,7 @@ describe("Function: getGame", () => {
|
|
|
24
24
|
it("given a game ID, retrieves basic metadata about the game", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
package/src/game/getGame.ts
CHANGED
|
@@ -12,7 +12,7 @@ import type { Game, GetGameResponse } from "./models";
|
|
|
12
12
|
* A call to this function will retrieve basic metadata about
|
|
13
13
|
* a game, targeted via its unique ID.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
18
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
|
@@ -24,7 +24,7 @@ describe("Function: getGameExtended", () => {
|
|
|
24
24
|
it("given a game ID, retrieves extended metadata about the game", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -12,7 +12,7 @@ import type { GameExtended, GetGameExtendedResponse } from "./models";
|
|
|
12
12
|
* A call to this function will retrieve extended metadata
|
|
13
13
|
* about a game, targeted via its unique ID.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
18
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
|
@@ -24,7 +24,7 @@ describe("Function: getGameRankAndScore", () => {
|
|
|
24
24
|
it("given a game ID, retrieves metadata about latest masteries for a game", async () => {
|
|
25
25
|
// ARRANGE
|
|
26
26
|
const authorization = buildAuthorization({
|
|
27
|
-
|
|
27
|
+
username: "mockUserName",
|
|
28
28
|
webApiKey: "mockWebApiKey",
|
|
29
29
|
});
|
|
30
30
|
|
|
@@ -17,7 +17,7 @@ import type {
|
|
|
17
17
|
* points earners for a game. The game is targeted via
|
|
18
18
|
* its unique ID.
|
|
19
19
|
*
|
|
20
|
-
* @param authorization An object containing your
|
|
20
|
+
* @param authorization An object containing your username and webApiKey.
|
|
21
21
|
* This can be constructed with `buildAuthorization()`.
|
|
22
22
|
*
|
|
23
23
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
|
@@ -22,7 +22,7 @@ describe("Function: getGameRating", () => {
|
|
|
22
22
|
it("given a game ID, retrieves metadata about how users have rated it", async () => {
|
|
23
23
|
// ARRANGE
|
|
24
24
|
const authorization = buildAuthorization({
|
|
25
|
-
|
|
25
|
+
username: "mockUserName",
|
|
26
26
|
webApiKey: "mockWebApiKey",
|
|
27
27
|
});
|
|
28
28
|
|
|
@@ -12,7 +12,7 @@ import type { GameRating, GetGameRatingResponse } from "./models";
|
|
|
12
12
|
* A call to this function will retrieve metadata about
|
|
13
13
|
* how users have rated the game and its set.
|
|
14
14
|
*
|
|
15
|
-
* @param authorization An object containing your
|
|
15
|
+
* @param authorization An object containing your username and webApiKey.
|
|
16
16
|
* This can be constructed with `buildAuthorization()`.
|
|
17
17
|
*
|
|
18
18
|
* @param payload.gameId The unique game ID. If you are unsure, open the
|
|
@@ -28,7 +28,7 @@ describe("Function: getTicketData", () => {
|
|
|
28
28
|
it("given only a ticket ID, retrieves ticket data", async () => {
|
|
29
29
|
// ARRANGE
|
|
30
30
|
const authorization = buildAuthorization({
|
|
31
|
-
|
|
31
|
+
username: "mockUserName",
|
|
32
32
|
webApiKey: "mockWebApiKey",
|
|
33
33
|
});
|
|
34
34
|
|
|
@@ -96,7 +96,7 @@ describe("Function: getTicketData", () => {
|
|
|
96
96
|
it("given no IDs, retrieves a list of recent tickets", async () => {
|
|
97
97
|
// ARRANGE
|
|
98
98
|
const authorization = buildAuthorization({
|
|
99
|
-
|
|
99
|
+
username: "mockUserName",
|
|
100
100
|
webApiKey: "mockWebApiKey",
|
|
101
101
|
});
|
|
102
102
|
|
|
@@ -184,7 +184,7 @@ describe("Function: getTicketData", () => {
|
|
|
184
184
|
it("can retrieve a list of the most ticketed games", async () => {
|
|
185
185
|
// ARRANGE
|
|
186
186
|
const authorization = buildAuthorization({
|
|
187
|
-
|
|
187
|
+
username: "mockUserName",
|
|
188
188
|
webApiKey: "mockWebApiKey",
|
|
189
189
|
});
|
|
190
190
|
|
|
@@ -244,7 +244,7 @@ describe("Function: getTicketData", () => {
|
|
|
244
244
|
it("can retrieve metadata about a user's tickets", async () => {
|
|
245
245
|
// ARRANGE
|
|
246
246
|
const authorization = buildAuthorization({
|
|
247
|
-
|
|
247
|
+
username: "mockUserName",
|
|
248
248
|
webApiKey: "mockWebApiKey",
|
|
249
249
|
});
|
|
250
250
|
|
|
@@ -264,7 +264,7 @@ describe("Function: getTicketData", () => {
|
|
|
264
264
|
);
|
|
265
265
|
|
|
266
266
|
// ACT
|
|
267
|
-
const response = await getTicketData(authorization, {
|
|
267
|
+
const response = await getTicketData(authorization, { username: "xelnia" });
|
|
268
268
|
|
|
269
269
|
// ASSERT
|
|
270
270
|
expect(response).toEqual({
|
|
@@ -280,7 +280,7 @@ describe("Function: getTicketData", () => {
|
|
|
280
280
|
it("can retrieve metadata about a game's tickets", async () => {
|
|
281
281
|
// ARRANGE
|
|
282
282
|
const authorization = buildAuthorization({
|
|
283
|
-
|
|
283
|
+
username: "mockUserName",
|
|
284
284
|
webApiKey: "mockWebApiKey",
|
|
285
285
|
});
|
|
286
286
|
|
|
@@ -314,7 +314,7 @@ describe("Function: getTicketData", () => {
|
|
|
314
314
|
it("can retrieve metadata about an achievement's tickets", async () => {
|
|
315
315
|
// ARRANGE
|
|
316
316
|
const authorization = buildAuthorization({
|
|
317
|
-
|
|
317
|
+
username: "mockUserName",
|
|
318
318
|
webApiKey: "mockWebApiKey",
|
|
319
319
|
});
|
|
320
320
|
|