@retroachievements/api 1.5.3 → 2.1.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.
Files changed (133) hide show
  1. package/README.md +3 -2
  2. package/dist/achievement/getAchievementUnlocks.d.ts +1 -1
  3. package/dist/api.cjs +1 -1
  4. package/dist/api.cjs.map +1 -1
  5. package/dist/api.modern.js +1 -1
  6. package/dist/api.modern.js.map +1 -1
  7. package/dist/api.module.js +1 -1
  8. package/dist/api.module.js.map +1 -1
  9. package/dist/api.umd.js +1 -1
  10. package/dist/api.umd.js.map +1 -1
  11. package/dist/console/getConsoleIds.d.ts +15 -4
  12. package/dist/console/getGameList.d.ts +1 -1
  13. package/dist/console/models/fetched-system.model.d.ts +7 -0
  14. package/dist/console/models/get-console-ids-response.model.d.ts +2 -0
  15. package/dist/console/models/index.d.ts +1 -1
  16. package/dist/feed/getAchievementOfTheWeek.d.ts +1 -1
  17. package/dist/feed/getActiveClaims.d.ts +1 -1
  18. package/dist/feed/getRecentGameAwards.d.ts +50 -0
  19. package/dist/feed/getRecentGameAwards.test.d.ts +1 -0
  20. package/dist/feed/getTopTenUsers.d.ts +3 -3
  21. package/dist/feed/index.d.ts +1 -0
  22. package/dist/feed/models/get-recent-game-awards-response.model.d.ts +14 -0
  23. package/dist/feed/models/index.d.ts +2 -0
  24. package/dist/feed/models/recent-game-awards.model.d.ts +14 -0
  25. package/dist/feed/models/top-ten-users-entity.model.d.ts +1 -1
  26. package/dist/game/getAchievementCount.d.ts +1 -1
  27. package/dist/game/getAchievementDistribution.d.ts +1 -1
  28. package/dist/game/getGame.d.ts +1 -1
  29. package/dist/game/getGameExtended.d.ts +1 -1
  30. package/dist/game/getGameRankAndScore.d.ts +1 -1
  31. package/dist/game/getGameRating.d.ts +1 -1
  32. package/dist/ticket/getTicketData.d.ts +9 -9
  33. package/dist/user/getAchievementsEarnedBetween.d.ts +4 -4
  34. package/dist/user/getAchievementsEarnedOnDay.d.ts +4 -4
  35. package/dist/user/getGameInfoAndUserProgress.d.ts +9 -5
  36. package/dist/user/getUserAwards.d.ts +4 -4
  37. package/dist/user/getUserClaims.d.ts +4 -4
  38. package/dist/user/getUserCompletedGames.d.ts +4 -4
  39. package/dist/user/getUserCompletionProgress.d.ts +4 -4
  40. package/dist/user/getUserGameRankAndScore.d.ts +4 -4
  41. package/dist/user/getUserPoints.d.ts +4 -4
  42. package/dist/user/getUserProfile.d.ts +4 -4
  43. package/dist/user/getUserProgress.d.ts +4 -4
  44. package/dist/user/getUserRecentAchievements.d.ts +4 -4
  45. package/dist/user/getUserRecentlyPlayedGames.d.ts +4 -4
  46. package/dist/user/getUserSummary.d.ts +4 -4
  47. package/dist/user/models/game-info-and-user-progress.model.d.ts +3 -0
  48. package/dist/user/models/get-game-info-and-user-progress-response.model.d.ts +3 -0
  49. package/dist/user/models/get-user-completion-progress-response.model.d.ts +2 -1
  50. package/dist/user/models/user-completion-progress-entity.model.d.ts +2 -1
  51. package/dist/utils/public/buildAuthorization.d.ts +1 -1
  52. package/dist/utils/public/models/auth-object.model.d.ts +2 -2
  53. package/dist/utils/public/models/award-kind.model.d.ts +1 -0
  54. package/dist/utils/public/models/index.d.ts +1 -0
  55. package/package.json +6 -12
  56. package/src/__playground.ts +4 -4
  57. package/src/achievement/getAchievementUnlocks.test.ts +1 -1
  58. package/src/achievement/getAchievementUnlocks.ts +1 -1
  59. package/src/console/getConsoleIds.test.ts +15 -3
  60. package/src/console/getConsoleIds.ts +28 -6
  61. package/src/console/getGameList.test.ts +1 -1
  62. package/src/console/getGameList.ts +1 -1
  63. package/src/console/models/fetched-system.model.ts +7 -0
  64. package/src/console/models/get-console-ids-response.model.ts +2 -0
  65. package/src/console/models/index.ts +1 -1
  66. package/src/feed/getAchievementOfTheWeek.test.ts +2 -2
  67. package/src/feed/getAchievementOfTheWeek.ts +1 -1
  68. package/src/feed/getActiveClaims.test.ts +1 -1
  69. package/src/feed/getActiveClaims.ts +1 -1
  70. package/src/feed/getClaims.test.ts +1 -1
  71. package/src/feed/getRecentGameAwards.test.ts +73 -0
  72. package/src/feed/getRecentGameAwards.ts +85 -0
  73. package/src/feed/getTopTenUsers.test.ts +11 -11
  74. package/src/feed/getTopTenUsers.ts +4 -4
  75. package/src/feed/index.ts +1 -0
  76. package/src/feed/models/get-recent-game-awards-response.model.ts +15 -0
  77. package/src/feed/models/index.ts +2 -0
  78. package/src/feed/models/recent-game-awards.model.ts +15 -0
  79. package/src/feed/models/top-ten-users-entity.model.ts +1 -1
  80. package/src/game/getAchievementCount.test.ts +1 -1
  81. package/src/game/getAchievementCount.ts +1 -1
  82. package/src/game/getAchievementDistribution.test.ts +4 -4
  83. package/src/game/getAchievementDistribution.ts +1 -1
  84. package/src/game/getGame.test.ts +1 -1
  85. package/src/game/getGame.ts +1 -1
  86. package/src/game/getGameExtended.test.ts +1 -1
  87. package/src/game/getGameExtended.ts +1 -1
  88. package/src/game/getGameRankAndScore.test.ts +1 -1
  89. package/src/game/getGameRankAndScore.ts +1 -1
  90. package/src/game/getGameRating.test.ts +1 -1
  91. package/src/game/getGameRating.ts +1 -1
  92. package/src/ticket/getTicketData.test.ts +7 -7
  93. package/src/ticket/getTicketData.ts +13 -13
  94. package/src/user/getAchievementsEarnedBetween.test.ts +2 -2
  95. package/src/user/getAchievementsEarnedBetween.ts +6 -6
  96. package/src/user/getAchievementsEarnedOnDay.test.ts +2 -2
  97. package/src/user/getAchievementsEarnedOnDay.ts +6 -6
  98. package/src/user/getGameInfoAndUserProgress.test.ts +3 -3
  99. package/src/user/getGameInfoAndUserProgress.ts +22 -11
  100. package/src/user/getUserAwards.test.ts +2 -2
  101. package/src/user/getUserAwards.ts +6 -6
  102. package/src/user/getUserClaims.test.ts +2 -2
  103. package/src/user/getUserClaims.ts +6 -6
  104. package/src/user/getUserCompletedGames.test.ts +2 -2
  105. package/src/user/getUserCompletedGames.ts +6 -6
  106. package/src/user/getUserCompletionProgress.test.ts +2 -2
  107. package/src/user/getUserCompletionProgress.ts +6 -6
  108. package/src/user/getUserGameRankAndScore.test.ts +2 -2
  109. package/src/user/getUserGameRankAndScore.ts +6 -6
  110. package/src/user/getUserPoints.test.ts +2 -2
  111. package/src/user/getUserPoints.ts +6 -6
  112. package/src/user/getUserProfile.test.ts +2 -2
  113. package/src/user/getUserProfile.ts +6 -6
  114. package/src/user/getUserProgress.test.ts +2 -2
  115. package/src/user/getUserProgress.ts +6 -6
  116. package/src/user/getUserRecentAchievements.test.ts +2 -2
  117. package/src/user/getUserRecentAchievements.ts +6 -6
  118. package/src/user/getUserRecentlyPlayedGames.test.ts +2 -2
  119. package/src/user/getUserRecentlyPlayedGames.ts +6 -6
  120. package/src/user/getUserSummary.test.ts +4 -4
  121. package/src/user/getUserSummary.ts +6 -6
  122. package/src/user/models/game-info-and-user-progress.model.ts +4 -0
  123. package/src/user/models/get-game-info-and-user-progress-response.model.ts +4 -0
  124. package/src/user/models/get-user-completion-progress-response.model.ts +3 -6
  125. package/src/user/models/user-completion-progress-entity.model.ts +3 -6
  126. package/src/utils/internal/buildRequestUrl.test.ts +2 -2
  127. package/src/utils/internal/buildRequestUrl.ts +1 -1
  128. package/src/utils/public/buildAuthorization.test.ts +3 -3
  129. package/src/utils/public/buildAuthorization.ts +4 -4
  130. package/src/utils/public/models/auth-object.model.ts +2 -2
  131. package/src/utils/public/models/award-kind.model.ts +5 -0
  132. package/src/utils/public/models/index.ts +1 -0
  133. package/src/console/models/console-id.model.ts +0 -5
