@retroachievements/api 1.5.0 → 1.5.2

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 (96) hide show
  1. package/dist/api.cjs.map +1 -1
  2. package/dist/api.modern.js.map +1 -1
  3. package/dist/api.module.js.map +1 -1
  4. package/dist/api.umd.js.map +1 -1
  5. package/dist/console/getConsoleIds.d.ts +6 -2
  6. package/dist/console/models/console-id.model.d.ts +1 -0
  7. package/dist/console/models/get-console-ids-response.model.d.ts +1 -0
  8. package/dist/feed/getAchievementOfTheWeek.d.ts +3 -1
  9. package/dist/feed/models/achievement-of-the-week.model.d.ts +2 -0
  10. package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +2 -0
  11. package/dist/user/getAchievementsEarnedBetween.d.ts +2 -1
  12. package/dist/user/getAchievementsEarnedOnDay.d.ts +2 -1
  13. package/dist/user/models/achievement-type.model.d.ts +1 -0
  14. package/dist/user/models/dated-user-achievement.model.d.ts +2 -0
  15. package/dist/user/models/dated-user-achievements-response.model.d.ts +2 -0
  16. package/dist/user/models/index.d.ts +1 -0
  17. package/package.json +2 -4
  18. package/src/__playground.ts +1 -1
  19. package/src/achievement/getAchievementUnlocks.test.ts +10 -10
  20. package/src/achievement/getAchievementUnlocks.ts +3 -3
  21. package/src/console/getConsoleIds.test.ts +42 -10
  22. package/src/console/getConsoleIds.ts +8 -4
  23. package/src/console/getGameList.test.ts +8 -8
  24. package/src/console/getGameList.ts +4 -4
  25. package/src/console/models/console-id.model.ts +1 -0
  26. package/src/console/models/get-console-ids-response.model.ts +5 -1
  27. package/src/feed/getAchievementOfTheWeek.test.ts +40 -25
  28. package/src/feed/getAchievementOfTheWeek.ts +7 -5
  29. package/src/feed/getActiveClaims.test.ts +5 -5
  30. package/src/feed/getActiveClaims.ts +2 -2
  31. package/src/feed/getClaims.test.ts +5 -5
  32. package/src/feed/getClaims.ts +4 -4
  33. package/src/feed/getTopTenUsers.test.ts +12 -12
  34. package/src/feed/getTopTenUsers.ts +2 -2
  35. package/src/feed/models/achievement-of-the-week.model.ts +2 -0
  36. package/src/feed/models/claim-set-type.enum.ts +1 -1
  37. package/src/feed/models/claim-status.enum.ts +1 -1
  38. package/src/feed/models/claim-type.enum.ts +1 -1
  39. package/src/feed/models/get-achievement-of-the-week-response.model.ts +2 -0
  40. package/src/game/getAchievementCount.test.ts +3 -3
  41. package/src/game/getAchievementCount.ts +1 -1
  42. package/src/game/getAchievementDistribution.test.ts +12 -12
  43. package/src/game/getAchievementDistribution.ts +2 -2
  44. package/src/game/getGame.test.ts +3 -3
  45. package/src/game/getGame.ts +3 -3
  46. package/src/game/getGameExtended.test.ts +7 -7
  47. package/src/game/getGameExtended.ts +4 -4
  48. package/src/game/getGameRankAndScore.test.ts +6 -6
  49. package/src/game/getGameRankAndScore.ts +4 -4
  50. package/src/game/getGameRating.test.ts +5 -5
  51. package/src/game/getGameRating.ts +1 -1
  52. package/src/game/models/achievement-distribution-flags.enum.ts +1 -1
  53. package/src/game/models/get-game-extended-response.model.ts +1 -1
  54. package/src/ticket/getTicketData.test.ts +31 -31
  55. package/src/ticket/getTicketData.ts +5 -5
  56. package/src/user/getAchievementsEarnedBetween.test.ts +17 -10
  57. package/src/user/getAchievementsEarnedBetween.ts +6 -5
  58. package/src/user/getAchievementsEarnedOnDay.test.ts +17 -10
  59. package/src/user/getAchievementsEarnedOnDay.ts +6 -5
  60. package/src/user/getGameInfoAndUserProgress.test.ts +8 -8
  61. package/src/user/getGameInfoAndUserProgress.ts +5 -5
  62. package/src/user/getUserAwards.test.ts +7 -7
  63. package/src/user/getUserAwards.ts +1 -1
  64. package/src/user/getUserClaims.test.ts +6 -6
  65. package/src/user/getUserClaims.ts +3 -3
  66. package/src/user/getUserCompletedGames.test.ts +8 -8
  67. package/src/user/getUserCompletedGames.ts +4 -4
  68. package/src/user/getUserCompletionProgress.test.ts +8 -8
  69. package/src/user/getUserCompletionProgress.ts +3 -3
  70. package/src/user/getUserGameRankAndScore.test.ts +6 -6
  71. package/src/user/getUserGameRankAndScore.ts +3 -3
  72. package/src/user/getUserPoints.test.ts +3 -3
  73. package/src/user/getUserPoints.ts +1 -1
  74. package/src/user/getUserProfile.test.ts +4 -4
  75. package/src/user/getUserProfile.ts +3 -3
  76. package/src/user/getUserProgress.test.ts +8 -8
  77. package/src/user/getUserProgress.ts +3 -3
  78. package/src/user/getUserRecentAchievements.test.ts +6 -6
  79. package/src/user/getUserRecentAchievements.ts +3 -3
  80. package/src/user/getUserRecentlyPlayedGames.test.ts +6 -6
  81. package/src/user/getUserRecentlyPlayedGames.ts +4 -4
  82. package/src/user/getUserSummary.test.ts +27 -27
  83. package/src/user/getUserSummary.ts +4 -4
  84. package/src/user/models/achievement-type.model.ts +5 -0
  85. package/src/user/models/dated-user-achievement.model.ts +3 -0
  86. package/src/user/models/dated-user-achievements-response.model.ts +3 -0
  87. package/src/user/models/game-info-and-user-progress.model.ts +1 -1
  88. package/src/user/models/get-game-info-and-user-progress-response.model.ts +1 -1
  89. package/src/user/models/index.ts +1 -0
  90. package/src/utils/internal/buildRequestUrl.test.ts +2 -2
  91. package/src/utils/internal/buildRequestUrl.ts +1 -1
  92. package/src/utils/internal/call.test.ts +1 -1
  93. package/src/utils/internal/call.ts +1 -1
  94. package/src/utils/internal/serializeProperties.test.ts +20 -20
  95. package/src/utils/internal/serializeProperties.ts +1 -1
  96. package/src/utils/public/buildAuthorization.test.ts +1 -1
