@retroachievements/api 1.5.2 → 2.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (125) hide show
  1. package/README.md +2 -2
  2. package/dist/achievement/getAchievementUnlocks.d.ts +1 -1
  3. package/dist/achievement/models/achievement-type.model.d.ts +1 -0
  4. package/dist/achievement/models/index.d.ts +1 -0
  5. package/dist/api.cjs +1 -1
  6. package/dist/api.cjs.map +1 -1
  7. package/dist/api.modern.js +1 -1
  8. package/dist/api.modern.js.map +1 -1
  9. package/dist/api.module.js +1 -1
  10. package/dist/api.module.js.map +1 -1
  11. package/dist/api.umd.js +1 -1
  12. package/dist/api.umd.js.map +1 -1
  13. package/dist/console/getConsoleIds.d.ts +15 -4
  14. package/dist/console/getGameList.d.ts +1 -1
  15. package/dist/console/models/fetched-system.model.d.ts +7 -0
  16. package/dist/console/models/get-console-ids-response.model.d.ts +2 -0
  17. package/dist/console/models/index.d.ts +1 -1
  18. package/dist/feed/getAchievementOfTheWeek.d.ts +1 -1
  19. package/dist/feed/getActiveClaims.d.ts +1 -1
  20. package/dist/feed/getTopTenUsers.d.ts +3 -3
  21. package/dist/feed/models/top-ten-users-entity.model.d.ts +1 -1
  22. package/dist/game/getAchievementCount.d.ts +1 -1
  23. package/dist/game/getAchievementDistribution.d.ts +1 -1
  24. package/dist/game/getGame.d.ts +1 -1
  25. package/dist/game/getGameExtended.d.ts +2 -2
  26. package/dist/game/getGameRankAndScore.d.ts +1 -1
  27. package/dist/game/getGameRating.d.ts +1 -1
  28. package/dist/game/models/game-extended-achievement-entity.model.d.ts +2 -0
  29. package/dist/ticket/getTicketData.d.ts +9 -9
  30. package/dist/user/getAchievementsEarnedBetween.d.ts +4 -4
  31. package/dist/user/getAchievementsEarnedOnDay.d.ts +4 -4
  32. package/dist/user/getGameInfoAndUserProgress.d.ts +9 -5
  33. package/dist/user/getUserAwards.d.ts +4 -4
  34. package/dist/user/getUserClaims.d.ts +4 -4
  35. package/dist/user/getUserCompletedGames.d.ts +4 -4
  36. package/dist/user/getUserCompletionProgress.d.ts +4 -4
  37. package/dist/user/getUserGameRankAndScore.d.ts +4 -4
  38. package/dist/user/getUserPoints.d.ts +4 -4
  39. package/dist/user/getUserProfile.d.ts +4 -4
  40. package/dist/user/getUserProgress.d.ts +4 -4
  41. package/dist/user/getUserRecentAchievements.d.ts +4 -4
  42. package/dist/user/getUserRecentlyPlayedGames.d.ts +4 -4
  43. package/dist/user/getUserSummary.d.ts +4 -4
  44. package/dist/user/models/dated-user-achievement.model.d.ts +1 -1
  45. package/dist/user/models/dated-user-achievements-response.model.d.ts +1 -1
  46. package/dist/user/models/game-info-and-user-progress.model.d.ts +2 -0
  47. package/dist/user/models/get-game-info-and-user-progress-response.model.d.ts +2 -0
  48. package/dist/user/models/index.d.ts +0 -1
  49. package/dist/utils/public/buildAuthorization.d.ts +1 -1
  50. package/dist/utils/public/models/auth-object.model.d.ts +2 -2
  51. package/package.json +6 -12
  52. package/src/__playground.ts +4 -4
  53. package/src/achievement/getAchievementUnlocks.test.ts +1 -1
  54. package/src/achievement/getAchievementUnlocks.ts +1 -1
  55. package/src/achievement/models/index.ts +1 -0
  56. package/src/console/getConsoleIds.test.ts +15 -3
  57. package/src/console/getConsoleIds.ts +28 -6
  58. package/src/console/getGameList.test.ts +1 -1
  59. package/src/console/getGameList.ts +1 -1
  60. package/src/console/models/fetched-system.model.ts +7 -0
  61. package/src/console/models/get-console-ids-response.model.ts +2 -0
  62. package/src/console/models/index.ts +1 -1
  63. package/src/feed/getAchievementOfTheWeek.test.ts +2 -2
  64. package/src/feed/getAchievementOfTheWeek.ts +1 -1
  65. package/src/feed/getActiveClaims.test.ts +1 -1
  66. package/src/feed/getActiveClaims.ts +1 -1
  67. package/src/feed/getClaims.test.ts +1 -1
  68. package/src/feed/getTopTenUsers.test.ts +11 -11
  69. package/src/feed/getTopTenUsers.ts +4 -4
  70. package/src/feed/models/top-ten-users-entity.model.ts +1 -1
  71. package/src/game/getAchievementCount.test.ts +1 -1
  72. package/src/game/getAchievementCount.ts +1 -1
  73. package/src/game/getAchievementDistribution.test.ts +4 -4
  74. package/src/game/getAchievementDistribution.ts +1 -1
  75. package/src/game/getGame.test.ts +1 -1
  76. package/src/game/getGame.ts +1 -1
  77. package/src/game/getGameExtended.test.ts +1 -1
  78. package/src/game/getGameExtended.ts +2 -2
  79. package/src/game/getGameRankAndScore.test.ts +1 -1
  80. package/src/game/getGameRankAndScore.ts +1 -1
  81. package/src/game/getGameRating.test.ts +1 -1
  82. package/src/game/getGameRating.ts +1 -1
  83. package/src/game/models/game-extended-achievement-entity.model.ts +3 -0
  84. package/src/ticket/getTicketData.test.ts +7 -7
  85. package/src/ticket/getTicketData.ts +13 -13
  86. package/src/user/getAchievementsEarnedBetween.test.ts +2 -2
  87. package/src/user/getAchievementsEarnedBetween.ts +6 -6
  88. package/src/user/getAchievementsEarnedOnDay.test.ts +2 -2
  89. package/src/user/getAchievementsEarnedOnDay.ts +6 -6
  90. package/src/user/getGameInfoAndUserProgress.test.ts +3 -3
  91. package/src/user/getGameInfoAndUserProgress.ts +22 -11
  92. package/src/user/getUserAwards.test.ts +2 -2
  93. package/src/user/getUserAwards.ts +6 -6
  94. package/src/user/getUserClaims.test.ts +2 -2
  95. package/src/user/getUserClaims.ts +6 -6
  96. package/src/user/getUserCompletedGames.test.ts +2 -2
  97. package/src/user/getUserCompletedGames.ts +6 -6
  98. package/src/user/getUserCompletionProgress.test.ts +2 -2
  99. package/src/user/getUserCompletionProgress.ts +6 -6
  100. package/src/user/getUserGameRankAndScore.test.ts +2 -2
  101. package/src/user/getUserGameRankAndScore.ts +6 -6
  102. package/src/user/getUserPoints.test.ts +2 -2
  103. package/src/user/getUserPoints.ts +6 -6
  104. package/src/user/getUserProfile.test.ts +2 -2
  105. package/src/user/getUserProfile.ts +6 -6
  106. package/src/user/getUserProgress.test.ts +2 -2
  107. package/src/user/getUserProgress.ts +6 -6
  108. package/src/user/getUserRecentAchievements.test.ts +2 -2
  109. package/src/user/getUserRecentAchievements.ts +6 -6
  110. package/src/user/getUserRecentlyPlayedGames.test.ts +2 -2
  111. package/src/user/getUserRecentlyPlayedGames.ts +6 -6
  112. package/src/user/getUserSummary.test.ts +4 -4
  113. package/src/user/getUserSummary.ts +6 -6
  114. package/src/user/models/dated-user-achievement.model.ts +1 -1
  115. package/src/user/models/dated-user-achievements-response.model.ts +1 -1
  116. package/src/user/models/game-info-and-user-progress.model.ts +8 -0
  117. package/src/user/models/get-game-info-and-user-progress-response.model.ts +8 -0
  118. package/src/user/models/index.ts +0 -1
  119. package/src/utils/internal/buildRequestUrl.test.ts +2 -2
  120. package/src/utils/internal/buildRequestUrl.ts +1 -1
  121. package/src/utils/public/buildAuthorization.test.ts +3 -3
  122. package/src/utils/public/buildAuthorization.ts +4 -4
  123. package/src/utils/public/models/auth-object.model.ts +2 -2
  124. package/src/console/models/console-id.model.ts +0 -5
  125. /package/src/{user → achievement}/models/achievement-type.model.ts +0 -0
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "raweb",
11
11
  "retro gaming"
