@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,12 +23,12 @@ describe("Function: getAchievementCount", () => {
|
|
|
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: GetAchievementCountResponse = {
|
|
30
30
|
GameID: 8,
|
|
31
|
-
AchievementIDs: [1, 2, 3, 4, 5]
|
|
31
|
+
AchievementIDs: [1, 2, 3, 4, 5],
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
server.use(
|
|
@@ -43,7 +43,7 @@ describe("Function: getAchievementCount", () => {
|
|
|
43
43
|
// ASSERT
|
|
44
44
|
expect(response).toEqual({
|
|
45
45
|
gameId: 8,
|
|
46
|
-
achievementIds: [1, 2, 3, 4, 5]
|
|
46
|
+
achievementIds: [1, 2, 3, 4, 5],
|
|
47
47
|
});
|
|
48
48
|
});
|
|
49
49
|
});
|
|
@@ -24,7 +24,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
24
24
|
// ARRANGE
|
|
25
25
|
const authorization = buildAuthorization({
|
|
26
26
|
userName: "mockUserName",
|
|
27
|
-
webApiKey: "mockWebApiKey"
|
|
27
|
+
webApiKey: "mockWebApiKey",
|
|
28
28
|
});
|
|
29
29
|
|
|
30
30
|
const mockResponse: GetAchievementDistributionResponse = {
|
|
@@ -32,7 +32,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
32
32
|
"2": 10,
|
|
33
33
|
"3": 8,
|
|
34
34
|
"4": 4,
|
|
35
|
-
"5": 1
|
|
35
|
+
"5": 1,
|
|
36
36
|
};
|
|
37
37
|
|
|
38
38
|
let requestUrl = "";
|
|
@@ -47,7 +47,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
47
47
|
|
|
48
48
|
// ACT
|
|
49
49
|
const response = await getAchievementDistribution(authorization, {
|
|
50
|
-
gameId: 14_402
|
|
50
|
+
gameId: 14_402,
|
|
51
51
|
});
|
|
52
52
|
|
|
53
53
|
// ASSERT
|
|
@@ -62,7 +62,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
62
62
|
// ARRANGE
|
|
63
63
|
const authorization = buildAuthorization({
|
|
64
64
|
userName: "mockUserName",
|
|
65
|
-
webApiKey: "mockWebApiKey"
|
|
65
|
+
webApiKey: "mockWebApiKey",
|
|
66
66
|
});
|
|
67
67
|
|
|
68
68
|
const mockResponse: GetAchievementDistributionResponse = {
|
|
@@ -70,7 +70,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
70
70
|
"2": 10,
|
|
71
71
|
"3": 8,
|
|
72
72
|
"4": 4,
|
|
73
|
-
"5": 1
|
|
73
|
+
"5": 1,
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
let requestUrl = "";
|
|
@@ -85,7 +85,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
85
85
|
// ACT
|
|
86
86
|
const response = await getAchievementDistribution(authorization, {
|
|
87
87
|
gameId: 14_402,
|
|
88
|
-
flags: AchievementDistributionFlags.UnofficialAchievements
|
|
88
|
+
flags: AchievementDistributionFlags.UnofficialAchievements,
|
|
89
89
|
});
|
|
90
90
|
|
|
91
91
|
// ASSERT
|
|
@@ -102,7 +102,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
102
102
|
// ARRANGE
|
|
103
103
|
const authorization = buildAuthorization({
|
|
104
104
|
userName: "mockUserName",
|
|
105
|
-
webApiKey: "mockWebApiKey"
|
|
105
|
+
webApiKey: "mockWebApiKey",
|
|
106
106
|
});
|
|
107
107
|
|
|
108
108
|
const mockResponse: GetAchievementDistributionResponse = {
|
|
@@ -110,7 +110,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
110
110
|
"2": 10,
|
|
111
111
|
"3": 8,
|
|
112
112
|
"4": 4,
|
|
113
|
-
"5": 1
|
|
113
|
+
"5": 1,
|
|
114
114
|
};
|
|
115
115
|
|
|
116
116
|
let requestUrl = "";
|
|
@@ -125,7 +125,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
125
125
|
// ACT
|
|
126
126
|
const response = await getAchievementDistribution(authorization, {
|
|
127
127
|
gameId: 14_402,
|
|
128
|
-
hardcore: true
|
|
128
|
+
hardcore: true,
|
|
129
129
|
});
|
|
130
130
|
|
|
131
131
|
// ASSERT
|
|
@@ -139,7 +139,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
139
139
|
// ARRANGE
|
|
140
140
|
const authorization = buildAuthorization({
|
|
141
141
|
userName: "mockUserName",
|
|
142
|
-
webApiKey: "mockWebApiKey"
|
|
142
|
+
webApiKey: "mockWebApiKey",
|
|
143
143
|
});
|
|
144
144
|
|
|
145
145
|
const mockResponse: GetAchievementDistributionResponse = {
|
|
@@ -147,7 +147,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
147
147
|
"2": 10,
|
|
148
148
|
"3": 8,
|
|
149
149
|
"4": 4,
|
|
150
|
-
"5": 1
|
|
150
|
+
"5": 1,
|
|
151
151
|
};
|
|
152
152
|
|
|
153
153
|
let requestUrl = "";
|
|
@@ -162,7 +162,7 @@ describe("Function: getAchievementDistribution", () => {
|
|
|
162
162
|
// ACT
|
|
163
163
|
const response = await getAchievementDistribution(authorization, {
|
|
164
164
|
gameId: 14_402,
|
|
165
|
-
hardcore: false
|
|
165
|
+
hardcore: false,
|
|
166
166
|
});
|
|
167
167
|
|
|
168
168
|
// ASSERT
|
|
@@ -3,7 +3,7 @@ import { apiBaseUrl, buildRequestUrl, call } from "../utils/internal";
|
|
|
3
3
|
import type { AuthObject } from "../utils/public";
|
|
4
4
|
import type {
|
|
5
5
|
AchievementDistributionFlags,
|
|
6
|
-
GetAchievementDistributionResponse
|
|
6
|
+
GetAchievementDistributionResponse,
|
|
7
7
|
} from "./models";
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -84,6 +84,6 @@ export const getAchievementDistribution = async (
|
|
|
84
84
|
);
|
|
85
85
|
|
|
86
86
|
return await call<GetAchievementDistributionResponse>({
|
|
87
|
-
url
|
|
87
|
+
url,
|
|
88
88
|
});
|
|
89
89
|
};
|
package/src/game/getGame.test.ts
CHANGED
|
@@ -25,7 +25,7 @@ describe("Function: getGame", () => {
|
|
|
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: GetGameResponse = {
|
|
@@ -45,7 +45,7 @@ describe("Function: getGame", () => {
|
|
|
45
45
|
Genre: "Racing",
|
|
46
46
|
Released: "1980",
|
|
47
47
|
GameTitle: "Dragster",
|
|
48
|
-
Console: "Atari 2600"
|
|
48
|
+
Console: "Atari 2600",
|
|
49
49
|
};
|
|
50
50
|
|
|
51
51
|
server.use(
|
|
@@ -75,7 +75,7 @@ describe("Function: getGame", () => {
|
|
|
75
75
|
genre: "Racing",
|
|
76
76
|
released: "1980",
|
|
77
77
|
gameTitle: "Dragster",
|
|
78
|
-
console: "Atari 2600"
|
|
78
|
+
console: "Atari 2600",
|
|
79
79
|
});
|
|
80
80
|
});
|
|
81
81
|
});
|
package/src/game/getGame.ts
CHANGED
|
@@ -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 { Game, GetGameResponse } from "./models";
|
|
@@ -58,12 +58,12 @@ export const getGame = async (
|
|
|
58
58
|
const { gameId } = payload;
|
|
59
59
|
|
|
60
60
|
const url = buildRequestUrl(apiBaseUrl, "/API_GetGame.php", authorization, {
|
|
61
|
-
i: gameId
|
|
61
|
+
i: gameId,
|
|
62
62
|
});
|
|
63
63
|
|
|
64
64
|
const rawResponse = await call<GetGameResponse>({ url });
|
|
65
65
|
|
|
66
66
|
return serializeProperties(rawResponse, {
|
|
67
|
-
shouldCastToNumbers: ["ID", "ForumTopicID", "ConsoleID", "Flags"]
|
|
67
|
+
shouldCastToNumbers: ["ID", "ForumTopicID", "ConsoleID", "Flags"],
|
|
68
68
|
});
|
|
69
69
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getGameExtended", () => {
|
|
|
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: GetGameExtendedResponse = {
|
|
@@ -63,9 +63,9 @@ describe("Function: getGameExtended", () => {
|
|
|
63
63
|
DateCreated: "2019-07-31 18:49:57",
|
|
64
64
|
BadgeName: "85541",
|
|
65
65
|
DisplayOrder: "0",
|
|
66
|
-
MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582"
|
|
67
|
-
}
|
|
68
|
-
}
|
|
66
|
+
MemAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582",
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
server.use(
|
|
@@ -113,9 +113,9 @@ describe("Function: getGameExtended", () => {
|
|
|
113
113
|
dateCreated: "2019-07-31 18:49:57",
|
|
114
114
|
badgeName: "85541",
|
|
115
115
|
displayOrder: 0,
|
|
116
|
-
memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582"
|
|
117
|
-
}
|
|
118
|
-
}
|
|
116
|
+
memAddr: "f5c41fa0b5fa0d5fbb8a74c598f18582",
|
|
117
|
+
},
|
|
118
|
+
},
|
|
119
119
|
});
|
|
120
120
|
});
|
|
121
121
|
});
|
|
@@ -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 { GameExtended, GetGameExtendedResponse } from "./models";
|
|
@@ -73,12 +73,12 @@ import type { GameExtended, GetGameExtendedResponse } from "./models";
|
|
|
73
73
|
*/
|
|
74
74
|
export const getGameExtended = async (
|
|
75
75
|
authorization: AuthObject,
|
|
76
|
-
payload: { gameId: ID; isRequestingUnofficialAchievements
|
|
76
|
+
payload: { gameId: ID; isRequestingUnofficialAchievements?: boolean }
|
|
77
77
|
): Promise<GameExtended> => {
|
|
78
78
|
const { gameId, isRequestingUnofficialAchievements } = payload;
|
|
79
79
|
|
|
80
80
|
const params: Record<string, string | number> = {
|
|
81
|
-
i: gameId
|
|
81
|
+
i: gameId,
|
|
82
82
|
};
|
|
83
83
|
|
|
84
84
|
if (isRequestingUnofficialAchievements) {
|
|
@@ -103,7 +103,7 @@ export const getGameExtended = async (
|
|
|
103
103
|
"TrueRatio",
|
|
104
104
|
"DisplayOrder",
|
|
105
105
|
"NumDistinctPlayersCasual",
|
|
106
|
-
"NumDistinctPlayersHardcore"
|
|
107
|
-
]
|
|
106
|
+
"NumDistinctPlayersHardcore",
|
|
107
|
+
],
|
|
108
108
|
});
|
|
109
109
|
};
|
|
@@ -25,7 +25,7 @@ describe("Function: getGameRankAndScore", () => {
|
|
|
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: GetGameRankAndScoreResponse = [
|
|
@@ -33,8 +33,8 @@ describe("Function: getGameRankAndScore", () => {
|
|
|
33
33
|
User: "Arekdias",
|
|
34
34
|
TotalScore: "189",
|
|
35
35
|
LastAward: "2020-10-10 22:43:32",
|
|
36
|
-
Rank: 1
|
|
37
|
-
}
|
|
36
|
+
Rank: 1,
|
|
37
|
+
},
|
|
38
38
|
];
|
|
39
39
|
|
|
40
40
|
server.use(
|
|
@@ -46,7 +46,7 @@ describe("Function: getGameRankAndScore", () => {
|
|
|
46
46
|
// ACT
|
|
47
47
|
const response = await getGameRankAndScore(authorization, {
|
|
48
48
|
gameId: 14_402,
|
|
49
|
-
type: "high-scores"
|
|
49
|
+
type: "high-scores",
|
|
50
50
|
});
|
|
51
51
|
|
|
52
52
|
// ASSERT
|
|
@@ -55,8 +55,8 @@ describe("Function: getGameRankAndScore", () => {
|
|
|
55
55
|
user: "Arekdias",
|
|
56
56
|
totalScore: 189,
|
|
57
57
|
lastAward: "2020-10-10 22:43:32",
|
|
58
|
-
rank: 1
|
|
59
|
-
}
|
|
58
|
+
rank: 1,
|
|
59
|
+
},
|
|
60
60
|
]);
|
|
61
61
|
});
|
|
62
62
|
});
|
|
@@ -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
|
GameRankAndScoreEntity,
|
|
11
|
-
GetGameRankAndScoreResponse
|
|
11
|
+
GetGameRankAndScoreResponse,
|
|
12
12
|
} from "./models";
|
|
13
13
|
|
|
14
14
|
/**
|
|
@@ -55,13 +55,13 @@ export const getGameRankAndScore = async (
|
|
|
55
55
|
authorization,
|
|
56
56
|
{
|
|
57
57
|
g: gameId,
|
|
58
|
-
t: type === "latest-masters" ? 1 : 0
|
|
58
|
+
t: type === "latest-masters" ? 1 : 0,
|
|
59
59
|
}
|
|
60
60
|
);
|
|
61
61
|
|
|
62
62
|
const rawResponse = await call<GetGameRankAndScoreResponse>({ url });
|
|
63
63
|
|
|
64
64
|
return serializeProperties(rawResponse, {
|
|
65
|
-
shouldCastToNumbers: ["TotalScore"]
|
|
65
|
+
shouldCastToNumbers: ["TotalScore"],
|
|
66
66
|
});
|
|
67
67
|
};
|
|
@@ -23,7 +23,7 @@ describe("Function: getGameRating", () => {
|
|
|
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: GetGameRatingResponse = {
|
|
@@ -32,8 +32,8 @@ describe("Function: getGameRating", () => {
|
|
|
32
32
|
Game: 3.1875,
|
|
33
33
|
Achievements: 0,
|
|
34
34
|
GameNumVotes: 16,
|
|
35
|
-
AchievementsNumVotes: 0
|
|
36
|
-
}
|
|
35
|
+
AchievementsNumVotes: 0,
|
|
36
|
+
},
|
|
37
37
|
};
|
|
38
38
|
|
|
39
39
|
server.use(
|
|
@@ -52,8 +52,8 @@ describe("Function: getGameRating", () => {
|
|
|
52
52
|
game: 3.1875,
|
|
53
53
|
achievements: 0,
|
|
54
54
|
gameNumVotes: 16,
|
|
55
|
-
achievementsNumVotes: 0
|
|
56
|
-
}
|
|
55
|
+
achievementsNumVotes: 0,
|
|
56
|
+
},
|
|
57
57
|
});
|
|
58
58
|
});
|
|
59
59
|
});
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
import type { AchievementType } from "../../achievement";
|
|
2
|
+
|
|
1
3
|
export interface GameExtendedAchievementEntity {
|
|
2
4
|
id: number;
|
|
3
5
|
numAwarded: number;
|
|
@@ -12,4 +14,5 @@ export interface GameExtendedAchievementEntity {
|
|
|
12
14
|
badgeName: string;
|
|
13
15
|
displayOrder: number;
|
|
14
16
|
memAddr: string;
|
|
17
|
+
type: AchievementType;
|
|
15
18
|
}
|
|
@@ -10,7 +10,7 @@ import type {
|
|
|
10
10
|
MostTicketedGamesResponse,
|
|
11
11
|
RecentTicketsResponse,
|
|
12
12
|
ResponseTicketEntity,
|
|
13
|
-
TicketsByUserResponse
|
|
13
|
+
TicketsByUserResponse,
|
|
14
14
|
} from "./models";
|
|
15
15
|
|
|
16
16
|
const server = setupServer();
|
|
@@ -29,7 +29,7 @@ describe("Function: getTicketData", () => {
|
|
|
29
29
|
// ARRANGE
|
|
30
30
|
const authorization = buildAuthorization({
|
|
31
31
|
userName: "mockUserName",
|
|
32
|
-
webApiKey: "mockWebApiKey"
|
|
32
|
+
webApiKey: "mockWebApiKey",
|
|
33
33
|
});
|
|
34
34
|
|
|
35
35
|
const mockResponse: ResponseTicketEntity = {
|
|
@@ -54,7 +54,7 @@ describe("Function: getTicketData", () => {
|
|
|
54
54
|
ResolvedBy: "televandalist",
|
|
55
55
|
ReportStateDescription: "Resolved",
|
|
56
56
|
ReportTypeDescription: "Triggered at the wrong time",
|
|
57
|
-
URL: "https://retroachievements.org/ticketmanager.php?i=10000"
|
|
57
|
+
URL: "https://retroachievements.org/ticketmanager.php?i=10000",
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
server.use(
|
|
@@ -89,7 +89,7 @@ describe("Function: getTicketData", () => {
|
|
|
89
89
|
resolvedBy: "televandalist",
|
|
90
90
|
reportStateDescription: "Resolved",
|
|
91
91
|
reportTypeDescription: "Triggered at the wrong time",
|
|
92
|
-
url: "https://retroachievements.org/ticketmanager.php?i=10000"
|
|
92
|
+
url: "https://retroachievements.org/ticketmanager.php?i=10000",
|
|
93
93
|
});
|
|
94
94
|
});
|
|
95
95
|
|
|
@@ -97,7 +97,7 @@ describe("Function: getTicketData", () => {
|
|
|
97
97
|
// ARRANGE
|
|
98
98
|
const authorization = buildAuthorization({
|
|
99
99
|
userName: "mockUserName",
|
|
100
|
-
webApiKey: "mockWebApiKey"
|
|
100
|
+
webApiKey: "mockWebApiKey",
|
|
101
101
|
});
|
|
102
102
|
|
|
103
103
|
const mockResponse: RecentTicketsResponse = {
|
|
@@ -128,11 +128,11 @@ describe("Function: getTicketData", () => {
|
|
|
128
128
|
ResolvedBy: null,
|
|
129
129
|
ReportState: "1",
|
|
130
130
|
ReportStateDescription: "Open",
|
|
131
|
-
ReportTypeDescription: "Did not trigger"
|
|
132
|
-
}
|
|
131
|
+
ReportTypeDescription: "Did not trigger",
|
|
132
|
+
},
|
|
133
133
|
],
|
|
134
134
|
OpenTickets: 715,
|
|
135
|
-
URL: "https://retroachievements.org/ticketmanager.php"
|
|
135
|
+
URL: "https://retroachievements.org/ticketmanager.php",
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
server.use(
|
|
@@ -173,11 +173,11 @@ describe("Function: getTicketData", () => {
|
|
|
173
173
|
resolvedBy: null,
|
|
174
174
|
reportState: 1,
|
|
175
175
|
reportStateDescription: "Open",
|
|
176
|
-
reportTypeDescription: "Did not trigger"
|
|
177
|
-
}
|
|
176
|
+
reportTypeDescription: "Did not trigger",
|
|
177
|
+
},
|
|
178
178
|
],
|
|
179
179
|
openTickets: 715,
|
|
180
|
-
url: "https://retroachievements.org/ticketmanager.php"
|
|
180
|
+
url: "https://retroachievements.org/ticketmanager.php",
|
|
181
181
|
});
|
|
182
182
|
});
|
|
183
183
|
|
|
@@ -185,7 +185,7 @@ describe("Function: getTicketData", () => {
|
|
|
185
185
|
// ARRANGE
|
|
186
186
|
const authorization = buildAuthorization({
|
|
187
187
|
userName: "mockUserName",
|
|
188
|
-
webApiKey: "mockWebApiKey"
|
|
188
|
+
webApiKey: "mockWebApiKey",
|
|
189
189
|
});
|
|
190
190
|
|
|
191
191
|
const mockResponse: MostTicketedGamesResponse = {
|
|
@@ -195,17 +195,17 @@ describe("Function: getTicketData", () => {
|
|
|
195
195
|
GameTitle: "Driver 2: The Wheelman Is Back",
|
|
196
196
|
GameIcon: "/Images/046592.png",
|
|
197
197
|
Console: "PlayStation",
|
|
198
|
-
OpenTickets: "16"
|
|
198
|
+
OpenTickets: "16",
|
|
199
199
|
},
|
|
200
200
|
{
|
|
201
201
|
GameID: "5515",
|
|
202
202
|
GameTitle: "Ninja Ryuuken Den | Ninja Gaiden",
|
|
203
203
|
GameIcon: "/Images/020735.png",
|
|
204
204
|
Console: "PC Engine",
|
|
205
|
-
OpenTickets: "15"
|
|
206
|
-
}
|
|
205
|
+
OpenTickets: "15",
|
|
206
|
+
},
|
|
207
207
|
],
|
|
208
|
-
URL: "https://retroachievements.org/ticketmanager.php?f=1"
|
|
208
|
+
URL: "https://retroachievements.org/ticketmanager.php?f=1",
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
server.use(
|
|
@@ -216,7 +216,7 @@ describe("Function: getTicketData", () => {
|
|
|
216
216
|
|
|
217
217
|
// ACT
|
|
218
218
|
const response = await getTicketData(authorization, {
|
|
219
|
-
isGettingMostTicketedGames: true
|
|
219
|
+
isGettingMostTicketedGames: true,
|
|
220
220
|
});
|
|
221
221
|
|
|
222
222
|
// ASSERT
|
|
@@ -227,17 +227,17 @@ describe("Function: getTicketData", () => {
|
|
|
227
227
|
gameTitle: "Driver 2: The Wheelman Is Back",
|
|
228
228
|
gameIcon: "/Images/046592.png",
|
|
229
229
|
console: "PlayStation",
|
|
230
|
-
openTickets: 16
|
|
230
|
+
openTickets: 16,
|
|
231
231
|
},
|
|
232
232
|
{
|
|
233
233
|
gameId: 5515,
|
|
234
234
|
gameTitle: "Ninja Ryuuken Den | Ninja Gaiden",
|
|
235
235
|
gameIcon: "/Images/020735.png",
|
|
236
236
|
console: "PC Engine",
|
|
237
|
-
openTickets: 15
|
|
238
|
-
}
|
|
237
|
+
openTickets: 15,
|
|
238
|
+
},
|
|
239
239
|
],
|
|
240
|
-
url: "https://retroachievements.org/ticketmanager.php?f=1"
|
|
240
|
+
url: "https://retroachievements.org/ticketmanager.php?f=1",
|
|
241
241
|
});
|
|
242
242
|
});
|
|
243
243
|
|
|
@@ -245,7 +245,7 @@ describe("Function: getTicketData", () => {
|
|
|
245
245
|
// ARRANGE
|
|
246
246
|
const authorization = buildAuthorization({
|
|
247
247
|
userName: "mockUserName",
|
|
248
|
-
webApiKey: "mockWebApiKey"
|
|
248
|
+
webApiKey: "mockWebApiKey",
|
|
249
249
|
});
|
|
250
250
|
|
|
251
251
|
const mockResponse: TicketsByUserResponse = {
|
|
@@ -254,7 +254,7 @@ describe("Function: getTicketData", () => {
|
|
|
254
254
|
Closed: 18,
|
|
255
255
|
Resolved: 51,
|
|
256
256
|
Total: 69,
|
|
257
|
-
URL: "https://retroachievements.org/ticketmanager.php?u=Jamiras"
|
|
257
|
+
URL: "https://retroachievements.org/ticketmanager.php?u=Jamiras",
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
server.use(
|
|
@@ -273,7 +273,7 @@ describe("Function: getTicketData", () => {
|
|
|
273
273
|
closed: 18,
|
|
274
274
|
resolved: 51,
|
|
275
275
|
total: 69,
|
|
276
|
-
url: "https://retroachievements.org/ticketmanager.php?u=Jamiras"
|
|
276
|
+
url: "https://retroachievements.org/ticketmanager.php?u=Jamiras",
|
|
277
277
|
});
|
|
278
278
|
});
|
|
279
279
|
|
|
@@ -281,7 +281,7 @@ describe("Function: getTicketData", () => {
|
|
|
281
281
|
// ARRANGE
|
|
282
282
|
const authorization = buildAuthorization({
|
|
283
283
|
userName: "mockUserName",
|
|
284
|
-
webApiKey: "mockWebApiKey"
|
|
284
|
+
webApiKey: "mockWebApiKey",
|
|
285
285
|
});
|
|
286
286
|
|
|
287
287
|
const mockResponse: GameTicketsResponse = {
|
|
@@ -289,7 +289,7 @@ describe("Function: getTicketData", () => {
|
|
|
289
289
|
GameTitle: "Rampage 2: Universal Tour",
|
|
290
290
|
ConsoleName: "Nintendo 64",
|
|
291
291
|
OpenTickets: 8,
|
|
292
|
-
URL: "https://retroachievements.org/ticketmanager.php?g=10329"
|
|
292
|
+
URL: "https://retroachievements.org/ticketmanager.php?g=10329",
|
|
293
293
|
};
|
|
294
294
|
|
|
295
295
|
server.use(
|
|
@@ -307,7 +307,7 @@ describe("Function: getTicketData", () => {
|
|
|
307
307
|
gameTitle: "Rampage 2: Universal Tour",
|
|
308
308
|
consoleName: "Nintendo 64",
|
|
309
309
|
openTickets: 8,
|
|
310
|
-
url: "https://retroachievements.org/ticketmanager.php?g=10329"
|
|
310
|
+
url: "https://retroachievements.org/ticketmanager.php?g=10329",
|
|
311
311
|
});
|
|
312
312
|
});
|
|
313
313
|
|
|
@@ -315,7 +315,7 @@ describe("Function: getTicketData", () => {
|
|
|
315
315
|
// ARRANGE
|
|
316
316
|
const authorization = buildAuthorization({
|
|
317
317
|
userName: "mockUserName",
|
|
318
|
-
webApiKey: "mockWebApiKey"
|
|
318
|
+
webApiKey: "mockWebApiKey",
|
|
319
319
|
});
|
|
320
320
|
|
|
321
321
|
const mockResponse: AchievementTicketStatsResponse = {
|
|
@@ -323,7 +323,7 @@ describe("Function: getTicketData", () => {
|
|
|
323
323
|
AchievementTitle: "Blue Potaras Collector",
|
|
324
324
|
AchievementDescription: "Unlock all Ability Type Z-Items",
|
|
325
325
|
URL: "https://retroachievements.org/ticketmanager.php?a=283331",
|
|
326
|
-
OpenTickets: 1
|
|
326
|
+
OpenTickets: 1,
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
server.use(
|
|
@@ -334,7 +334,7 @@ describe("Function: getTicketData", () => {
|
|
|
334
334
|
|
|
335
335
|
// ACT
|
|
336
336
|
const response = await getTicketData(authorization, {
|
|
337
|
-
achievementId: 283_331
|
|
337
|
+
achievementId: 283_331,
|
|
338
338
|
});
|
|
339
339
|
|
|
340
340
|
// ASSERT
|
|
@@ -343,7 +343,7 @@ describe("Function: getTicketData", () => {
|
|
|
343
343
|
achievementTitle: "Blue Potaras Collector",
|
|
344
344
|
achievementDescription: "Unlock all Ability Type Z-Items",
|
|
345
345
|
url: "https://retroachievements.org/ticketmanager.php?a=283331",
|
|
346
|
-
openTickets: 1
|
|
346
|
+
openTickets: 1,
|
|
347
347
|
});
|
|
348
348
|
});
|
|
349
349
|
});
|
|
@@ -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> = {};
|