@@ -23,7 +23,7 @@ describe("Function: getAchievementUnlocks", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetAchievementUnlocksResponse = {
@@ -35,7 +35,7 @@ describe("Function: getAchievementUnlocks", () => {
35
35
  TrueRatio: "6",
36
36
  Author: "Scott",
37
37
  DateCreated: "2012-11-02 00:03:12",
38
- DateModified: "2022-06-11 16:52:35"
38
+ DateModified: "2022-06-11 16:52:35",
39
39
  },
40
40
  Console: { ID: "1", Title: "Mega Drive" },
41
41
  Game: { ID: "1", Title: "Sonic the Hedgehog" },
@@ -46,9 +46,9 @@ describe("Function: getAchievementUnlocks", () => {
46
46
  User: "Tiotroll2022",
47
47
  RAPoints: "348",
48
48
  DateAwarded: "2023-01-29 21:45:41",
49
- HardcoreMode: "0"
50
- }
51
- ]
49
+ HardcoreMode: "0",
50
+ },
51
+ ],
52
52
  };
53
53
 
54
54
  let requestUrl = "";
@@ -64,7 +64,7 @@ describe("Function: getAchievementUnlocks", () => {
64
64
  const response = await getAchievementUnlocks(authorization, {
65
65
  achievementId: 18_000,
66
66
  count: 1,
67
- offset: 1
67
+ offset: 1,
68
68
  });
69
69
 
70
70
  // ASSERT
@@ -81,7 +81,7 @@ describe("Function: getAchievementUnlocks", () => {
81
81
  trueRatio: 6,
82
82
  author: "Scott",
83
83
  dateCreated: "2012-11-02 00:03:12",
84
- dateModified: "2022-06-11 16:52:35"
84
+ dateModified: "2022-06-11 16:52:35",
85
85
  },
86
86
  console: { id: 1, title: "Mega Drive" },
87
87
  game: { id: 1, title: "Sonic the Hedgehog" },
@@ -92,9 +92,9 @@ describe("Function: getAchievementUnlocks", () => {
92
92
  user: "Tiotroll2022",
93
93
  raPoints: 348,
94
94
  dateAwarded: "2023-01-29 21:45:41",
95
- hardcoreMode: false
96
- }
97
- ]
95
+ hardcoreMode: false,
96
+ },
97
+ ],
98
98
  });