12
12
  ],
13
- "version": "1.5.2",
13
+ "version": "2.0.0",
14
14
  "typings": "dist/index.d.ts",
15
15
  "exports": {
16
16
  ".": {
@@ -32,7 +32,7 @@
32
32
  "dev": "esrun --watch src/__playground.ts",
33
33
  "prebuild": "node src/set-version.js",
34
34
  "build": "microbundle",
35
- "prepare": "microbundle",
35
+ "prepare": "microbundle && husky install",
36
36
  "format": "prettier --write . '**/*.{json,md,js,ts,tsx}'",
37
37
  "format:write": "prettier --write . '**/*.{json,md,js,ts,tsx}'",
38
38
  "format:check": "prettier --check . '**/*.{json,md,js,ts,tsx}'",
@@ -41,10 +41,9 @@
41
41
  "test": "vitest run",
42
42
  "test:watch": "vitest",
43
43
  "test:coverage": "vitest run --coverage",
44
- "verify": "yarn format:check && yarn lint && yarn test:coverage && yarn build",
44
+ "verify": "pnpm format:check && pnpm lint && pnpm test:coverage && pnpm build",
45
45
  "start": "microbundle watch"
46
46
  },
47
- "peerDependencies": {},
48
47
  "devDependencies": {
49
48
  "@commitlint/cli": "^17.4.2",
50
49
  "@commitlint/config-conventional": "^17.4.2",
@@ -62,7 +61,7 @@
62
61
  "eslint-plugin-simple-import-sort": "^10.0.0",
63
62
  "eslint-plugin-sonarjs": "^0.23.0",
64
63
  "eslint-plugin-unicorn": "^49.0.0",
65
- "husky": "4.3.8",
64
+ "husky": "9.0.11",
66
65
  "microbundle": "^0.15.1",
67
66
  "msw": "^2.0.3",
68
67
  "prettier": "2.8.3",
@@ -74,12 +73,6 @@
74
73
  "vite": "^4.5.0",
75
74
  "vitest": "^0.34.6"
76
75
  },
77
- "husky": {
78
- "hooks": {
79
- "pre-commit": "pretty-quick --staged && yarn lint",
80
- "commit-msg": "commitlint -E HUSKY_GIT_PARAMS"
81
- }
82
- },
83
76
  "config": {
84
77
  "commitizen": {
85
78
  "path": "./node_modules/cz-conventional-changelog"
@@ -102,5 +95,6 @@
102
95
  "url": "https://github.com/RetroAchievements/api-js/issues"
103
96
  },
104
97
  "homepage": "https://github.com/RetroAchievements/api-js#readme",
105
- "author": "RAWeb Team"
98
+ "author": "RAWeb Team",
99
+ "packageManager": "pnpm@9.1.1+sha256.9551e803dcb7a1839fdf5416153a844060c7bce013218ce823410532504ac10b"
106
100
  }
@@ -17,7 +17,7 @@
17
17
  import { buildAuthorization, getAchievementCount } from "./index";
18
18
 
19
19
  // MODIFY THESE VALUES.
20
- const userName = "myUserName";
20
+ const username = "myUsername";
21
21
  const webApiKey = "myWebApiKey";
22
22
 
23
23
  const main = async () => {
@@ -25,13 +25,13 @@ const main = async () => {
25
25
 
26
26
  // -- Start testing stuff here --
27
27
 
28
- if (userName === "myUserName" || webApiKey === "myWebApiKey") {
28
+ if (username === "myUsername" || webApiKey === "myWebApiKey") {
29
29
  console.error(
30
- "⛔️ ERROR: In __playground.ts, modify the userName and webApiKey variables to match your RA credentials.\n"
30
+ "⛔️ ERROR: In __playground.ts, modify the username and webApiKey variables to match your RA credentials.\n"
31
31
  );
32
32
  }
33
33
 
34
- const authorization = buildAuthorization({ userName, webApiKey });
34
+ const authorization = buildAuthorization({ username, webApiKey });
35
35
 
36
36
  const achievementCount = await getAchievementCount(authorization, {
37
37
  gameId: 14_402,
@@ -22,7 +22,7 @@ describe("Function: getAchievementUnlocks", () => {
22
22
  it("retrieves metadata about unlocks for a target achievement", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -15,7 +15,7 @@ import type {
15
15
  * A call to this function will retrieve a list of users who
16
16
  * have earned a given achievement, targeted by the achievement's ID.
17
17
  *
18
- * @param authorization An object containing your userName and webApiKey.
18
+ * @param authorization An object containing your username and webApiKey.
19
19
  * This can be constructed with `buildAuthorization()`.
20
20
  *
21
21
  * @param payload.achievementId The target achievement we want to
@@ -1,2 +1,3 @@
1
+ export * from "./achievement-type.model";
1
2
  export * from "./achievement-unlock-entity.model";
2
3
  export * from "./get-achievement-unlocks-response.model";
@@ -6,7 +6,7 @@ import { setupServer } from "msw/node";
6
6
  import { apiBaseUrl } from "../utils/internal";
7
7
  import { buildAuthorization } from "../utils/public";
8
8
  import { getConsoleIds } from "./getConsoleIds";
9
- import type { ConsoleId, GetConsoleIdsResponse } from "./models";
9
+ import type { FetchedSystem, GetConsoleIdsResponse } from "./models";
10
10
 
11
11
  const server = setupServer();
12
12
 
@@ -24,7 +24,7 @@ describe("Function: getConsoleIds", () => {
24
24
  it("retrieves a list of console IDs and their names and cleans properties", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -34,18 +34,24 @@ describe("Function: getConsoleIds", () => {
34
34
  Name: "Mega Drive",
35
35
  IconURL:
36
36
  "https://static.retroachievements.org/assets/images/system/md.png",
37
+ Active: true,
38
+ IsGameSystem: true,
37
39
  },
38
40
  {
39
41
  ID: "2",
40
42
  Name: "Nintendo 64",
41
43
  IconURL:
42
44
  "https://static.retroachievements.org/assets/images/system/n64.png",
45
+ Active: true,
46
+ IsGameSystem: true,
43
47
  },
44
48
  {
45
49
  ID: "3",
46
50
  Name: "SNES",
47
51
  IconURL:
48
52
  "https://static.retroachievements.org/assets/images/system/snes.png",
53
+ Active: false,
54
+ IsGameSystem: false,
49
55
  },
50
56
  ];
51
57
 
@@ -59,24 +65,30 @@ describe("Function: getConsoleIds", () => {
59
65
  const response = await getConsoleIds(authorization);
60
66
 
61
67
  // ASSERT
62
- const expectedResponse: ConsoleId[] = [
68
+ const expectedResponse: FetchedSystem[] = [
63
69
  {
64
70
  id: 1,
65
71
  name: "Mega Drive",
66
72
  iconUrl:
67
73
  "https://static.retroachievements.org/assets/images/system/md.png",
74
+ active: true,
75
+ isGameSystem: true,
68
76
  },
69
77
  {
70
78
  id: 2,
71
79
  name: "Nintendo 64",
72
80
  iconUrl:
73
81
  "https://static.retroachievements.org/assets/images/system/n64.png",
82
+ active: true,
83
+ isGameSystem: true,
74
84
  },
75
85
  {
76
86
  id: 3,
77
87
  name: "SNES",
78
88
  iconUrl:
79
89
  "https://static.retroachievements.org/assets/images/system/snes.png",
90
+ active: false,
91
+ isGameSystem: false,
80
92
  },
81
93
  ];
82
94
 
@@ -5,16 +5,22 @@ import {
5
5
  serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
- import type { ConsoleId, GetConsoleIdsResponse } from "./models";
8
+ import type { FetchedSystem, GetConsoleIdsResponse } from "./models";
9
9
 
10
10
  /**
11
11
  * A call to this function will retrieve the complete list
12
12
  * of console ID and name pairs on the RetroAchievements.org
13
13
  * platform.
14
14
  *
15
- * @param authorization An object containing your 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.shouldOnlyRetrieveActiveSystems If true, only systems that
19
+ * officially support achievements will be returned.
20
+ *
21
+ * @param payload.shouldOnlyRetrieveGameSystems If true, events and hubs will
22
+ * not be returned.
23
+ *
18
24
  * @example
19
25
  * ```
20
26
  * const consoleIds = await getConsoleIds(authorization);
@@ -26,17 +32,33 @@ import type { ConsoleId, GetConsoleIdsResponse } from "./models";
26
32
  * {
27
33
  * id: "1",
28
34
  * name: "Mega Drive",
29
- * iconUrl: "https://static.retroachievements.org/assets/images/system/md.png"
35
+ * iconUrl: "https://static.retroachievements.org/assets/images/system/md.png",
36
+ * active: true,
37
+ * isGameSystem: true
30
38
  * }
31
39
  * ```
32
40
  */
33
41
  export const getConsoleIds = async (
34
- authorization: AuthObject
35
- ): Promise<ConsoleId[]> => {
42
+ authorization: AuthObject,
43
+ payload?: {
44
+ shouldOnlyRetrieveActiveSystems: boolean;
45
+ shouldOnlyRetrieveGameSystems: boolean;
46
+ }
47
+ ): Promise<FetchedSystem[]> => {
48
+ let callPayload: Record<string, any> | undefined;
49
+
50
+ if (payload?.shouldOnlyRetrieveActiveSystems) {
51
+ callPayload = { ...callPayload, a: 1 };
52
+ }
53
+ if (payload?.shouldOnlyRetrieveGameSystems) {
54
+ callPayload = { ...callPayload, g: 1 };
55
+ }
56
+
36
57
  const url = buildRequestUrl(
37
58
  apiBaseUrl,
38
59
  "/API_GetConsoleIDs.php",
39
- authorization
60
+ authorization,
61
+ callPayload
40
62
  );
41
63
 
42
64
  const rawResponse = await call<GetConsoleIdsResponse>({ url });
@@ -24,7 +24,7 @@ describe("Function: getGameList", () => {
24
24
  it("retrieves a list of games and cleans their properties", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -12,7 +12,7 @@ import type { GameList, GetGameListResponse } from "./models";
12
12
  * of games for a specified console on the RetroAchievements.org
13
13
  * platform.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
18
  * @param payload.consoleId The unique console ID to retrieve a list of
@@ -0,0 +1,7 @@
1
+ export interface FetchedSystem {
2
+ id: number;
3
+ name: string;
4
+ iconUrl: string;
5
+ active: boolean;
6
+ isGameSystem: boolean;
7
+ }
@@ -2,4 +2,6 @@ export type GetConsoleIdsResponse = readonly {
2
2
  ID: string;
3
3
  Name: string;
4
4
  IconURL: string;
5
+ Active: boolean;
6
+ IsGameSystem: boolean;
5
7
  }[];
@@ -1,4 +1,4 @@
1
- export * from "./console-id.model";
1
+ export * from "./fetched-system.model";
2
2
  export * from "./game-list.model";
3
3
  export * from "./get-console-ids-response.model";
4
4
  export * from "./get-game-list-response.model";
@@ -27,7 +27,7 @@ describe("Function: getAchievementOfTheWeek", () => {
27
27
  it("retrieves metadata about the current achievement of the week and cleans properties", async () => {
28
28
  // ARRANGE
29
29
  const authorization = buildAuthorization({
30
- userName: "mockUserName",
30
+ username: "mockUserName",
31
31
  webApiKey: "mockWebApiKey",
32
32
  });
33
33
 
@@ -105,7 +105,7 @@ describe("Function: getAchievementOfTheWeek", () => {
105
105
  it("properly sets the hardcore boolean value when cleaning properties", async () => {
106
106
  // ARRANGE
107
107
  const authorization = buildAuthorization({
108
- userName: "mockUserName",
108
+ username: "mockUserName",
109
109
  webApiKey: "mockWebApiKey",
110
110
  });
111
111
 
@@ -14,7 +14,7 @@ import type {
14
14
  * A call to this function will retrieve comprehensive
15
15
  * metadata about the current Achievement of the Week.
16
16
  *
17
- * @param authorization An object containing your userName and webApiKey.
17
+ * @param authorization An object containing your username and webApiKey.
18
18
  * This can be constructed with `buildAuthorization()`.
19
19
  *
20
20
  * @example
@@ -24,7 +24,7 @@ describe("Function: getActiveClaims", () => {
24
24
  it("retrieves metadata about current active claims", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -11,7 +11,7 @@ import type { GetSetClaimsResponse, SetClaim } from "./models";
11
11
  * A call to this function returns information about all
12
12
  * (1000 max) active set claims.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
17
  * @example
@@ -24,7 +24,7 @@ describe("Function: getClaims", () => {
24
24
  it("retrieves metadata about a requested kind of claims", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -22,7 +22,7 @@ describe("Function: getTopTenUsers", () => {
22
22
  it("retrieves metadata about the current top ten users on the site", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -51,48 +51,48 @@ describe("Function: getTopTenUsers", () => {
51
51
  // ASSERT
52
52
  expect(response).toEqual([
53
53
  {
54
- userName: "MaxMilyin",
54
+ username: "MaxMilyin",
55
55
  totalPoints: 346_289,
56
56
  totalRatioPoints: 995_092,
57
57
  },
58
58
  {
59
- userName: "HippopotamusRex",
59
+ username: "HippopotamusRex",
60
60
  totalPoints: 312_118,
61
61
  totalRatioPoints: 1_151_351,
62
62
  },
63
63
  {
64
- userName: "Sarconius",
64
+ username: "Sarconius",
65
65
  totalPoints: 257_862,
66
66
  totalRatioPoints: 1_181_770,
67
67
  },
68
- { userName: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 },
68
+ { username: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 },
69
69
  {
70
- userName: "Andrey199650",
70
+ username: "Andrey199650",
71
71
  totalPoints: 240_101,
72
72
  totalRatioPoints: 567_522,
73
73
  },
74
74
  {
75
- userName: "Wendigo",
75
+ username: "Wendigo",
76
76
  totalPoints: 227_903,
77
77
  totalRatioPoints: 1_099_685,
78
78
  },
79
79
  {
80
- userName: "donutweegee",
80
+ username: "donutweegee",
81
81
  totalPoints: 204_701,
82
82
  totalRatioPoints: 587_221,
83
83
  },
84
84
  {
85
- userName: "AmericanNinja",
85
+ username: "AmericanNinja",
86
86
  totalPoints: 202_980,
87
87
  totalRatioPoints: 567_618,
88
88
  },
89
89
  {
90
- userName: "Infernum",
90
+ username: "Infernum",
91
91
  totalPoints: 202_171,
92
92
  totalRatioPoints: 689_967,
93
93
  },
94
94
  {
95
- userName: "FabricioPrie",
95
+ username: "FabricioPrie",
96
96
  totalPoints: 196_974,
97
97
  totalRatioPoints: 450_436,
98
98
  },
@@ -10,7 +10,7 @@ import type {
10
10
  * A call to this function will retrieve the current top ten users
11
11
  * on the site.
12
12
  *
13
- * @param authorization An object containing your userName and webApiKey.
13
+ * @param authorization An object containing your username and webApiKey.
14
14
  * This can be constructed with `buildAuthorization()`.
15
15
  *
16
16
  * @example
@@ -21,8 +21,8 @@ import type {
21
21
  * @returns An array containing the list of top ten users.
22
22
  * ```json
23
23
  * [
24
- * { userName: "MockUser", totalPoints: 350000, totalRatioPoints: 995000 },
25
- * { userName: "MockUser2", totalPoints: 345000, totalRatioPoints: 994000 },
24
+ * { username: "MockUser", totalPoints: 350000, totalRatioPoints: 995000 },
25
+ * { username: "MockUser2", totalPoints: 345000, totalRatioPoints: 994000 },
26
26
  * // ...
27
27
  * ]
28
28
  * ```
@@ -41,7 +41,7 @@ export const getTopTenUsers = async (
41
41
  const sanitizedTopTenUsers: TopTenUsersEntity[] = [];
42
42
  for (const rawUser of rawTopTenUsers) {
43
43
  sanitizedTopTenUsers.push({
44
- userName: rawUser["1"],
44
+ username: rawUser["1"],
45
45
  totalPoints: Number(rawUser["2"]),
46
46
  totalRatioPoints: Number(rawUser["3"]),
47
47
  });
@@ -1,5 +1,5 @@
1
1
  export interface TopTenUsersEntity {
2
- userName: string;
2
+ username: string;
3
3
  totalPoints: number;
4
4
  totalRatioPoints: number;
5
5
  }
@@ -22,7 +22,7 @@ describe("Function: getAchievementCount", () => {
22
22
  it("given a game ID, retrieves the list of achievement IDs associated with the game and cleans properties", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -12,7 +12,7 @@ import type { AchievementCount, GetAchievementCountResponse } from "./models";
12
12
  * A call to this function will retrieve the list of
13
13
  * achievement IDs for a game, targeted by game ID.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
18
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -23,7 +23,7 @@ describe("Function: getAchievementDistribution", () => {
23
23
  it("given a game ID, retrieves the achievement distribution associated with the game", async () => {
24
24
  // ARRANGE
25
25
  const authorization = buildAuthorization({
26
- userName: "mockUserName",
26
+ username: "mockUserName",
27
27
  webApiKey: "mockWebApiKey",
28
28
  });
29
29
 
@@ -61,7 +61,7 @@ describe("Function: getAchievementDistribution", () => {
61
61
  it("given flags, successfully attaches the option to the call", async () => {
62
62
  // ARRANGE
63
63
  const authorization = buildAuthorization({
64
- userName: "mockUserName",
64
+ username: "mockUserName",
65
65
  webApiKey: "mockWebApiKey",
66
66
  });
67
67
 
@@ -101,7 +101,7 @@ describe("Function: getAchievementDistribution", () => {
101
101
  it("given a truthy hardcore value, successfully attaches the option to the call", async () => {
102
102
  // ARRANGE
103
103
  const authorization = buildAuthorization({
104
- userName: "mockUserName",
104
+ username: "mockUserName",
105
105
  webApiKey: "mockWebApiKey",
106
106
  });
107
107
 
@@ -138,7 +138,7 @@ describe("Function: getAchievementDistribution", () => {
138
138
  it("given a falsy hardcore value, successfully attaches the option to the call", async () => {
139
139
  // ARRANGE
140
140
  const authorization = buildAuthorization({
141
- userName: "mockUserName",
141
+ username: "mockUserName",
142
142
  webApiKey: "mockWebApiKey",
143
143
  });
144
144
 
@@ -11,7 +11,7 @@ import type {
11
11
  * of the number of players who have earned a specific
12
12
  * number of achievements for a given game ID.
13
13
  *
14
- * @param authorization An object containing your userName and webApiKey.
14
+ * @param authorization An object containing your username and webApiKey.
15
15
  * This can be constructed with `buildAuthorization()`.
16
16
  *
17
17
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -24,7 +24,7 @@ describe("Function: getGame", () => {
24
24
  it("given a game ID, retrieves basic metadata about the game", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -12,7 +12,7 @@ import type { Game, GetGameResponse } from "./models";
12
12
  * A call to this function will retrieve basic metadata about
13
13
  * a game, targeted via its unique ID.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
18
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -24,7 +24,7 @@ describe("Function: getGameExtended", () => {
24
24
  it("given a game ID, retrieves extended metadata about the game", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -12,7 +12,7 @@ import type { GameExtended, GetGameExtendedResponse } from "./models";
12
12
  * A call to this function will retrieve extended metadata
13
13
  * about a game, targeted via its unique ID.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
18
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -73,7 +73,7 @@ import type { GameExtended, GetGameExtendedResponse } from "./models";
73
73
  */
74
74
  export const getGameExtended = async (
75
75
  authorization: AuthObject,
76
- payload: { gameId: ID; isRequestingUnofficialAchievements: boolean }
76
+ payload: { gameId: ID; isRequestingUnofficialAchievements?: boolean }
77
77
  ): Promise<GameExtended> => {
78
78
  const { gameId, isRequestingUnofficialAchievements } = payload;
79
79
 
@@ -24,7 +24,7 @@ describe("Function: getGameRankAndScore", () => {
24
24
  it("given a game ID, retrieves metadata about latest masteries for a game", async () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
- userName: "mockUserName",
27
+ username: "mockUserName",
28
28
  webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
@@ -17,7 +17,7 @@ import type {
17
17
  * points earners for a game. The game is targeted via
18
18
  * its unique ID.
19
19
  *
20
- * @param authorization An object containing your userName and webApiKey.
20
+ * @param authorization An object containing your username and webApiKey.
21
21
  * This can be constructed with `buildAuthorization()`.
22
22
  *
23
23
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -22,7 +22,7 @@ describe("Function: getGameRating", () => {
22
22
  it("given a game ID, retrieves metadata about how users have rated it", async () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
- userName: "mockUserName",
25
+ username: "mockUserName",
26
26
  webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
@@ -12,7 +12,7 @@ import type { GameRating, GetGameRatingResponse } from "./models";
12
12
  * A call to this function will retrieve metadata about
13
13
  * how users have rated the game and its set.
14
14
  *
15
- * @param authorization An object containing your userName and webApiKey.
15
+ * @param authorization An object containing your username and webApiKey.
16
16
  * This can be constructed with `buildAuthorization()`.
17
17
  *
18
18
  * @param payload.gameId The unique game ID. If you are unsure, open the
@@ -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
  }