@retroachievements/api 1.2.1 → 1.4.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 +38 -49
- package/dist/__playground.d.ts +8 -8
- package/dist/achievement/getAchievementUnlocks.d.ts +46 -46
- package/dist/achievement/getAchievementUnlocks.test.d.ts +1 -1
- package/dist/achievement/index.d.ts +2 -2
- package/dist/achievement/models/achievement-unlock-entity.model.d.ts +29 -29
- package/dist/achievement/models/get-achievement-unlocks-response.model.d.ts +30 -30
- package/dist/achievement/models/index.d.ts +2 -2
- 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 +22 -22
- package/dist/console/getConsoleIds.test.d.ts +1 -1
- package/dist/console/getGameList.d.ts +53 -53
- package/dist/console/getGameList.test.d.ts +1 -1
- package/dist/console/index.d.ts +3 -3
- package/dist/console/models/console-id.model.d.ts +4 -4
- package/dist/console/models/game-list.model.d.ts +15 -15
- package/dist/console/models/get-console-ids-response.model.d.ts +4 -4
- package/dist/console/models/get-game-list-response.model.d.ts +15 -15
- package/dist/console/models/index.d.ts +4 -4
- package/dist/feed/getAchievementOfTheWeek.d.ts +48 -48
- package/dist/feed/getAchievementOfTheWeek.test.d.ts +1 -1
- package/dist/feed/getActiveClaims.d.ts +40 -40
- package/dist/feed/getActiveClaims.test.d.ts +1 -1
- package/dist/feed/getClaims.d.ts +7 -7
- package/dist/feed/getClaims.test.d.ts +1 -1
- package/dist/feed/getTopTenUsers.d.ts +24 -24
- package/dist/feed/getTopTenUsers.test.d.ts +1 -1
- package/dist/feed/index.d.ts +5 -5
- package/dist/feed/models/achievement-of-the-week.model.d.ts +32 -32
- package/dist/feed/models/claim-set-type.enum.d.ts +4 -4
- package/dist/feed/models/claim-status.enum.d.ts +5 -5
- package/dist/feed/models/claim-type.enum.d.ts +4 -4
- package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +32 -32
- package/dist/feed/models/get-set-claims-response.model.d.ts +21 -21
- package/dist/feed/models/get-top-ten-users-response.model.d.ts +10 -10
- package/dist/feed/models/index.d.ts +10 -10
- package/dist/feed/models/set-claim.model.d.ts +43 -43
- package/dist/feed/models/top-ten-users-entity.model.d.ts +5 -5
- package/dist/feed/models/top-ten-users.model.d.ts +2 -2
- package/dist/game/getAchievementCount.d.ts +32 -32
- package/dist/game/getAchievementCount.test.d.ts +1 -1
- package/dist/game/getAchievementDistribution.d.ts +58 -58
- package/dist/game/getAchievementDistribution.test.d.ts +1 -1
- package/dist/game/getGame.d.ts +49 -49
- package/dist/game/getGame.test.d.ts +1 -1
- package/dist/game/getGameExtended.d.ts +70 -69
- package/dist/game/getGameExtended.test.d.ts +1 -1
- package/dist/game/getGameRankAndScore.d.ts +39 -39
- package/dist/game/getGameRankAndScore.test.d.ts +1 -1
- package/dist/game/getGameRating.d.ts +39 -39
- package/dist/game/getGameRating.test.d.ts +1 -1
- package/dist/game/index.d.ts +7 -7
- package/dist/game/models/achievement-count.model.d.ts +4 -4
- package/dist/game/models/achievement-distribution-flags.enum.d.ts +4 -4
- package/dist/game/models/game-extended-achievement-entity.model.d.ts +15 -15
- package/dist/game/models/game-extended-claim-entity.model.d.ts +7 -7
- package/dist/game/models/game-extended.model.d.ts +25 -25
- package/dist/game/models/game-rank-and-score-entity.model.d.ts +6 -6
- package/dist/game/models/game-rating.model.d.ts +9 -9
- package/dist/game/models/game.model.d.ts +19 -19
- package/dist/game/models/get-achievement-count-response.model.d.ts +4 -4
- package/dist/game/models/get-achievement-distribution-response.model.d.ts +1 -1
- package/dist/game/models/get-game-extended-response.model.d.ts +50 -50
- package/dist/game/models/get-game-rank-and-score-response.model.d.ts +8 -8
- package/dist/game/models/get-game-rating-response.model.d.ts +9 -9
- package/dist/game/models/get-game-response.model.d.ts +19 -19
- package/dist/game/models/index.d.ts +14 -14
- package/dist/index.d.ts +7 -7
- package/dist/ticket/getTicketData.d.ts +159 -159
- package/dist/ticket/getTicketData.test.d.ts +1 -1
- package/dist/ticket/index.d.ts +2 -2
- package/dist/ticket/models/achievement-ticket-stats-response.model.d.ts +7 -7
- package/dist/ticket/models/achievement-ticket-stats.model.d.ts +7 -7
- package/dist/ticket/models/game-ticket-stats.model.d.ts +9 -9
- package/dist/ticket/models/game-tickets-response.model.d.ts +7 -7
- package/dist/ticket/models/index.d.ts +12 -12
- package/dist/ticket/models/most-ticketed-games-response.model.d.ts +12 -12
- package/dist/ticket/models/most-ticketed-games.model.d.ts +11 -11
- package/dist/ticket/models/recent-tickets-response.model.d.ts +6 -6
- package/dist/ticket/models/recent-tickets.model.d.ts +6 -6
- package/dist/ticket/models/response-ticket-entity.model.d.ts +24 -24
- package/dist/ticket/models/ticket-entity.model.d.ts +24 -24
- package/dist/ticket/models/tickets-by-user-response.model.d.ts +8 -8
- package/dist/ticket/models/user-ticket-stats.model.d.ts +8 -8
- package/dist/user/getAchievementsEarnedBetween.d.ts +59 -59
- package/dist/user/getAchievementsEarnedBetween.test.d.ts +1 -1
- package/dist/user/getAchievementsEarnedOnDay.d.ts +57 -57
- package/dist/user/getAchievementsEarnedOnDay.test.d.ts +1 -1
- package/dist/user/getGameInfoAndUserProgress.d.ts +81 -81
- package/dist/user/getGameInfoAndUserProgress.test.d.ts +1 -1
- package/dist/user/getUserAwards.d.ts +49 -47
- package/dist/user/getUserAwards.test.d.ts +1 -1
- package/dist/user/getUserClaims.d.ts +27 -27
- package/dist/user/getUserClaims.test.d.ts +1 -1
- package/dist/user/getUserCompletedGames.d.ts +56 -56
- package/dist/user/getUserCompletedGames.test.d.ts +1 -1
- package/dist/user/getUserCompletionProgress.d.ts +51 -0
- package/dist/user/getUserCompletionProgress.test.d.ts +1 -0
- package/dist/user/getUserGameRankAndScore.d.ts +45 -45
- package/dist/user/getUserGameRankAndScore.test.d.ts +1 -1
- package/dist/user/getUserPoints.d.ts +30 -30
- package/dist/user/getUserPoints.test.d.ts +1 -1
- package/dist/user/getUserProfile.d.ts +24 -0
- package/dist/user/getUserProfile.test.d.ts +1 -0
- package/dist/user/getUserProgress.d.ts +50 -50
- package/dist/user/getUserProgress.test.d.ts +1 -1
- package/dist/user/getUserRecentAchievements.d.ts +49 -49
- package/dist/user/getUserRecentAchievements.test.d.ts +1 -1
- package/dist/user/getUserRecentlyPlayedGames.d.ts +50 -50
- package/dist/user/getUserRecentlyPlayedGames.test.d.ts +1 -1
- package/dist/user/getUserSummary.d.ts +32 -32
- package/dist/user/getUserSummary.test.d.ts +1 -1
- package/dist/user/index.d.ts +15 -13
- package/dist/user/models/award-type.model.d.ts +1 -1
- package/dist/user/models/dated-user-achievement.model.d.ts +17 -17
- package/dist/user/models/dated-user-achievements-response.model.d.ts +19 -19
- package/dist/user/models/game-info-and-user-progress.model.d.ts +12 -12
- package/dist/user/models/get-game-info-and-user-progress-response.model.d.ts +14 -14
- package/dist/user/models/get-user-awards-response.model.d.ts +24 -22
- package/dist/user/models/get-user-completed-games-response.model.d.ts +13 -13
- package/dist/user/models/get-user-completion-progress-response.model.d.ts +19 -0
- package/dist/user/models/get-user-game-rank-and-score-response.model.d.ts +8 -8
- package/dist/user/models/get-user-points-response.model.d.ts +4 -4
- package/dist/user/models/get-user-profile-response.model.d.ts +17 -0
- package/dist/user/models/get-user-progress-response.model.d.ts +10 -10
- package/dist/user/models/get-user-recent-achievements-response.model.d.ts +18 -18
- package/dist/user/models/get-user-recently-played-games-response.model.d.ts +17 -17
- package/dist/user/models/get-user-summary-response.model.d.ts +82 -82
- package/dist/user/models/index.d.ts +28 -23
- package/dist/user/models/user-awards.model.d.ts +24 -22
- package/dist/user/models/user-claims-response.model.d.ts +19 -19
- package/dist/user/models/user-claims.model.d.ts +19 -19
- package/dist/user/models/user-completed-games.model.d.ts +12 -12
- package/dist/user/models/user-completion-progress-entity.model.d.ts +13 -0
- package/dist/user/models/user-completion-progress.model.d.ts +6 -0
- package/dist/user/models/user-game-rank-and-score.model.d.ts +7 -7
- package/dist/user/models/user-points.model.d.ts +4 -4
- package/dist/user/models/user-profile.model.d.ts +17 -0
- package/dist/user/models/user-progress.model.d.ts +9 -9
- package/dist/user/models/user-recent-achievement.model.d.ts +16 -16
- package/dist/user/models/user-recently-played-games.model.d.ts +16 -16
- package/dist/user/models/user-summary.model.d.ts +82 -82
- package/dist/utils/internal/apiBaseUrl.d.ts +1 -1
- package/dist/utils/internal/buildRequestUrl.d.ts +2 -2
- package/dist/utils/internal/buildRequestUrl.test.d.ts +1 -1
- package/dist/utils/internal/call.d.ts +11 -20
- package/dist/utils/internal/call.test.d.ts +1 -1
- package/dist/utils/internal/id.model.d.ts +1 -1
- package/dist/utils/internal/index.d.ts +5 -5
- package/dist/utils/internal/serializeProperties.d.ts +4 -4
- package/dist/utils/internal/serializeProperties.test.d.ts +1 -1
- package/dist/utils/public/buildAuthorization.d.ts +22 -22
- package/dist/utils/public/buildAuthorization.test.d.ts +1 -1
- package/dist/utils/public/index.d.ts +3 -3
- package/dist/utils/public/models/auth-object.model.d.ts +19 -19
- package/dist/utils/public/models/index.d.ts +1 -1
- package/package.json +24 -31
- package/src/achievement/getAchievementUnlocks.test.ts +9 -12
- package/src/console/getConsoleIds.test.ts +3 -3
- package/src/console/getGameList.test.ts +3 -3
- package/src/feed/getAchievementOfTheWeek.test.ts +5 -5
- package/src/feed/getActiveClaims.test.ts +3 -3
- package/src/feed/getClaims.test.ts +3 -3
- package/src/feed/getTopTenUsers.test.ts +3 -3
- package/src/game/getAchievementCount.test.ts +3 -3
- package/src/game/getAchievementDistribution.test.ts +33 -44
- package/src/game/getGame.test.ts +4 -4
- package/src/game/getGame.ts +2 -8
- package/src/game/getGameExtended.test.ts +4 -4
- package/src/game/getGameExtended.ts +13 -8
- package/src/game/getGameRankAndScore.test.ts +3 -3
- package/src/game/getGameRating.test.ts +3 -3
- package/src/game/models/game-extended.model.ts +1 -1
- package/src/game/models/game.model.ts +1 -1
- package/src/ticket/getTicketData.test.ts +13 -13
- package/src/user/getAchievementsEarnedBetween.test.ts +3 -4
- package/src/user/getAchievementsEarnedOnDay.test.ts +3 -4
- package/src/user/getGameInfoAndUserProgress.test.ts +3 -4
- package/src/user/getUserAwards.test.ts +7 -3
- package/src/user/getUserAwards.ts +2 -0
- package/src/user/getUserClaims.test.ts +3 -3
- package/src/user/getUserCompletedGames.test.ts +3 -3
- package/src/user/getUserCompletionProgress.test.ts +81 -0
- package/src/user/getUserCompletionProgress.ts +83 -0
- package/src/user/getUserGameRankAndScore.test.ts +3 -3
- package/src/user/getUserPoints.test.ts +3 -3
- package/src/user/getUserProfile.test.ts +79 -0
- package/src/user/getUserProfile.ts +55 -0
- package/src/user/getUserProgress.test.ts +3 -3
- package/src/user/getUserRecentAchievements.test.ts +3 -4
- package/src/user/getUserRecentlyPlayedGames.test.ts +3 -4
- package/src/user/getUserSummary.test.ts +5 -5
- package/src/user/getUserSummary.ts +1 -3
- package/src/user/index.ts +2 -0
- package/src/user/models/award-type.model.ts +5 -4
- package/src/user/models/get-user-awards-response.model.ts +2 -0
- package/src/user/models/get-user-completion-progress-response.model.ts +25 -0
- package/src/user/models/get-user-profile-response.model.ts +17 -0
- package/src/user/models/index.ts +5 -0
- package/src/user/models/user-awards.model.ts +2 -0
- package/src/user/models/user-completion-progress-entity.model.ts +19 -0
- package/src/user/models/user-completion-progress.model.ts +7 -0
- package/src/user/models/user-profile.model.ts +17 -0
- package/src/utils/internal/buildRequestUrl.ts +1 -1
- package/src/utils/internal/call.test.ts +9 -10
- package/src/utils/internal/call.ts +1 -12
- package/src/utils/internal/serializeProperties.ts +4 -4
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -58,8 +58,8 @@ describe("Function: getTicketData", () => {
|
|
|
58
58
|
};
|
|
59
59
|
|
|
60
60
|
server.use(
|
|
61
|
-
|
|
62
|
-
|
|
61
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
62
|
+
HttpResponse.json(mockResponse)
|
|
63
63
|
)
|
|
64
64
|
);
|
|
65
65
|
|
|
@@ -136,8 +136,8 @@ describe("Function: getTicketData", () => {
|
|
|
136
136
|
};
|
|
137
137
|
|
|
138
138
|
server.use(
|
|
139
|
-
|
|
140
|
-
|
|
139
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
140
|
+
HttpResponse.json(mockResponse)
|
|
141
141
|
)
|
|
142
142
|
);
|
|
143
143
|
|
|
@@ -209,8 +209,8 @@ describe("Function: getTicketData", () => {
|
|
|
209
209
|
};
|
|
210
210
|
|
|
211
211
|
server.use(
|
|
212
|
-
|
|
213
|
-
|
|
212
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
213
|
+
HttpResponse.json(mockResponse)
|
|
214
214
|
)
|
|
215
215
|
);
|
|
216
216
|
|
|
@@ -258,8 +258,8 @@ describe("Function: getTicketData", () => {
|
|
|
258
258
|
};
|
|
259
259
|
|
|
260
260
|
server.use(
|
|
261
|
-
|
|
262
|
-
|
|
261
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
262
|
+
HttpResponse.json(mockResponse)
|
|
263
263
|
)
|
|
264
264
|
);
|
|
265
265
|
|
|
@@ -293,8 +293,8 @@ describe("Function: getTicketData", () => {
|
|
|
293
293
|
};
|
|
294
294
|
|
|
295
295
|
server.use(
|
|
296
|
-
|
|
297
|
-
|
|
296
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
297
|
+
HttpResponse.json(mockResponse)
|
|
298
298
|
)
|
|
299
299
|
);
|
|
300
300
|
|
|
@@ -327,8 +327,8 @@ describe("Function: getTicketData", () => {
|
|
|
327
327
|
};
|
|
328
328
|
|
|
329
329
|
server.use(
|
|
330
|
-
|
|
331
|
-
|
|
330
|
+
http.get(`${apiBaseUrl}/API_GetTicketData.php`, () =>
|
|
331
|
+
HttpResponse.json(mockResponse)
|
|
332
332
|
)
|
|
333
333
|
);
|
|
334
334
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -47,9 +47,8 @@ describe("Function: getAchievementsEarnedBetween", () => {
|
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
server.use(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(_, res, ctx) => res(ctx.json(mockResponse))
|
|
50
|
+
http.get(`${apiBaseUrl}/API_GetAchievementsEarnedBetween.php`, () =>
|
|
51
|
+
HttpResponse.json(mockResponse)
|
|
53
52
|
)
|
|
54
53
|
);
|
|
55
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -47,9 +47,8 @@ describe("Function: getAchievementsEarnedOnDay", () => {
|
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
server.use(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(_, res, ctx) => res(ctx.json(mockResponse))
|
|
50
|
+
http.get(`${apiBaseUrl}/API_GetAchievementsEarnedOnDay.php`, () =>
|
|
51
|
+
HttpResponse.json(mockResponse)
|
|
53
52
|
)
|
|
54
53
|
);
|
|
55
54
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { http, HttpResponse } from "msw";
|
|
4
4
|
import { setupServer } from "msw/node";
|
|
5
5
|
|
|
6
6
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -74,9 +74,8 @@ describe("Function: getGameInfoAndUserProgress", () => {
|
|
|
74
74
|
};
|
|
75
75
|
|
|
76
76
|
server.use(
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
(_, res, ctx) => res(ctx.json(mockResponse))
|
|
77
|
+
http.get(`${apiBaseUrl}/API_GetGameInfoAndUserProgress.php`, () =>
|
|
78
|
+
HttpResponse.json(mockResponse)
|
|
80
79
|
)
|
|
81
80
|
);
|
|
82
81
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -31,6 +31,8 @@ describe("Function: getUserAwards", () => {
|
|
|
31
31
|
HiddenAwardsCount: 5,
|
|
32
32
|
MasteryAwardsCount: 5,
|
|
33
33
|
CompletionAwardsCount: 0,
|
|
34
|
+
BeatenHardcoreAwardsCount: 24,
|
|
35
|
+
BeatenSoftcoreAwardsCount: 7,
|
|
34
36
|
EventAwardsCount: 0,
|
|
35
37
|
SiteAwardsCount: 0,
|
|
36
38
|
VisibleUserAwards: [
|
|
@@ -49,8 +51,8 @@ describe("Function: getUserAwards", () => {
|
|
|
49
51
|
};
|
|
50
52
|
|
|
51
53
|
server.use(
|
|
52
|
-
|
|
53
|
-
|
|
54
|
+
http.get(`${apiBaseUrl}/API_GetUserAwards.php`, () =>
|
|
55
|
+
HttpResponse.json(mockResponse)
|
|
54
56
|
)
|
|
55
57
|
);
|
|
56
58
|
|
|
@@ -63,6 +65,8 @@ describe("Function: getUserAwards", () => {
|
|
|
63
65
|
hiddenAwardsCount: 5,
|
|
64
66
|
masteryAwardsCount: 5,
|
|
65
67
|
completionAwardsCount: 0,
|
|
68
|
+
beatenHardcoreAwardsCount: 24,
|
|
69
|
+
beatenSoftcoreAwardsCount: 7,
|
|
66
70
|
eventAwardsCount: 0,
|
|
67
71
|
siteAwardsCount: 0,
|
|
68
72
|
visibleUserAwards: [
|
|
@@ -31,6 +31,8 @@ import type { GetUserAwardsResponse, UserAwards } from "./models";
|
|
|
31
31
|
* hiddenAwardsCount: 2,
|
|
32
32
|
* masteryAwardsCount: 6,
|
|
33
33
|
* completionAwardsCount: 0,
|
|
34
|
+
* beatenHardcoreAwardsCount: 24,
|
|
35
|
+
* beatenSoftcoreAwardsCount: 7,
|
|
34
36
|
* eventAwardsCount: 0,
|
|
35
37
|
* siteAwardsCount: 2,
|
|
36
38
|
* visibleUserAwards: [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { http, HttpResponse } from "msw";
|
|
4
4
|
import { setupServer } from "msw/node";
|
|
5
5
|
|
|
6
6
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -48,8 +48,8 @@ describe("Function: getUserClaims", () => {
|
|
|
48
48
|
];
|
|
49
49
|
|
|
50
50
|
server.use(
|
|
51
|
-
|
|
52
|
-
|
|
51
|
+
http.get(`${apiBaseUrl}/API_GetUserClaims.php`, () =>
|
|
52
|
+
HttpResponse.json(mockResponse)
|
|
53
53
|
)
|
|
54
54
|
);
|
|
55
55
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { http, HttpResponse } from "msw";
|
|
4
4
|
import { setupServer } from "msw/node";
|
|
5
5
|
|
|
6
6
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -54,8 +54,8 @@ describe("Function: getUserCompletedGames", () => {
|
|
|
54
54
|
];
|
|
55
55
|
|
|
56
56
|
server.use(
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
http.get(`${apiBaseUrl}/API_GetUserCompletedGames.php`, () =>
|
|
58
|
+
HttpResponse.json(mockResponse)
|
|
59
59
|
)
|
|
60
60
|
);
|
|
61
61
|
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
|
+
import { setupServer } from "msw/node";
|
|
3
|
+
|
|
4
|
+
import { apiBaseUrl } from "../utils/internal";
|
|
5
|
+
import { buildAuthorization } from "../utils/public";
|
|
6
|
+
import { getUserCompletionProgress } from "./getUserCompletionProgress";
|
|
7
|
+
import type { GetUserCompletionProgressResponse } from "./models";
|
|
8
|
+
|
|
9
|
+
const server = setupServer();
|
|
10
|
+
|
|
11
|
+
describe("Function: getUserCompletionProgress", () => {
|
|
12
|
+
// MSW Setup
|
|
13
|
+
beforeAll(() => server.listen());
|
|
14
|
+
afterEach(() => server.resetHandlers());
|
|
15
|
+
afterAll(() => server.close());
|
|
16
|
+
|
|
17
|
+
it("is defined #sanity", () => {
|
|
18
|
+
// ASSERT
|
|
19
|
+
expect(getUserCompletionProgress).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("retrieves completion progress by username", async () => {
|
|
23
|
+
// ARRANGE
|
|
24
|
+
const authorization = buildAuthorization({
|
|
25
|
+
userName: "mockUserName",
|
|
26
|
+
webApiKey: "mockWebApiKey"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const mockResponse: GetUserCompletionProgressResponse = {
|
|
30
|
+
Count: 1,
|
|
31
|
+
Total: 1,
|
|
32
|
+
Results: [
|
|
33
|
+
{
|
|
34
|
+
GameID: 680,
|
|
35
|
+
Title: "Game & Watch Gallery",
|
|
36
|
+
ImageIcon: "/Images/042952.png",
|
|
37
|
+
ConsoleID: 4,
|
|
38
|
+
ConsoleName: "Game Boy",
|
|
39
|
+
MaxPossible: 27,
|
|
40
|
+
NumAwarded: 8,
|
|
41
|
+
NumAwardedHardcore: 8,
|
|
42
|
+
MostRecentAwardedDate: "2022-07-26T23:56:15+00:00",
|
|
43
|
+
HighestAwardKind: null,
|
|
44
|
+
HighestAwardDate: null
|
|
45
|
+
}
|
|
46
|
+
]
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
server.use(
|
|
50
|
+
http.get(`${apiBaseUrl}/API_GetUserCompletionProgress.php`, () =>
|
|
51
|
+
HttpResponse.json(mockResponse)
|
|
52
|
+
)
|
|
53
|
+
);
|
|
54
|
+
|
|
55
|
+
// ACT
|
|
56
|
+
const response = await getUserCompletionProgress(authorization, {
|
|
57
|
+
userName: "xelnia"
|
|
58
|
+
});
|
|
59
|
+
|
|
60
|
+
// ASSERT
|
|
61
|
+
expect(response).toEqual({
|
|
62
|
+
count: 1,
|
|
63
|
+
total: 1,
|
|
64
|
+
results: [
|
|
65
|
+
{
|
|
66
|
+
gameId: 680,
|
|
67
|
+
title: "Game & Watch Gallery",
|
|
68
|
+
imageIcon: "/Images/042952.png",
|
|
69
|
+
consoleId: 4,
|
|
70
|
+
consoleName: "Game Boy",
|
|
71
|
+
maxPossible: 27,
|
|
72
|
+
numAwarded: 8,
|
|
73
|
+
numAwardedHardcore: 8,
|
|
74
|
+
mostRecentAwardedDate: "2022-07-26T23:56:15+00:00",
|
|
75
|
+
highestAwardKind: null,
|
|
76
|
+
highestAwardDate: null
|
|
77
|
+
}
|
|
78
|
+
]
|
|
79
|
+
});
|
|
80
|
+
});
|
|
81
|
+
});
|
|
@@ -0,0 +1,83 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiBaseUrl,
|
|
3
|
+
buildRequestUrl,
|
|
4
|
+
call,
|
|
5
|
+
serializeProperties
|
|
6
|
+
} from "../utils/internal";
|
|
7
|
+
import type { AuthObject } from "../utils/public";
|
|
8
|
+
import type {
|
|
9
|
+
GetUserCompletionProgressResponse,
|
|
10
|
+
UserCompletionProgress
|
|
11
|
+
} from "./models";
|
|
12
|
+
|
|
13
|
+
/**
|
|
14
|
+
* A call to this function will retrieve a given user's completion
|
|
15
|
+
* progress, targeted by their username.
|
|
16
|
+
*
|
|
17
|
+
* @param authorization An object containing your userName and webApiKey.
|
|
18
|
+
* This can be constructed with `buildAuthorization()`.
|
|
19
|
+
*
|
|
20
|
+
* @param payload.userName The user for which to retrieve the progress for.
|
|
21
|
+
*
|
|
22
|
+
* @param payload.offset Defaults to 0. The number of entries to skip.
|
|
23
|
+
*
|
|
24
|
+
* @param payload.count Defaults to 100, has a max of 500.
|
|
25
|
+
*
|
|
26
|
+
* @example
|
|
27
|
+
* ```
|
|
28
|
+
* const userCompletionProgress = await getUserCompletionProgress(
|
|
29
|
+
* authorization,
|
|
30
|
+
* { userName: "xelnia" }
|
|
31
|
+
* );
|
|
32
|
+
* ```
|
|
33
|
+
*
|
|
34
|
+
* @returns
|
|
35
|
+
* ```
|
|
36
|
+
* {
|
|
37
|
+
* "count": 100,
|
|
38
|
+
* "total": 752,
|
|
39
|
+
* "results": [
|
|
40
|
+
* {
|
|
41
|
+
gameId: 11406,
|
|
42
|
+
title: 'Mortal Kombat 4',
|
|
43
|
+
imageIcon: '/Images/042133.png',
|
|
44
|
+
consoleId: 12,
|
|
45
|
+
consoleName: 'PlayStation',
|
|
46
|
+
maxPossible: 131,
|
|
47
|
+
numAwarded: 131,
|
|
48
|
+
numAwardedHardcore: 131,
|
|
49
|
+
mostRecentAwardedDate: '2022-08-07T18:24:44+00:00',
|
|
50
|
+
highestAwardKind: 'mastered',
|
|
51
|
+
highestAwardDate: '2022-08-07T18:24:44+00:00'
|
|
52
|
+
* }
|
|
53
|
+
* ]
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
56
|
+
*/
|
|
57
|
+
export const getUserCompletionProgress = async (
|
|
58
|
+
authorization: AuthObject,
|
|
59
|
+
payload: { userName: string; offset?: number; count?: number }
|
|
60
|
+
): Promise<UserCompletionProgress> => {
|
|
61
|
+
const { userName, offset, count } = payload;
|
|
62
|
+
|
|
63
|
+
const params: Record<string, string | number> = {
|
|
64
|
+
u: userName
|
|
65
|
+
};
|
|
66
|
+
if (offset) {
|
|
67
|
+
params["o"] = offset;
|
|
68
|
+
}
|
|
69
|
+
if (count) {
|
|
70
|
+
params["c"] = count;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
const url = buildRequestUrl(
|
|
74
|
+
apiBaseUrl,
|
|
75
|
+
"/API_GetUserCompletionProgress.php",
|
|
76
|
+
authorization,
|
|
77
|
+
params
|
|
78
|
+
);
|
|
79
|
+
|
|
80
|
+
const rawResponse = await call<GetUserCompletionProgressResponse>({ url });
|
|
81
|
+
|
|
82
|
+
return serializeProperties(rawResponse);
|
|
83
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -36,8 +36,8 @@ describe("Function: getUserGameRankAndScore", () => {
|
|
|
36
36
|
];
|
|
37
37
|
|
|
38
38
|
server.use(
|
|
39
|
-
|
|
40
|
-
|
|
39
|
+
http.get(`${apiBaseUrl}/API_GetUserGameRankAndScore.php`, () =>
|
|
40
|
+
HttpResponse.json(mockResponse)
|
|
41
41
|
)
|
|
42
42
|
);
|
|
43
43
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -32,8 +32,8 @@ describe("Function: getUserPoints", () => {
|
|
|
32
32
|
};
|
|
33
33
|
|
|
34
34
|
server.use(
|
|
35
|
-
|
|
36
|
-
|
|
35
|
+
http.get(`${apiBaseUrl}/API_GetUserPoints.php`, () =>
|
|
36
|
+
HttpResponse.json(mockResponse)
|
|
37
37
|
)
|
|
38
38
|
);
|
|
39
39
|
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
|
+
import { setupServer } from "msw/node";
|
|
3
|
+
|
|
4
|
+
import { apiBaseUrl } from "../utils/internal";
|
|
5
|
+
import { buildAuthorization } from "../utils/public";
|
|
6
|
+
import { getUserProfile } from "./getUserProfile";
|
|
7
|
+
import type { GetUserProfileResponse } from "./models";
|
|
8
|
+
|
|
9
|
+
const server = setupServer();
|
|
10
|
+
|
|
11
|
+
describe("Function: getUserProfile", () => {
|
|
12
|
+
// MSW Setup
|
|
13
|
+
beforeAll(() => server.listen());
|
|
14
|
+
afterEach(() => server.resetHandlers());
|
|
15
|
+
afterAll(() => server.close());
|
|
16
|
+
|
|
17
|
+
it("is defined #sanity", () => {
|
|
18
|
+
// ASSERT
|
|
19
|
+
expect(getUserProfile).toBeDefined();
|
|
20
|
+
});
|
|
21
|
+
|
|
22
|
+
it("given a username, retrieves minimal user profile information about the user", async () => {
|
|
23
|
+
// ARRANGE
|
|
24
|
+
const authorization = buildAuthorization({
|
|
25
|
+
userName: "mockUserName",
|
|
26
|
+
webApiKey: "mockWebApiKey"
|
|
27
|
+
});
|
|
28
|
+
|
|
29
|
+
const mockResponse: GetUserProfileResponse = {
|
|
30
|
+
User: "MaxMilyin",
|
|
31
|
+
UserPic: "/UserPic/MaxMilyin.png",
|
|
32
|
+
MemberSince: "2016-01-02 00:43:04",
|
|
33
|
+
RichPresenceMsg:
|
|
34
|
+
"Playing ~Hack~ 11th Annual Vanilla Level Design Contest, The",
|
|
35
|
+
LastGameID: 19_504,
|
|
36
|
+
ContribCount: 0,
|
|
37
|
+
ContribYield: 0,
|
|
38
|
+
TotalPoints: 399_597,
|
|
39
|
+
TotalSoftcorePoints: 0,
|
|
40
|
+
TotalTruePoints: 1_599_212,
|
|
41
|
+
Permissions: 1,
|
|
42
|
+
Untracked: 0,
|
|
43
|
+
ID: 16_446,
|
|
44
|
+
UserWallActive: 1,
|
|
45
|
+
Motto: "Join me on Twitch! GameSquadSquad for live RA"
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
server.use(
|
|
49
|
+
http.get(`${apiBaseUrl}/API_GetUserProfile.php`, () =>
|
|
50
|
+
HttpResponse.json(mockResponse)
|
|
51
|
+
)
|
|
52
|
+
);
|
|
53
|
+
|
|
54
|
+
// ACT
|
|
55
|
+
const response = await getUserProfile(authorization, {
|
|
56
|
+
userName: "WCopeland"
|
|
57
|
+
});
|
|
58
|
+
|
|
59
|
+
// ASSERT
|
|
60
|
+
expect(response).toEqual({
|
|
61
|
+
user: "MaxMilyin",
|
|
62
|
+
userPic: "/UserPic/MaxMilyin.png",
|
|
63
|
+
memberSince: "2016-01-02 00:43:04",
|
|
64
|
+
richPresenceMsg:
|
|
65
|
+
"Playing ~Hack~ 11th Annual Vanilla Level Design Contest, The",
|
|
66
|
+
lastGameId: 19_504,
|
|
67
|
+
contribCount: 0,
|
|
68
|
+
contribYield: 0,
|
|
69
|
+
totalPoints: 399_597,
|
|
70
|
+
totalSoftcorePoints: 0,
|
|
71
|
+
totalTruePoints: 1_599_212,
|
|
72
|
+
permissions: 1,
|
|
73
|
+
untracked: false,
|
|
74
|
+
id: 16_446,
|
|
75
|
+
userWallActive: true,
|
|
76
|
+
motto: "Join me on Twitch! GameSquadSquad for live RA"
|
|
77
|
+
});
|
|
78
|
+
});
|
|
79
|
+
});
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import {
|
|
2
|
+
apiBaseUrl,
|
|
3
|
+
buildRequestUrl,
|
|
4
|
+
call,
|
|
5
|
+
serializeProperties
|
|
6
|
+
} from "../utils/internal";
|
|
7
|
+
import type { AuthObject } from "../utils/public";
|
|
8
|
+
import type { GetUserProfileResponse, UserProfile } from "./models";
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* A call to this function will retrieve summary information about
|
|
12
|
+
* a given user, targeted by username.
|
|
13
|
+
*
|
|
14
|
+
* @param authorization An object containing your userName and webApiKey.
|
|
15
|
+
* This can be constructed with `buildAuthorization()`.
|
|
16
|
+
*
|
|
17
|
+
* @param payload.userName The user for which to retrieve the summary for.
|
|
18
|
+
*
|
|
19
|
+
* @example
|
|
20
|
+
* ```
|
|
21
|
+
* const userSummary = await getUserProfile(
|
|
22
|
+
* authorization,
|
|
23
|
+
* { userName: "xelnia" }
|
|
24
|
+
* );
|
|
25
|
+
* ```
|
|
26
|
+
*
|
|
27
|
+
* @returns An object containing profile summary metadata about a target user.
|
|
28
|
+
*/
|
|
29
|
+
export const getUserProfile = async (
|
|
30
|
+
authorization: AuthObject,
|
|
31
|
+
payload: {
|
|
32
|
+
userName: string;
|
|
33
|
+
}
|
|
34
|
+
): Promise<UserProfile> => {
|
|
35
|
+
const { userName } = payload;
|
|
36
|
+
|
|
37
|
+
const url = buildRequestUrl(
|
|
38
|
+
apiBaseUrl,
|
|
39
|
+
"/API_GetUserProfile.php",
|
|
40
|
+
authorization,
|
|
41
|
+
{ u: userName }
|
|
42
|
+
);
|
|
43
|
+
|
|
44
|
+
const rawResponse = await call<GetUserProfileResponse>({ url });
|
|
45
|
+
|
|
46
|
+
return serializeProperties(rawResponse, {
|
|
47
|
+
shouldCastToNumbers: [
|
|
48
|
+
"TotalPoints",
|
|
49
|
+
"TotalSoftcorePoints",
|
|
50
|
+
"TotalTruePoints",
|
|
51
|
+
"Permissions"
|
|
52
|
+
],
|
|
53
|
+
shouldMapToBooleans: ["Untracked", "UserWallActive"]
|
|
54
|
+
});
|
|
55
|
+
};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -46,8 +46,8 @@ describe("Function: getUserProgress", () => {
|
|
|
46
46
|
};
|
|
47
47
|
|
|
48
48
|
server.use(
|
|
49
|
-
|
|
50
|
-
|
|
49
|
+
http.get(`${apiBaseUrl}/API_GetUserProgress.php`, () =>
|
|
50
|
+
HttpResponse.json(mockResponse)
|
|
51
51
|
)
|
|
52
52
|
);
|
|
53
53
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -47,9 +47,8 @@ describe("Function: getUserRecentAchievements", () => {
|
|
|
47
47
|
];
|
|
48
48
|
|
|
49
49
|
server.use(
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
(_, res, ctx) => res(ctx.json(mockResponse))
|
|
50
|
+
http.get(`${apiBaseUrl}/API_GetUserRecentAchievements.php`, () =>
|
|
51
|
+
HttpResponse.json(mockResponse)
|
|
53
52
|
)
|
|
54
53
|
);
|
|
55
54
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { http, HttpResponse } from "msw";
|
|
2
2
|
import { setupServer } from "msw/node";
|
|
3
3
|
|
|
4
4
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -45,9 +45,8 @@ describe("Function: getUserRecentlyPlayedGames", () => {
|
|
|
45
45
|
];
|
|
46
46
|
|
|
47
47
|
server.use(
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
(_, res, ctx) => res(ctx.json(mockResponse))
|
|
48
|
+
http.get(`${apiBaseUrl}/API_GetUserRecentlyPlayedGames.php`, () =>
|
|
49
|
+
HttpResponse.json(mockResponse)
|
|
51
50
|
)
|
|
52
51
|
);
|
|
53
52
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
/* eslint-disable sonarjs/no-duplicate-string */
|
|
2
2
|
|
|
3
|
-
import {
|
|
3
|
+
import { http, HttpResponse } from "msw";
|
|
4
4
|
import { setupServer } from "msw/node";
|
|
5
5
|
|
|
6
6
|
import { apiBaseUrl } from "../utils/internal";
|
|
@@ -31,8 +31,8 @@ describe("Function: getUserSummary", () => {
|
|
|
31
31
|
const mockResponse = mockGetUserSummaryResponse;
|
|
32
32
|
|
|
33
33
|
server.use(
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
http.get(`${apiBaseUrl}/API_GetUserSummary.php`, () =>
|
|
35
|
+
HttpResponse.json(mockResponse)
|
|
36
36
|
)
|
|
37
37
|
);
|
|
38
38
|
|
|
@@ -55,8 +55,8 @@ describe("Function: getUserSummary", () => {
|
|
|
55
55
|
const mockResponse = "<html><body>the api is down</body></html>";
|
|
56
56
|
|
|
57
57
|
server.use(
|
|
58
|
-
|
|
59
|
-
|
|
58
|
+
http.get(`${apiBaseUrl}/API_GetUserSummary.php`, () =>
|
|
59
|
+
HttpResponse.json(mockResponse, { status: 503 })
|
|
60
60
|
)
|
|
61
61
|
);
|
|
62
62
|
|
|
@@ -17,7 +17,7 @@ import type { GetUserSummaryResponse, UserSummary } from "./models";
|
|
|
17
17
|
* @param payload.userName The user for which to retrieve the summary for.
|
|
18
18
|
*
|
|
19
19
|
* @param payload.recentGamesCount Optional. The number of recent games to return.
|
|
20
|
-
* This defaults to
|
|
20
|
+
* This defaults to 0.
|
|
21
21
|
*
|
|
22
22
|
* @param payload.recentAchievementsCount Optional. The number of recent achievements
|
|
23
23
|
* to return. This defaults to 5.
|
|
@@ -92,5 +92,3 @@ export const getUserSummary = async (
|
|
|
92
92
|
]
|
|
93
93
|
});
|
|
94
94
|
};
|
|
95
|
-
|
|
96
|
-
// TODO: add test for this
|
package/src/user/index.ts
CHANGED
|
@@ -4,8 +4,10 @@ export * from "./getGameInfoAndUserProgress";
|
|
|
4
4
|
export * from "./getUserAwards";
|
|
5
5
|
export * from "./getUserClaims";
|
|
6
6
|
export * from "./getUserCompletedGames";
|
|
7
|
+
export * from "./getUserCompletionProgress";
|
|
7
8
|
export * from "./getUserGameRankAndScore";
|
|
8
9
|
export * from "./getUserPoints";
|
|
10
|
+
export * from "./getUserProfile";
|
|
9
11
|
export * from "./getUserProgress";
|
|
10
12
|
export * from "./getUserRecentAchievements";
|
|
11
13
|
export * from "./getUserRecentlyPlayedGames";
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export type AwardType =
|
|
2
|
-
| "Mastery/Completion"
|
|
3
|
-
| "Achievement Unlocks Yield"
|
|
4
2
|
| "Achievement Points Yield"
|
|
5
|
-
| "
|
|
3
|
+
| "Achievement Unlocks Yield"
|
|
6
4
|
| "Certified Legend"
|
|
7
|
-
| "
|
|
5
|
+
| "Game Beaten"
|
|
6
|
+
| "Invalid or deprecated award type"
|
|
7
|
+
| "Mastery/Completion"
|
|
8
|
+
| "Patreon Supporter";
|