99
99
  });
100
100
  });
@@ -3,12 +3,12 @@ import {
3
3
  apiBaseUrl,
4
4
  buildRequestUrl,
5
5
  call,
6
- serializeProperties
6
+ serializeProperties,
7
7
  } from "../utils/internal";
8
8
  import type { AuthObject } from "../utils/public";
9
9
  import type {
10
10
  AchievementUnlocksMetadata,
11
- GetAchievementUnlocksResponse
11
+ GetAchievementUnlocksResponse,
12
12
  } from "./models";
13
13
 
14
14
  /**
@@ -76,6 +76,6 @@ export const getAchievementUnlocks = async (
76
76
 
77
77
  return serializeProperties(rawResponse, {
78
78
  shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"],
79
- shouldMapToBooleans: ["HardcoreMode"]
79
+ shouldMapToBooleans: ["HardcoreMode"],
80
80
  });
81
81
  };
@@ -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 { GetConsoleIdsResponse } from "./models";
9
+ import type { ConsoleId, GetConsoleIdsResponse } from "./models";
10
10
 
11
11
  const server = setupServer();
12
12
 
@@ -25,13 +25,28 @@ describe("Function: getConsoleIds", () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
27
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
28
+ webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
31
31
  const mockResponse: GetConsoleIdsResponse = [
32
- { ID: "1", Name: "Mega Drive" },
33
- { ID: "2", Name: "Nintendo 64" },
34
- { ID: "3", Name: "SNES" }
32
+ {
33
+ ID: "1",
34
+ Name: "Mega Drive",
35
+ IconURL:
36
+ "https://static.retroachievements.org/assets/images/system/md.png",
37
+ },
38
+ {
39
+ ID: "2",
40
+ Name: "Nintendo 64",
41
+ IconURL:
42
+ "https://static.retroachievements.org/assets/images/system/n64.png",
43
+ },
44
+ {
45
+ ID: "3",
46
+ Name: "SNES",
47
+ IconURL:
48
+ "https://static.retroachievements.org/assets/images/system/snes.png",
49
+ },
35
50
  ];
36
51
 
37
52
  server.use(
@@ -44,10 +59,27 @@ describe("Function: getConsoleIds", () => {
44
59
  const response = await getConsoleIds(authorization);
45
60
 
46
61
  // ASSERT
47
- expect(response).toEqual([
48
- { id: 1, name: "Mega Drive" },
49
- { id: 2, name: "Nintendo 64" },
50
- { id: 3, name: "SNES" }
51
- ]);
62
+ const expectedResponse: ConsoleId[] = [
63
+ {
64
+ id: 1,
65
+ name: "Mega Drive",
66
+ iconUrl:
67
+ "https://static.retroachievements.org/assets/images/system/md.png",
68
+ },
69
+ {
70
+ id: 2,
71
+ name: "Nintendo 64",
72
+ iconUrl:
73
+ "https://static.retroachievements.org/assets/images/system/n64.png",
74
+ },
75
+ {
76
+ id: 3,
77
+ name: "SNES",
78
+ iconUrl:
79
+ "https://static.retroachievements.org/assets/images/system/snes.png",
80
+ },
81
+ ];
82
+
83
+ expect(response).toEqual(expectedResponse);
52
84
  });
53
85
  });
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { ConsoleId, GetConsoleIdsResponse } from "./models";
@@ -22,8 +22,12 @@ import type { ConsoleId, GetConsoleIdsResponse } from "./models";
22
22
  *
23
23
  * @returns An array containing a complete list of console ID
24
24
  * and name pairs for RetroAchievements.org.
25
- * ```
26
- * { id: "1", name: "Mega Drive" }
25
+ * ```json
26
+ * {
27
+ * id: "1",
28
+ * name: "Mega Drive",
29
+ * iconUrl: "https://static.retroachievements.org/assets/images/system/md.png"
30
+ * }
27
31
  * ```
28
32
  */
