@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
@@ -2,6 +2,7 @@ import type {
2
2
  GameExtendedRawAchievementEntity,
3
3
  GetGameExtendedResponse,
4
4
  } from "../../game/models";
5
+ import type { AwardKind } from "../../utils/public";
5
6
 
6
7
  type GetGameExtendedResponseWithoutClaims = Omit<
7
8
  GetGameExtendedResponse,
@@ -25,4 +26,7 @@ export interface GetGameInfoAndUserProgressResponse
25
26
  NumAwardedToUserHardcore: number;
26
27
  UserCompletion: string;
27
28
  UserCompletionHardcore: string;
29
+
30
+ HighestAwardKind?: AwardKind | null;
31
+ HighestAwardDate?: string;
28
32
  }
@@ -1,3 +1,5 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+
1
3
  interface RawUserCompletionProgressEntity {
2
4
  GameID: number;
3
5
  Title: string;
@@ -9,12 +11,7 @@ interface RawUserCompletionProgressEntity {
9
11
  NumAwardedHardcore: number;
10
12
 
11
13
  MostRecentAwardedDate?: string;
12
- HighestAwardKind?:
13
- | "mastered"
14
- | "completed"
15
- | "beaten-hardcore"
16
- | "beaten-softcore"
17
- | null;
14
+ HighestAwardKind?: AwardKind | null;
18
15
  HighestAwardDate?: string | null;
19
16
  }
20
17
 
@@ -1,3 +1,5 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+
1
3
  export interface UserCompletionProgressEntity {
2
4
  gameId: number;
3
5
  title: string;
@@ -9,11 +11,6 @@ export interface UserCompletionProgressEntity {
9
11
  numAwardedHardcore: number;
10
12
 
11
13
  mostRecentAwardedDate?: string;
12
- highestAwardKind?:
13
- | "mastered"
14
- | "completed"
15
- | "beaten-hardcore"
16
- | "beaten-softcore"
17
- | null;
14
+ highestAwardKind?: AwardKind | null;
18
15
  highestAwardDate?: string;
19
16
  }
@@ -22,7 +22,7 @@ describe("Util: buildRequestUrl", () => {
22
22
  const requestUrl = buildRequestUrl(
23
23
  baseUrl,
24
24
  endpointUrl,
25
- { userName: "TestUser", webApiKey: "mockWebApiKey" },
25
+ { username: "TestUser", webApiKey: "mockWebApiKey" },
26
26
  args as any
27
27
  );
28
28
 
@@ -39,7 +39,7 @@ describe("Util: buildRequestUrl", () => {
39
39
 
40
40
  // ACT
41
41
  const requestUrl = buildRequestUrl(baseUrl, endpointUrl, {
42
- userName: "TestUser",
42
+ username: "TestUser",
43
43
  webApiKey: "mockWebApiKey",
44
44
  });
45
45
 
@@ -14,7 +14,7 @@ export const buildRequestUrl = (
14
14
  // `z` and `y` are expected query params from the RA API.
15
15
  // Authentication is handled purely by query params.
16
16
  const queryParamValues: Record<string, string> = {
17
- z: authObject.userName,
17
+ z: authObject.username,
18
18
  y: authObject.webApiKey,
19
19
  };
20
20
 
@@ -9,7 +9,7 @@ describe("Util: buildAuthorization", () => {
9
9
  it("returns the same object it is given", () => {
10
10
  // ARRANGE
11
11
  const myAuth = {
12
- userName: "myUserName",
12
+ username: "myUserName",
13
13
  webApiKey: "myWebApiKey",
14
14
  };
15
15
 
@@ -20,7 +20,7 @@ describe("Util: buildAuthorization", () => {
20
20
  expect(authorization).toEqual(myAuth);
21
21
  });
22
22
 
23
- it("throws an error if missing a userName", () => {
23
+ it("throws an error if missing a username", () => {
24
24
  // ASSERT
25
25
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
26
26
  // @ts-ignore - We're assuming the user is not using a TypeScript project.
@@ -31,6 +31,6 @@ describe("Util: buildAuthorization", () => {
31
31
  // ASSERT
32
32
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
33
33
  // @ts-ignore - We're assuming the user is not using a TypeScript project.
34
- expect(() => buildAuthorization({ userName: "mockUserName" })).toThrow();
34
+ expect(() => buildAuthorization({ username: "mockUserName" })).toThrow();
35
35
  });
36
36
  });
@@ -15,19 +15,19 @@ import type { AuthObject } from "./models";
15
15
  * @example
16
16
  * ```
17
17
  * const authorization = buildAuthorization({
18
- * userName: "Scott",
18
+ * username: "Scott",
19
19
  * webApiKey: "LtjCwW16nJI7cqOyPIQtXk8v1cfF0tmO"
20
20
  * });
21
21
  * ```
22
22
  */
23
23
  export const buildAuthorization = (options: AuthObject): AuthObject => {
24
- if (!options.userName || !options.webApiKey) {
24
+ if (!options.username || !options.webApiKey) {
25
25
  throw new Error(`
26
26
  buildAuthorization() requires an object containing a
27
- userName and webApiKey. eg:
27
+ username and webApiKey. eg:
28
28
 
29
29
  const authorization = buildAuthorization({
30
- userName: "myUserName",
30
+ username: "myUserName",
31
31
  webApiKey: "myWebApiKey"
32
32
  })
33
33
  `);
@@ -1,6 +1,6 @@
1
1
  /**
2
2
  * Each RetroAchievements API call is uniquely authenticated
3
- * using a userName + API key combination. Your account's personal
3
+ * using a username + API key combination. Your account's personal
4
4
  * Web API Key can be found on the Settings page.
5
5
  */
6
6
  export interface AuthObject {
@@ -9,7 +9,7 @@ export interface AuthObject {
9
9
  * For example, https://retroachievements.org/user/Scott would have a value
10
10
  * of "Scott".
11
11
  */
12
- userName: string;
12
+ username: string;
13
13
 
14
14
  /**
15
15
  * This can be found in the "Keys" section of your Settings page on the
@@ -0,0 +1,5 @@
1
+ export type AwardKind =
2
+ | "beaten-softcore"
3
+ | "beaten-hardcore"
4
+ | "completed"
5
+ | "mastered";
@@ -1 +1,2 @@
1
1
  export * from "./auth-object.model";
2
+ export * from "./award-kind.model";
@@ -1,5 +0,0 @@
1
- export interface ConsoleId {
2
- id: number;
3
- name: string;
4
- iconUrl: string;
5
- }