@@ -11,16 +11,16 @@ import type { GetUserAwardsResponse, UserAwards } from "./models";
11
11
  * A call to this function will retrieve metadata about the target user's
12
12
  * site awards, via their username.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
- * @param payload.userName The user for which to retrieve the site awards for.
17
+ * @param payload.username The user for which to retrieve the site awards for.
18
18
  *
19
19
  * @example
20
20
  * ```
21
21
  * const userAwards = await getUserAwards(
22
22
  * authorization,
23
- * { userName: "xelnia" }
23
+ * { username: "xelnia" }
24
24
  * )
25
25
  * ```
26
26
  *
@@ -53,11 +53,11 @@ import type { GetUserAwardsResponse, UserAwards } from "./models";
53
53
  */
54
54
  export const getUserAwards = async (
55
55
  authorization: AuthObject,
56
- payload: { userName: string }
56
+ payload: { username: string }
57
57
  ): Promise<UserAwards> => {
58
- const { userName } = payload;
58
+ const { username } = payload;
59
59
 
60
- const queryParams: Record<string, string> = { u: userName };
60
+ const queryParams: Record<string, string> = { u: username };
61
61
 
62
62
  const url = buildRequestUrl(
63
63
  apiBaseUrl,
@@ -23,7 +23,7 @@ describe("Function: getUserClaims", () => {
23
23
 
24
24
  it("given a username, retrieves a list of achievement set claims for the user", async () => {
25
25
  const authorization = buildAuthorization({
26
- userName: "mockUserName",
26
+ username: "mockUserName",
27
27
  webApiKey: "mockWebApiKey",
28
28
  });
29
29
 
@@ -55,7 +55,7 @@ describe("Function: getUserClaims", () => {
55
55
 
56
56
  // ACT
57
57
  const response = await getUserClaims(authorization, {
58
- userName: "Jamiras",
58
+ username: "Jamiras",
59
59
  });
60
60
 
61
61
  // ASSERT
@@ -12,17 +12,17 @@ import type { GetUserClaimsResponse, UserClaims } from "./models";
12
12
  * achievement set claims made over the lifetime of a given
13
13
  * user, targeted by their username.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
- * @param payload.userName The user for which to retrieve the historical
18
+ * @param payload.username The user for which to retrieve the historical
19
19
  * achievement set claims list for.
20
20
  *
21
21
  * @example
22
22
  * ```
23
23
  * const userClaims = await getUserClaims(
24
24
  * authorization,
25
- * { userName: "Jamiras" }
25
+ * { username: "Jamiras" }
26
26
  * );
27
27
  * ```
28
28
  *
@@ -31,15 +31,15 @@ import type { GetUserClaimsResponse, UserClaims } from "./models";
31
31
  */
32
32
  export const getUserClaims = async (
33
33
  authorization: AuthObject,
34
- payload: { userName: string }
34
+ payload: { username: string }
35
35
  ): Promise<UserClaims> => {
36
- const { userName } = payload;
36
+ const { username } = payload;
37
37
 
38
38
  const url = buildRequestUrl(
39
39
  apiBaseUrl,
40
40
  "/API_GetUserClaims.php",
41
41
  authorization,
42
- { u: userName }
42
+ { u: username }
43
43
  );
44
44
 
45
45
  const rawResponse = await call<GetUserClaimsResponse>({ url });
@@ -24,7 +24,7 @@ describe("Function: getUserCompletedGames", () => {
24
24
  it("given a username, returns completion metadata", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -61,7 +61,7 @@ describe("Function: getUserCompletedGames", () => {
61
61
 
62
62
  // ACT
63
63
  const response = await getUserCompletedGames(authorization, {
64
- userName: "xelnia",
64
+ username: "xelnia",
65
65
  });
66
66
 
67
67
  // ASSERT
@@ -17,17 +17,17 @@ import type {
17
17
  * one for the hardcore completion. These are designated by
18
18
  * the `hardcoreMode` property on each completion object.
19
19
  *
20
- * @param authorization An object containing your userName and webApiKey.
20
+ * @param authorization An object containing your username and webApiKey.
21
21
  * This can be constructed with `buildAuthorization()`.
22
22
  *
23
- * @param payload.userName The user for which to retrieve the
23
+ * @param payload.username The user for which to retrieve the
24
24
  * completion metadata for.
25
25
  *
26
26
  * @example
27
27
  * ```
28
28
  * const userCompletedGames = await getUserCompletedGames(
29
29
  * authorization,
30
- * { userName: "xelnia" }
30
+ * { username: "xelnia" }
31
31
  * );
32
32
  * ```
33
33
  *
@@ -63,15 +63,15 @@ import type {
63
63
  */
64
64
  export const getUserCompletedGames = async (
65
65
  authorization: AuthObject,
66
- payload: { userName: string }
66
+ payload: { username: string }
67
67
  ): Promise<UserCompletedGames> => {
68
- const { userName } = payload;
68
+ const { username } = payload;
69
69
 
70
70
  const url = buildRequestUrl(
71
71
  apiBaseUrl,
72
72
  "/API_GetUserCompletedGames.php",
73
73
  authorization,
74
- { u: userName }
74
+ { u: username }
75
75
  );
76
76
 
77
77
  const rawResponse = await call<GetUserCompletedGamesResponse>({ url });
@@ -22,7 +22,7 @@ describe("Function: getUserCompletionProgress", () => {
22
22
  it("retrieves completion progress by username", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -54,7 +54,7 @@ describe("Function: getUserCompletionProgress", () => {
54
54
 
55
55
  // ACT
56
56
  const response = await getUserCompletionProgress(authorization, {
57
- userName: "xelnia",
57
+ username: "xelnia",
58
58
  });
59
59
 
60
60
  // ASSERT
@@ -14,10 +14,10 @@ import type {
14
14
  * A call to this function will retrieve a given user's completion
15
15
  * progress, targeted by their username.
16
16
  *
17
- * @param authorization An object containing your userName and webApiKey.
17
+ * @param authorization An object containing your username and webApiKey.
18
18
  * This can be constructed with `buildAuthorization()`.
19
19
  *
20
- * @param payload.userName The user for which to retrieve the progress for.
20
+ * @param payload.username The user for which to retrieve the progress for.
21
21
  *
22
22
  * @param payload.offset Defaults to 0. The number of entries to skip.
23
23
  *
@@ -27,7 +27,7 @@ import type {
27
27
  * ```
28
28
  * const userCompletionProgress = await getUserCompletionProgress(
29
29
  * authorization,
30
- * { userName: "xelnia" }
30
+ * { username: "xelnia" }
31
31
  * );
32
32
  * ```
33
33
  *
@@ -56,12 +56,12 @@ import type {
56
56
  */
57
57
  export const getUserCompletionProgress = async (
58
58
  authorization: AuthObject,
59
- payload: { userName: string; offset?: number; count?: number }
59
+ payload: { username: string; offset?: number; count?: number }
60
60
  ): Promise<UserCompletionProgress> => {
61
- const { userName, offset, count } = payload;
61
+ const { username, offset, count } = payload;
62
62
 
63
63
  const params: Record<string, string | number> = {
64
- u: userName,
64
+ u: username,
65
65
  };
66
66
  if (offset) {
67
67
  params["o"] = offset;
@@ -22,7 +22,7 @@ describe("Function: getUserGameRankAndScore", () => {
22
22
  it("given a game ID and a user name, retrieves metadata about how that user ranks on the given game", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -43,7 +43,7 @@ describe("Function: getUserGameRankAndScore", () => {
43
43
 
44
44
  // ACT
45
45
  const response = await getUserGameRankAndScore(authorization, {
46
- userName: "xelnia",
46
+ username: "xelnia",
47
47
  gameId: 14_402,
48
48
  });
49
49
 
@@ -16,7 +16,7 @@ import type {
16
16
  * how a particular user has performed/ranked on a particular
17
17
  * game, targeted by game ID.
18
18
  *
19
- * @param authorization An object containing your userName and webApiKey.
19
+ * @param authorization An object containing your username and webApiKey.
20
20
  * This can be constructed with `buildAuthorization()`.
21
21
  *
22
22
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -24,14 +24,14 @@ import type {
24
24
  * URL is https://retroachievements.org/game/14402. We can see from the
25
25
  * URL that the game ID is "14402".
26
26
  *
27
- * @param payload.userName The user for which to retrieve the
27
+ * @param payload.username The user for which to retrieve the
28
28
  * game ranking metadata for.
29
29
  *
30
30
  * @example
31
31
  * ```
32
32
  * const userGameRankAndScore = await getUserGameRankAndScore(
33
33
  * authorization,
34
- * { gameId: 14402, userName: "xelnia" }
34
+ * { gameId: 14402, username: "xelnia" }
35
35
  * );
36
36
  * ```
37
37
  *
@@ -51,15 +51,15 @@ import type {
51
51
  */
52
52
  export const getUserGameRankAndScore = async (
53
53
  authorization: AuthObject,
54
- payload: { gameId: ID; userName: string }
54
+ payload: { gameId: ID; username: string }
55
55
  ): Promise<UserGameRankAndScore> => {
56
- const { gameId, userName } = payload;
56
+ const { gameId, username } = payload;
57
57
 
58
58
  const url = buildRequestUrl(
59
59
  apiBaseUrl,
60
60
  "/API_GetUserGameRankAndScore.php",
61
61
  authorization,
62
- { g: gameId, u: userName }
62
+ { g: gameId, u: username }
63
63
  );
64
64
 
65
65
  const rawResponse = await call<GetUserGameRankAndScoreResponse>({ url });
@@ -22,7 +22,7 @@ describe("Function: getUserPoints", () => {
22
22
  it("given a username, retrieves the point values associated with the user", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -38,7 +38,7 @@ describe("Function: getUserPoints", () => {
38
38
  );
39
39
 
40
40
  // ACT
41
- const response = await getUserPoints(authorization, { userName: "xelnia" });
41
+ const response = await getUserPoints(authorization, { username: "xelnia" });
42
42
 
43
43
  // ASSERT
44
44
  expect(response).toEqual({
@@ -11,16 +11,16 @@ import type { GetUserPointsResponse, UserPoints } from "./models";
11
11
  * A call to this function will retrieve a given user's hardcore
12
12
  * and softcore points.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
- * @param payload.userName The user for which to retrieve the point totals for.
17
+ * @param payload.username The user for which to retrieve the point totals for.
18
18
  *
19
19
  * @example
20
20
  * ```
21
21
  * const userPoints = await getUserPoints(
22
22
  * authorization,
23
- * { userName: "xelnia" }
23
+ * { username: "xelnia" }
24
24
  * );
25
25
  * ```
26
26
  *
@@ -34,15 +34,15 @@ import type { GetUserPointsResponse, UserPoints } from "./models";
34
34
  */
35
35
  export const getUserPoints = async (
36
36
  authorization: AuthObject,
37
- payload: { userName: string }
37
+ payload: { username: string }
38
38
  ): Promise<UserPoints> => {
39
- const { userName } = payload;
39
+ const { username } = payload;
40
40
 
41
41
  const url = buildRequestUrl(
42
42
  apiBaseUrl,
43
43
  "/API_GetUserPoints.php",
44
44
  authorization,
45
- { u: userName }
45
+ { u: username }
46
46
  );
47
47
 
48
48
  const rawResponse = await call<GetUserPointsResponse>({ url });
@@ -22,7 +22,7 @@ describe("Function: getUserProfile", () => {
22
22
  it("given a username, retrieves minimal user profile information about the user", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -53,7 +53,7 @@ describe("Function: getUserProfile", () => {
53
53
 
54
54
  // ACT
55
55
  const response = await getUserProfile(authorization, {
56
- userName: "WCopeland",
56
+ username: "WCopeland",
57
57
  });
58
58
 
59
59
  // ASSERT
@@ -11,16 +11,16 @@ import type { GetUserProfileResponse, UserProfile } from "./models";
11
11
  * A call to this function will retrieve summary information about
12
12
  * a given user, targeted by username.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
- * @param payload.userName The user for which to retrieve the summary for.
17
+ * @param payload.username The user for which to retrieve the summary for.
18
18
  *
19
19
  * @example
20
20
  * ```
21
21
  * const userSummary = await getUserProfile(
22
22
  * authorization,
23
- * { userName: "xelnia" }
23
+ * { username: "xelnia" }
24
24
  * );
25
25
  * ```
26
26
  *
@@ -29,16 +29,16 @@ import type { GetUserProfileResponse, UserProfile } from "./models";
29
29
  export const getUserProfile = async (
30
30
  authorization: AuthObject,
31
31
  payload: {
32
- userName: string;
32
+ username: string;
33
33
  }
34
34
  ): Promise<UserProfile> => {
35
- const { userName } = payload;
35
+ const { username } = payload;
36
36
 
37
37
  const url = buildRequestUrl(
38
38
  apiBaseUrl,
39
39
  "/API_GetUserProfile.php",
40
40
  authorization,
41
- { u: userName }
41
+ { u: username }
42
42
  );
43
43
 
44
44
  const rawResponse = await call<GetUserProfileResponse>({ url });
@@ -22,7 +22,7 @@ describe("Function: getUserProgress", () => {
22
22
  it(`retrieves a map of a user's progress by game IDs`, async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -53,7 +53,7 @@ describe("Function: getUserProgress", () => {
53
53
 
54
54
  // ACT
55
55
  const response = await getUserProgress(authorization, {
56
- userName: "xelnia",
56
+ username: "xelnia",
57
57
  gameIds: [1, 14_402],
58
58
  });
59
59
 
@@ -12,10 +12,10 @@ import type { GetUserProgressResponse, UserProgress } from "./models";
12
12
  * A call to this function will retrieve a given user's
13
13
  * progress on a given list of games, targeted by game ID.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
- * @param payload.userName The user for which to retrieve the progress for.
18
+ * @param payload.username The user for which to retrieve the progress for.
19
19
  *
20
20
  * @param payload.gameIds An array of RetroAchievements game IDs. If you aren't
21
21
  * sure of the game ID, visit the game's page on the website and copy the number
@@ -25,7 +25,7 @@ import type { GetUserProgressResponse, UserProgress } from "./models";
25
25
  * ```
26
26
  * const userProgress = await getUserProgress(
27
27
  * authorization,
28
- * { userName: "xelnia", gameIds: [1, 14402] }
28
+ * { username: "xelnia", gameIds: [1, 14402] }
29
29
  * );
30
30
  * ```
31
31
  *
@@ -53,15 +53,15 @@ import type { GetUserProgressResponse, UserProgress } from "./models";
53
53
  */
54
54
  export const getUserProgress = async (
55
55
  authorization: AuthObject,
56
- payload: { userName: string; gameIds: ID[] }
56
+ payload: { username: string; gameIds: ID[] }
57
57
  ): Promise<UserProgress> => {
58
- const { userName, gameIds } = payload;
58
+ const { username, gameIds } = payload;
59
59
 
60
60
  const url = buildRequestUrl(
61
61
  apiBaseUrl,
62
62
  "/API_GetUserProgress.php",
63
63
  authorization,
64
- { u: userName, i: gameIds.join(",") }
64
+ { u: username, i: gameIds.join(",") }
65
65
  );
66
66
 
67
67
  const rawResponse = await call<GetUserProgressResponse>({ url });
@@ -22,7 +22,7 @@ describe("Function: getUserRecentAchievements", () => {
22
22
  it("retrieves a list of recently-earned user achievements", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -54,7 +54,7 @@ describe("Function: getUserRecentAchievements", () => {
54
54
 
55
55
  // ACT
56
56
  const response = await getUserRecentAchievements(authorization, {
57
- userName: "xelnia",
57
+ username: "xelnia",
58
58
  });
59
59
 
60
60
  // ASSERT
@@ -15,10 +15,10 @@ import type {
15
15
  * recently earned achievements, via their username. By default, it
16
16
  * fetches achievements earned in the last hour.
17
17
  *
18
- * @param authorization An object containing your userName and webApiKey.
18
+ * @param authorization An object containing your username and webApiKey.
19
19
  * This can be constructed with `buildAuthorization()`.
20
20
  *
21
- * @param payload.userName The user for which to retrieve the recent achievements for.
21
+ * @param payload.username The user for which to retrieve the recent achievements for.
22
22
  *
23
23
  * @param payload.recentMinutes Optional. Defaults to 60. How many minutes
24
24
  * back to fetch for the given user.
@@ -27,7 +27,7 @@ import type {
27
27
  * ```
28
28
  * const userRecentAchievements = await getUserRecentAchievements(
29
29
  * authorization,
30
- * { userName: "xelnia" }
30
+ * { username: "xelnia" }
31
31
  * );
32
32
  * ```
33
33
  *
@@ -55,11 +55,11 @@ import type {
55
55
  */
56
56
  export const getUserRecentAchievements = async (
57
57
  authorization: AuthObject,
58
- payload: { userName: string; recentMinutes?: number }
58
+ payload: { username: string; recentMinutes?: number }
59
59
  ): Promise<UserRecentAchievement[]> => {
60
- const { userName, recentMinutes } = payload;
60
+ const { username, recentMinutes } = payload;
61
61
 
62
- const queryParams: Record<string, string | number> = { u: userName };
62
+ const queryParams: Record<string, string | number> = { u: username };
63
63
 
64
64
  if (recentMinutes !== undefined) {
65
65
  queryParams["m"] = recentMinutes;
@@ -22,7 +22,7 @@ describe("Function: getUserRecentlyPlayedGames", () => {
22
22
  it(`retrieves a list of a given user's recently played games`, async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -52,7 +52,7 @@ describe("Function: getUserRecentlyPlayedGames", () => {
52
52
 
53
53
  // ACT
54
54
  const response = await getUserRecentlyPlayedGames(authorization, {
55
- userName: "xelnia",
55
+ username: "xelnia",
56
56
  });
57
57
 
58
58
  // ASSERT
@@ -14,10 +14,10 @@ import type {
14
14
  * A call to this function will retrieve a list of a target user's
15
15
  * recently played games, via their username.
16
16
  *
17
- * @param authorization An object containing your userName and webApiKey.
17
+ * @param authorization An object containing your username and webApiKey.
18
18
  * This can be constructed with `buildAuthorization()`.
19
19
  *
20
- * @param payload.userName The user for which to retrieve the summary for.
20
+ * @param payload.username The user for which to retrieve the summary for.
21
21
  *
22
22
  * @param payload.count Optional. Defaults to 10. Max is 50. How many
23
23
  * recently played games for the user to retrieve.
@@ -29,7 +29,7 @@ import type {
29
29
  * ```
30
30
  * const userRecentlyPlayedGames = await getUserRecentlyPlayedGames(
31
31
  * authorization,
32
- * { userName: "xelnia" }
32
+ * { username: "xelnia" }
33
33
  * );
34
34
  * ```
35
35
  *
@@ -55,11 +55,11 @@ import type {
55
55
  */
56
56
  export const getUserRecentlyPlayedGames = async (
57
57
  authorization: AuthObject,
58
- payload: { userName: string; offset?: number; count?: number }
58
+ payload: { username: string; offset?: number; count?: number }
59
59
  ): Promise<UserRecentlyPlayedGames> => {
60
- const { userName, offset, count } = payload;
60
+ const { username, offset, count } = payload;
61
61
 
62
- const queryParams: Record<string, string | number> = { u: userName };
62
+ const queryParams: Record<string, string | number> = { u: username };
63
63
 
64
64
  if (offset !== undefined) {
65
65
  queryParams["o"] = offset;
@@ -24,7 +24,7 @@ describe("Function: getUserSummary", () => {
24
24
  it("given a username, retrieves user summary information about the user", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -38,7 +38,7 @@ describe("Function: getUserSummary", () => {
38
38
 
39
39
  // ACT
40
40
  const response = await getUserSummary(authorization, {
41
- userName: "WCopeland",
41
+ username: "WCopeland",
42
42
  });
43
43
 
44
44
  // ASSERT
@@ -48,7 +48,7 @@ describe("Function: getUserSummary", () => {
48
48
  it("given the API returns a 503, throws an error", async () => {
49
49
  // ARRANGE
50
50
  const authorization = buildAuthorization({
51
- userName: "mockUserName",
51
+ username: "mockUserName",
52
52
  webApiKey: "mockWebApiKey",
53
53
  });
54
54
 
@@ -62,7 +62,7 @@ describe("Function: getUserSummary", () => {
62
62
 
63
63
  // ASSERT
64
64
  await expect(
65
- getUserSummary(authorization, { userName: "WCopeland" })
65
+ getUserSummary(authorization, { username: "WCopeland" })
66
66
  ).rejects.toThrow();
67
67
  });
68
68
  });
@@ -11,10 +11,10 @@ import type { GetUserSummaryResponse, UserSummary } from "./models";
11
11
  * A call to this function will retrieve summary information about
12
12
  * a given user, targeted by username.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
- * @param payload.userName The user for which to retrieve the summary for.
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
20
  * This defaults to 0.
@@ -26,7 +26,7 @@ import type { GetUserSummaryResponse, UserSummary } from "./models";
26
26
  * ```
27
27
  * const userSummary = await getUserSummary(
28
28
  * authorization,
29
- * { userName: "xelnia" }
29
+ * { username: "xelnia" }
30
30
  * );
31
31
  * ```
32
32
  *
@@ -35,14 +35,14 @@ import type { GetUserSummaryResponse, UserSummary } from "./models";
35
35
  export const getUserSummary = async (
36
36
  authorization: AuthObject,
37
37
  payload: {
38
- userName: string;
38
+ username: string;
39
39
  recentGamesCount?: number;
40
40
  recentAchievementsCount?: number;
41
41
  }
42
42
  ): Promise<UserSummary> => {
43
- const { userName, recentGamesCount, recentAchievementsCount } = payload;
43
+ const { username, recentGamesCount, recentAchievementsCount } = payload;
44
44
 
45
- const queryParams: Record<string, string | number> = { u: userName };
45
+ const queryParams: Record<string, string | number> = { u: username };
46
46
 
47
47
  if (recentGamesCount !== undefined) {
48
48
  queryParams["g"] = recentGamesCount;
@@ -2,6 +2,7 @@ import type {
2
2
  GameExtended,
3
3
  GameExtendedAchievementEntity,
4
4
  } from "../../game/models";
5
+ import type { AwardKind } from "../../utils/public";
5
6
 
6
7
  export type GameExtendedAchievementEntityWithUserProgress =
7
8
  GameExtendedAchievementEntity & {
@@ -16,4 +17,7 @@ export interface GameInfoAndUserProgress extends GameExtended {
16
17
  numAwardedToUserHardcore: number;
17
18
  userCompletion: string;
18
19
  userCompletionHardcore: string;
20
+
21
+ highestAwardKind?: AwardKind | null;
22
+ highestAwardDate?: string;
19
23
  }