29
33
  export const getConsoleIds = async (
@@ -38,6 +42,6 @@ export const getConsoleIds = async (
38
42
  const rawResponse = await call<GetConsoleIdsResponse>({ url });
39
43
 
40
44
  return serializeProperties(rawResponse, {
41
- shouldCastToNumbers: ["ID"]
45
+ shouldCastToNumbers: ["ID"],
42
46
  });
43
47
  };
@@ -25,7 +25,7 @@ describe("Function: getGameList", () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
27
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
28
+ webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
31
31
  const mockResponse: GetGameListResponse = [
@@ -42,9 +42,9 @@ describe("Function: getGameList", () => {
42
42
  ForumTopicID: 1972,
43
43
  Hashes: [
44
44
  "32e1a15161ef1f070b023738353bde51",
45
- "9b04970a603ace521c7cca2acaf69804"
46
- ]
47
- }
45
+ "9b04970a603ace521c7cca2acaf69804",
46
+ ],
47
+ },
48
48
  ];
49
49
 
50
50
  server.use(
@@ -56,7 +56,7 @@ describe("Function: getGameList", () => {
56
56
  // ACT
57
57
  const response = await getGameList(authorization, {
58
58
  consoleId: 1,
59
- shouldRetrieveGameHashes: true
59
+ shouldRetrieveGameHashes: true,
60
60
  });
61
61
 
62
62
  // ASSERT
@@ -74,9 +74,9 @@ describe("Function: getGameList", () => {
74
74
  forumTopicId: 1972,
75
75
  hashes: [
76
76
  "32e1a15161ef1f070b023738353bde51",
77
- "9b04970a603ace521c7cca2acaf69804"
78
- ]
79
- }
77
+ "9b04970a603ace521c7cca2acaf69804",
78
+ ],
79
+ },
80
80
  ]);
81
81
  });
82
82
  });
@@ -3,7 +3,7 @@ import {
3
3
  apiBaseUrl,
4
4
  buildRequestUrl,
5
5
  call,
6
- serializeProperties
6
+ serializeProperties,
7
7
  } from "../utils/internal";
8
8
  import type { AuthObject } from "../utils/public";
9
9
  import type { GameList, GetGameListResponse } from "./models";
@@ -63,7 +63,7 @@ export const getGameList = async (
63
63
  const {
64
64
  consoleId,
65
65
  shouldOnlyRetrieveGamesWithAchievements,
66
- shouldRetrieveGameHashes
66
+ shouldRetrieveGameHashes,
67
67
  } = payload;
68
68
 
69
69
  let callPayload: Record<string, any> = { i: consoleId };
@@ -71,7 +71,7 @@ export const getGameList = async (
71
71
  if (shouldOnlyRetrieveGamesWithAchievements !== undefined) {
72
72
  callPayload = {
73
73
  ...callPayload,
74
- f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0
74
+ f: shouldOnlyRetrieveGamesWithAchievements ? 1 : 0,
75
75
  };
76
76
  }
77
77
 
@@ -89,6 +89,6 @@ export const getGameList = async (
89
89
  const rawResponse = await call<GetGameListResponse>({ url });
90
90
 
91
91
  return serializeProperties(rawResponse, {
92
- shouldCastToNumbers: ["ID", "ConsoleID"]
92
+ shouldCastToNumbers: ["ID", "ConsoleID"],
93
93
  });
94
94
  };
@@ -1,4 +1,5 @@
1
1
  export interface ConsoleId {
2
2
  id: number;
3
3
  name: string;
4
+ iconUrl: string;
4
5
  }
@@ -1 +1,5 @@
1
- export type GetConsoleIdsResponse = readonly { ID: string; Name: string }[];
1
+ export type GetConsoleIdsResponse = readonly {
2
+ ID: string;
3
+ Name: string;
4
+ IconURL: string;
5
+ }[];
@@ -6,7 +6,10 @@ import { setupServer } from "msw/node";
6
6
  import { apiBaseUrl } from "../utils/internal";
7
7
  import { buildAuthorization } from "../utils/public";
8
8
  import { getAchievementOfTheWeek } from "./getAchievementOfTheWeek";
9
- import type { GetAchievementOfTheWeekResponse } from "./models";
9
+ import type {
10
+ AchievementOfTheWeek,
11
+ GetAchievementOfTheWeekResponse,
12
+ } from "./models";
10
13
 
11
14
  const server = setupServer();
12
15
 
@@ -25,7 +28,7 @@ describe("Function: getAchievementOfTheWeek", () => {
25
28
  // ARRANGE
26
29
  const authorization = buildAuthorization({
27
30
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
31
+ webApiKey: "mockWebApiKey",
29
32
  });
30
33
 
31
34
  const mockResponse: GetAchievementOfTheWeekResponse = {
@@ -37,7 +40,9 @@ describe("Function: getAchievementOfTheWeek", () => {
37
40
  TrueRatio: "22",
38
41
  Author: "BigWeedSmokerMan",
39
42
  DateCreated: "2021-08-08 17:47:46",
40
- DateModified: "2021-08-09 12:20:05"
43
+ DateModified: "2021-08-09 12:20:05",
44
+ BadgeName: "185805",
45
+ BadgeURL: "/Badge/185805.png",
41
46
  },
42
47
  Console: { ID: "39", Title: "Saturn" },
43
48
  ForumTopic: { ID: "14767" },
@@ -49,10 +54,10 @@ describe("Function: getAchievementOfTheWeek", () => {
49
54
  User: "Tirbaba2",
50
55
  RAPoints: "72",
51
56
  DateAwarded: "2022-10-10 01:42:19",
52
- HardcoreMode: "1"
53
- }
57
+ HardcoreMode: "1",
58
+ },
54
59
  ],
55
- UnlocksCount: "40"
60
+ UnlocksCount: "40",
56
61
  };
57
62
 
58
63
  server.use(
@@ -64,8 +69,7 @@ describe("Function: getAchievementOfTheWeek", () => {
64
69
  // ACT
65
70
  const response = await getAchievementOfTheWeek(authorization);
66
71
 
67
- // ASSERT
68
- expect(response).toEqual({
72
+ const expectedResponse: AchievementOfTheWeek = {
69
73
  achievement: {
70
74
  id: 165_062,
71
75
  title: "The True Hero",
@@ -74,7 +78,9 @@ describe("Function: getAchievementOfTheWeek", () => {
74
78
  trueRatio: 22,
75
79
  author: "BigWeedSmokerMan",
76
80
  dateCreated: "2021-08-08 17:47:46",
77
- dateModified: "2021-08-09 12:20:05"
81
+ dateModified: "2021-08-09 12:20:05",
82
+ badgeName: "185805",
83
+ badgeUrl: "/Badge/185805.png",
78
84
  },
79
85
  console: { id: 39, title: "Saturn" },
80
86
  forumTopic: { id: 14_767 },
@@ -86,18 +92,21 @@ describe("Function: getAchievementOfTheWeek", () => {
86
92
  user: "Tirbaba2",
87
93
  raPoints: 72,
88
94
  dateAwarded: "2022-10-10 01:42:19",
89
- hardcoreMode: true
90
- }
95
+ hardcoreMode: true,
96
+ },
91
97
  ],
92
- unlocksCount: 40
93
- });
98
+ unlocksCount: 40,
99
+ };
100
+
101
+ // ASSERT
102
+ expect(response).toEqual(expectedResponse);
94
103
  });
95
104
 
96
105
  it("properly sets the hardcore boolean value when cleaning properties", async () => {
97
106
  // ARRANGE
98
107
  const authorization = buildAuthorization({
99
108
  userName: "mockUserName",
100
- webApiKey: "mockWebApiKey"
109
+ webApiKey: "mockWebApiKey",
101
110
  });
102
111
 
103
112
  const mockResponse: GetAchievementOfTheWeekResponse = {
@@ -109,7 +118,9 @@ describe("Function: getAchievementOfTheWeek", () => {
109
118
  TrueRatio: "22",
110
119
  Author: "BigWeedSmokerMan",
111
120
  DateCreated: "2021-08-08 17:47:46",
112
- DateModified: "2021-08-09 12:20:05"
121
+ DateModified: "2021-08-09 12:20:05",
122
+ BadgeName: "185805",
123
+ BadgeURL: "/Badge/185805.png",
113
124
  },
114
125
  Console: { ID: "39", Title: "Saturn" },
115
126
  ForumTopic: { ID: "14767" },
@@ -121,10 +132,10 @@ describe("Function: getAchievementOfTheWeek", () => {
121
132
  User: "Tirbaba2",
122
133
  RAPoints: "72",
123
134
  DateAwarded: "2022-10-10 01:42:19",
124
- HardcoreMode: "0"
125
- }
135
+ HardcoreMode: "0",
136
+ },
126
137
  ],
127
- UnlocksCount: "40"
138
+ UnlocksCount: "40",
128
139
  };
129
140
 
130
141
  server.use(
@@ -136,8 +147,7 @@ describe("Function: getAchievementOfTheWeek", () => {
136
147
  // ACT
137
148
  const response = await getAchievementOfTheWeek(authorization);
138
149
 
139
- // ASSERT
140
- expect(response).toEqual({
150
+ const expectedResponse: AchievementOfTheWeek = {
141
151
  achievement: {
142
152
  id: 165_062,
143
153
  title: "The True Hero",
@@ -146,7 +156,9 @@ describe("Function: getAchievementOfTheWeek", () => {
146
156
  trueRatio: 22,
147
157
  author: "BigWeedSmokerMan",
148
158
  dateCreated: "2021-08-08 17:47:46",
149
- dateModified: "2021-08-09 12:20:05"
159
+ dateModified: "2021-08-09 12:20:05",
160
+ badgeName: "185805",
161
+ badgeUrl: "/Badge/185805.png",
150
162
  },
151
163
  console: { id: 39, title: "Saturn" },
152
164
  forumTopic: { id: 14_767 },
@@ -158,10 +170,13 @@ describe("Function: getAchievementOfTheWeek", () => {
158
170
  user: "Tirbaba2",
159
171
  raPoints: 72,
160
172
  dateAwarded: "2022-10-10 01:42:19",
161
- hardcoreMode: false
162
- }
173
+ hardcoreMode: false,
174
+ },
163
175
  ],
164
- unlocksCount: 40
165
- });
176
+ unlocksCount: 40,
177
+ };
178
+
179
+ // ASSERT
180
+ expect(response).toEqual(expectedResponse);
166
181
  });
167
182
  });
@@ -2,12 +2,12 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type {
9
9
  AchievementOfTheWeek,
10
- GetAchievementOfTheWeekResponse
10
+ GetAchievementOfTheWeekResponse,
11
11
  } from "./models";
12
12
 
13
13
  /**
@@ -36,7 +36,9 @@ import type {
36
36
  * trueRatio: "22",
37
37
  * author: "BigWeedSmokerMan",
38
38
  * dateCreated: "2021-08-08 17:47:46",
39
- * dateModified: "2021-08-09 12:20:05"
39
+ * dateModified: "2021-08-09 12:20:05",
40
+ * badgeName: "185805",
41
+ * badgeUrl: "/Badge/185805.png"
40
42
  * },
41
43
  * console: { id: "39", title: "Saturn" },
42
44
  * forumTopic: { id: "14767" },
@@ -73,8 +75,8 @@ export const getAchievementOfTheWeek = async (
73
75
  "TrueRatio",
74
76
  "TotalPlayers",
75
77
  "RAPoints",
76
- "UnlocksCount"
78
+ "UnlocksCount",
77
79
  ],
78
- shouldMapToBooleans: ["HardcoreMode"]
80
+ shouldMapToBooleans: ["HardcoreMode"],
79
81
  });
80
82
  };
@@ -25,7 +25,7 @@ describe("Function: getActiveClaims", () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
27
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
28
+ webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
31
31
  const mockResponse: GetSetClaimsResponse = [
@@ -46,8 +46,8 @@ describe("Function: getActiveClaims", () => {
46
46
  DoneTime: "2023-01-03 20:29:45",
47
47
  Updated: "2022-10-03 20:29:45",
48
48
  MinutesLeft: 112_285,
49
- UserIsJrDev: 1
50
- }
49
+ UserIsJrDev: 1,
50
+ },
51
51
  ];
52
52
 
53
53
  server.use(
@@ -78,8 +78,8 @@ describe("Function: getActiveClaims", () => {
78
78
  doneTime: "2023-01-03 20:29:45",
79
79
  updated: "2022-10-03 20:29:45",
80
80
  minutesLeft: 112_285,
81
- userIsJrDev: true
82
- }
81
+ userIsJrDev: true,
82
+ },
83
83
  ]);
84
84
  });
85
85
  });
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { GetSetClaimsResponse, SetClaim } from "./models";
@@ -56,6 +56,6 @@ export const getActiveClaims = async (
56
56
  const rawResponse = await call<GetSetClaimsResponse>({ url });
57
57
 
58
58
  return serializeProperties(rawResponse, {
59
- shouldMapToBooleans: ["UserIsJrDev"]
59
+ shouldMapToBooleans: ["UserIsJrDev"],
60
60
  });
61
61
  };
@@ -25,7 +25,7 @@ describe("Function: getClaims", () => {
25
25
  // ARRANGE
26
26
  const authorization = buildAuthorization({
27
27
  userName: "mockUserName",
28
- webApiKey: "mockWebApiKey"
28
+ webApiKey: "mockWebApiKey",
29
29
  });
30
30
 
31
31
  const mockResponse: GetSetClaimsResponse = [
@@ -46,8 +46,8 @@ describe("Function: getClaims", () => {
46
46
  DoneTime: "2023-01-03 20:29:45",
47
47
  Updated: "2022-10-03 20:29:45",
48
48
  MinutesLeft: 112_285,
49
- UserIsJrDev: 1
50
- }
49
+ UserIsJrDev: 1,
50
+ },
51
51
  ];
52
52
 
53
53
  server.use(
@@ -78,8 +78,8 @@ describe("Function: getClaims", () => {
78
78
  doneTime: "2023-01-03 20:29:45",
79
79
  updated: "2022-10-03 20:29:45",
80
80
  minutesLeft: 112_285,
81
- userIsJrDev: true
82
- }
81
+ userIsJrDev: true,
82
+ },
83
83
  ]);
84
84
  });
85
85
  });
@@ -2,7 +2,7 @@ import {
2
2
  apiBaseUrl,
3
3
  buildRequestUrl,
4
4
  call,
5
- serializeProperties
5
+ serializeProperties,
6
6
  } from "../utils/internal";
7
7
  import type { AuthObject } from "../utils/public";
8
8
  import type { GetSetClaimsResponse, SetClaim } from "./models";
@@ -16,18 +16,18 @@ export const getClaims = async (
16
16
  const { claimKind } = payload;
17
17
 
18
18
  const url = buildRequestUrl(apiBaseUrl, "/API_GetClaims.php", authorization, {
19
- k: claimKindValueMap[claimKind]
19
+ k: claimKindValueMap[claimKind],
20
20
  });
21
21
 
22
22
  const rawResponse = await call<GetSetClaimsResponse>({ url });
23
23
 
24
24
  return serializeProperties(rawResponse, {
25
- shouldMapToBooleans: ["UserIsJrDev"]
25
+ shouldMapToBooleans: ["UserIsJrDev"],
26
26
  });
27
27
  };
28
28
 
29
29
  const claimKindValueMap: Record<ClaimKind, `${number}`> = {
30
30
  completed: "1",
31
31
  dropped: "2",
32
- expired: "3"
32
+ expired: "3",
33
33
  };
@@ -23,7 +23,7 @@ describe("Function: getTopTenUsers", () => {
23
23
  // ARRANGE
24
24
  const authorization = buildAuthorization({
25
25
  userName: "mockUserName",
26
- webApiKey: "mockWebApiKey"
26
+ webApiKey: "mockWebApiKey",
27
27
  });
28
28
 
29
29
  const mockResponse: GetTopTenUsersResponse = [
@@ -36,7 +36,7 @@ describe("Function: getTopTenUsers", () => {
36
36
  { "1": "donutweegee", "2": "204701", "3": "587221" },
37
37
  { "1": "AmericanNinja", "2": "202980", "3": "567618" },
38
38
  { "1": "Infernum", "2": "202171", "3": "689967" },
39
- { "1": "FabricioPrie", "2": "196974", "3": "450436" }
39
+ { "1": "FabricioPrie", "2": "196974", "3": "450436" },
40
40
  ];
41
41
 
42
42
  server.use(
@@ -53,49 +53,49 @@ describe("Function: getTopTenUsers", () => {
53
53
  {
54
54
  userName: "MaxMilyin",
55
55
  totalPoints: 346_289,
56
- totalRatioPoints: 995_092
56
+ totalRatioPoints: 995_092,
57
57
  },
58
58
  {
59
59
  userName: "HippopotamusRex",
60
60
  totalPoints: 312_118,
61
- totalRatioPoints: 1_151_351
61
+ totalRatioPoints: 1_151_351,
62
62
  },
63
63
  {
64
64
  userName: "Sarconius",
65
65
  totalPoints: 257_862,
66
- totalRatioPoints: 1_181_770
66
+ totalRatioPoints: 1_181_770,
67
67
  },
68
68
  { userName: "guineu", totalPoints: 241_623, totalRatioPoints: 672_597 },
69
69
  {
70
70
  userName: "Andrey199650",
71
71
  totalPoints: 240_101,
72
- totalRatioPoints: 567_522
72
+ totalRatioPoints: 567_522,
73
73
  },
74
74
  {
75
75
  userName: "Wendigo",
76
76
  totalPoints: 227_903,
77
- totalRatioPoints: 1_099_685
77
+ totalRatioPoints: 1_099_685,
78
78
  },
79
79
  {
80
80
  userName: "donutweegee",
81
81
  totalPoints: 204_701,
82
- totalRatioPoints: 587_221
82
+ totalRatioPoints: 587_221,
83
83
  },
84
84
  {
85
85
  userName: "AmericanNinja",
86
86
  totalPoints: 202_980,
87
- totalRatioPoints: 567_618
87
+ totalRatioPoints: 567_618,
88
88
  },
89
89
  {
90
90
  userName: "Infernum",
91
91
  totalPoints: 202_171,
92
- totalRatioPoints: 689_967
92
+ totalRatioPoints: 689_967,
93
93
  },
94
94
  {
95
95
  userName: "FabricioPrie",
96
96
  totalPoints: 196_974,
97
- totalRatioPoints: 450_436
98
- }
97
+ totalRatioPoints: 450_436,
98
+ },
99
99
  ]);
100
100
  });
101
101
  });
@@ -3,7 +3,7 @@ import type { AuthObject } from "../utils/public";
3
3
  import type {
4
4
  GetTopTenUsersResponse,
5
5
  TopTenUsers,
6
- TopTenUsersEntity
6
+ TopTenUsersEntity,
7
7
  } from "./models";
8
8
 
9
9
  /**
@@ -43,7 +43,7 @@ export const getTopTenUsers = async (
43
43
  sanitizedTopTenUsers.push({
44
44
  userName: rawUser["1"],
45
45
  totalPoints: Number(rawUser["2"]),
46
- totalRatioPoints: Number(rawUser["3"])
46
+ totalRatioPoints: Number(rawUser["3"]),
47
47
  });
48
48
  }
49
49