@retroachievements/api 2.1.0 → 2.3.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 (50) hide show
  1. package/README.md +7 -5
  2. package/dist/achievement/models/achievement-unlock-entity.model.d.ts +1 -0
  3. package/dist/achievement/models/get-achievement-unlocks-response.model.d.ts +1 -0
  4. package/dist/api.cjs +1 -1
  5. package/dist/api.cjs.map +1 -1
  6. package/dist/api.modern.js +1 -1
  7. package/dist/api.modern.js.map +1 -1
  8. package/dist/api.module.js +1 -1
  9. package/dist/api.module.js.map +1 -1
  10. package/dist/api.umd.js +1 -1
  11. package/dist/api.umd.js.map +1 -1
  12. package/dist/feed/getAchievementOfTheWeek.d.ts +2 -1
  13. package/dist/feed/models/achievement-of-the-week.model.d.ts +1 -0
  14. package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +1 -0
  15. package/dist/game/getGameHashes.d.ts +45 -0
  16. package/dist/game/getGameHashes.test.d.ts +1 -0
  17. package/dist/game/index.d.ts +1 -0
  18. package/dist/game/models/game-hashes.model.d.ts +10 -0
  19. package/dist/game/models/get-game-hashes-response.model.d.ts +10 -0
  20. package/dist/game/models/index.d.ts +2 -0
  21. package/dist/user/getUserWantToPlayList.d.ts +47 -0
  22. package/dist/user/getUserWantToPlayList.test.d.ts +1 -0
  23. package/dist/user/index.d.ts +1 -0
  24. package/dist/user/models/get-user-want-to-play-list-response.model.d.ts +13 -0
  25. package/dist/user/models/index.d.ts +2 -0
  26. package/dist/user/models/user-want-to-play-list.model.d.ts +13 -0
  27. package/package.json +1 -1
  28. package/src/achievement/getAchievementUnlocks.test.ts +2 -0
  29. package/src/achievement/getAchievementUnlocks.ts +7 -1
  30. package/src/achievement/models/achievement-unlock-entity.model.ts +1 -0
  31. package/src/achievement/models/get-achievement-unlocks-response.model.ts +1 -0
  32. package/src/console/getConsoleIds.test.ts +4 -1
  33. package/src/feed/getAchievementOfTheWeek.test.ts +4 -0
  34. package/src/feed/getAchievementOfTheWeek.ts +3 -1
  35. package/src/feed/getRecentGameAwards.test.ts +6 -1
  36. package/src/feed/models/achievement-of-the-week.model.ts +1 -0
  37. package/src/feed/models/get-achievement-of-the-week-response.model.ts +1 -0
  38. package/src/game/getGameExtended.test.ts +4 -1
  39. package/src/game/getGameHashes.test.ts +77 -0
  40. package/src/game/getGameHashes.ts +66 -0
  41. package/src/game/index.ts +1 -0
  42. package/src/game/models/game-hashes.model.ts +10 -0
  43. package/src/game/models/get-game-hashes-response.model.ts +10 -0
  44. package/src/game/models/index.ts +2 -0
  45. package/src/user/getUserWantToPlayList.test.ts +75 -0
  46. package/src/user/getUserWantToPlayList.ts +76 -0
  47. package/src/user/index.ts +1 -0
  48. package/src/user/models/get-user-want-to-play-list-response.model.ts +13 -0
  49. package/src/user/models/index.ts +2 -0
  50. package/src/user/models/user-want-to-play-list.model.ts +13 -0
@@ -0,0 +1,47 @@
1
+ import type { AuthObject } from "../utils/public";
2
+ import type { UserWantToPlayList } from "./models";
3
+ /**
4
+ * A call to this function will retrieve a user's "Want to Play Games" list.
5
+ *
6
+ * @param authorization An object containing your username and webApiKey.
7
+ * This can be constructed with `buildAuthorization()`.
8
+ *
9
+ * @param payload.username The user for which to retrieve the
10
+ * want to play games list for.
11
+ *
12
+ * @param payload.offset Defaults to 0. The number of entries to skip.
13
+ *
14
+ * @param payload.count Defaults to 100, has a max of 500.
15
+ *
16
+ * @example
17
+ * ```
18
+ * const wantToPlayList = await getUserWantToPlayList(
19
+ * authorization,
20
+ * { username: "wv_pinball" }
21
+ * );
22
+ * ```
23
+ *
24
+ * @returns An object containing a user's list of "Want to Play Games".
25
+ * ```json
26
+ * {
27
+ * "count": 100,
28
+ * "total": 1287,
29
+ * "results": [
30
+ * {
31
+ * "id": 20246,
32
+ * "title": "~Hack~ Knuckles the Echidna in Sonic the Hedgehog",
33
+ * "imageIcon": "/Images/074560.png",
34
+ * "consoleID": 1,
35
+ * "consoleName": "Genesis/Mega Drive",
36
+ * "pointsTotal": 1500,
37
+ * "achievementsPublished": 50
38
+ * }
39
+ * ]
40
+ * }
41
+ * ```
42
+ */
43
+ export declare const getUserWantToPlayList: (authorization: AuthObject, payload: {
44
+ username: string;
45
+ offset?: number;
46
+ count?: number;
47
+ }) => Promise<UserWantToPlayList>;
@@ -0,0 +1 @@
1
+ export {};
@@ -12,4 +12,5 @@ export * from "./getUserProgress";
12
12
  export * from "./getUserRecentAchievements";
13
13
  export * from "./getUserRecentlyPlayedGames";
14
14
  export * from "./getUserSummary";
15
+ export * from "./getUserWantToPlayList";
15
16
  export * from "./models";
@@ -0,0 +1,13 @@
1
+ export interface GetUserWantToPlayListResponse {
2
+ Count: number;
3
+ Total: number;
4
+ Results: Array<{
5
+ ID: number;
6
+ Title: string;
7
+ ImageIcon: string;
8
+ ConsoleID: number;
9
+ ConsoleName: string;
10
+ PointsTotal: number;
11
+ AchievementsPublished: number;
12
+ }>;
13
+ }
@@ -13,6 +13,7 @@ export * from "./get-user-progress-response.model";
13
13
  export * from "./get-user-recent-achievements-response.model";
14
14
  export * from "./get-user-recently-played-games-response.model";
15
15
  export * from "./get-user-summary-response.model";
16
+ export * from "./get-user-want-to-play-list-response.model";
16
17
  export * from "./user-awards.model";
17
18
  export * from "./user-claims.model";
18
19
  export * from "./user-claims-response.model";
@@ -26,3 +27,4 @@ export * from "./user-progress.model";
26
27
  export * from "./user-recent-achievement.model";
27
28
  export * from "./user-recently-played-games.model";
28
29
  export * from "./user-summary.model";
30
+ export * from "./user-want-to-play-list.model";
@@ -0,0 +1,13 @@
1
+ export interface UserWantToPlayList {
2
+ count: number;
3
+ total: number;
4
+ results: Array<{
5
+ id: number;
6
+ title: string;
7
+ imageIcon: string;
8
+ consoleId: number;
9
+ consoleName: string;
10
+ pointsTotal: number;
11
+ achievementsPublished: number;
12
+ }>;
13
+ }
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "raweb",
11
11
  "retro gaming"
12
12
  ],
13
- "version": "2.1.0",
13
+ "version": "2.3.0",
14
14
  "typings": "dist/index.d.ts",
15
15
  "exports": {
16
16
  ".": {
@@ -45,6 +45,7 @@ describe("Function: getAchievementUnlocks", () => {
45
45
  {
46
46
  User: "Tiotroll2022",
47
47
  RAPoints: "348",
48
+ RASoftcorePoints: "363",
48
49
  DateAwarded: "2023-01-29 21:45:41",
49
50
  HardcoreMode: "0",
50
51
  },
@@ -91,6 +92,7 @@ describe("Function: getAchievementUnlocks", () => {
91
92
  {
92
93
  user: "Tiotroll2022",
93
94
  raPoints: 348,
95
+ raSoftcorePoints: 363,
94
96
  dateAwarded: "2023-01-29 21:45:41",
95
97
  hardcoreMode: false,
96
98
  },
@@ -75,7 +75,13 @@ export const getAchievementUnlocks = async (
75
75
  const rawResponse = await call<GetAchievementUnlocksResponse>({ url });
76
76
 
77
77
  return serializeProperties(rawResponse, {
78
- shouldCastToNumbers: ["ID", "Points", "TrueRatio", "RAPoints"],
78
+ shouldCastToNumbers: [
79
+ "ID",
80
+ "Points",
81
+ "TrueRatio",
82
+ "RAPoints",
83
+ "RASoftcorePoints",
84
+ ],
79
85
  shouldMapToBooleans: ["HardcoreMode"],
80
86
  });
81
87
  };
@@ -1,6 +1,7 @@
1
1
  export interface AchievementUnlockEntity {
2
2
  user: string;
3
3
  raPoints: number;
4
+ raSoftcorePoints: number;
4
5
  dateAwarded: string;
5
6
  hardcoreMode: boolean;
6
7
  }
@@ -1,6 +1,7 @@
1
1
  interface AchievementUnlocksResponseEntity {
2
2
  User: string;
3
3
  RAPoints: string;
4
+ RASoftcorePoints: string;
4
5
  DateAwarded: string;
5
6
  HardcoreMode: string;
6
7
  }
@@ -62,7 +62,10 @@ describe("Function: getConsoleIds", () => {
62
62
  );
63
63
 
64
64
  // ACT
65
- const response = await getConsoleIds(authorization);
65
+ const response = await getConsoleIds(authorization, {
66
+ shouldOnlyRetrieveActiveSystems: true,
67
+ shouldOnlyRetrieveGameSystems: true,
68
+ });
66
69
 
67
70
  // ASSERT
68
71
  const expectedResponse: FetchedSystem[] = [
@@ -53,6 +53,7 @@ describe("Function: getAchievementOfTheWeek", () => {
53
53
  {
54
54
  User: "Tirbaba2",
55
55
  RAPoints: "72",
56
+ RASoftcorePoints: "72",
56
57
  DateAwarded: "2022-10-10 01:42:19",
57
58
  HardcoreMode: "1",
58
59
  },
@@ -91,6 +92,7 @@ describe("Function: getAchievementOfTheWeek", () => {
91
92
  {
92
93
  user: "Tirbaba2",
93
94
  raPoints: 72,
95
+ raSoftcorePoints: 72,
94
96
  dateAwarded: "2022-10-10 01:42:19",
95
97
  hardcoreMode: true,
96
98
  },
@@ -131,6 +133,7 @@ describe("Function: getAchievementOfTheWeek", () => {
131
133
  {
132
134
  User: "Tirbaba2",
133
135
  RAPoints: "72",
136
+ RASoftcorePoints: "72",
134
137
  DateAwarded: "2022-10-10 01:42:19",
135
138
  HardcoreMode: "0",
136
139
  },
@@ -169,6 +172,7 @@ describe("Function: getAchievementOfTheWeek", () => {
169
172
  {
170
173
  user: "Tirbaba2",
171
174
  raPoints: 72,
175
+ raSoftcorePoints: 72,
172
176
  dateAwarded: "2022-10-10 01:42:19",
173
177
  hardcoreMode: false,
174
178
  },
@@ -48,7 +48,8 @@ import type {
48
48
  * unlocks: [
49
49
  * {
50
50
  * user: "Tirbaba2",
51
- * rAPoints: "72",
51
+ * raPoints: "72",
52
+ * raSoftcorePoints: "72",
52
53
  * dateAwarded: "2022-10-10 01:42:19",
53
54
  * hardcoreMode: "1"
54
55
  * }
@@ -75,6 +76,7 @@ export const getAchievementOfTheWeek = async (
75
76
  "TrueRatio",
76
77
  "TotalPlayers",
77
78
  "RAPoints",
79
+ "RASoftcorePoints",
78
80
  "UnlocksCount",
79
81
  ],
80
82
  shouldMapToBooleans: ["HardcoreMode"],
@@ -49,7 +49,12 @@ describe("Function: getRecentGameAwards", () => {
49
49
  );
50
50
 
51
51
  // ACT
52
- const response = await getRecentGameAwards(authorization);
52
+ const response = await getRecentGameAwards(authorization, {
53
+ startDate: "2025-01-05",
54
+ offset: 10,
55
+ count: 10,
56
+ desiredAwardKinds: ["completed"],
57
+ });
53
58
 
54
59
  const expectedResponse: RecentGameAwards = {
55
60
  count: 1,
@@ -21,6 +21,7 @@ export interface AchievementOfTheWeek {
21
21
  unlocks: Array<{
22
22
  user: string;
23
23
  raPoints: number;
24
+ raSoftcorePoints: number;
24
25
  dateAwarded: string;
25
26
  hardcoreMode: boolean;
26
27
  }>;
@@ -21,6 +21,7 @@ export interface GetAchievementOfTheWeekResponse {
21
21
  Unlocks: Array<{
22
22
  User: string;
23
23
  RAPoints: string;
24
+ RASoftcorePoints: string;
24
25
  DateAwarded: string;
25
26
  HardcoreMode: string;
26
27
  }>;
@@ -75,7 +75,10 @@ describe("Function: getGameExtended", () => {
75
75
  );
76
76
 
77
77
  // ACT
78
- const response = await getGameExtended(authorization, { gameId: 14_402 });
78
+ const response = await getGameExtended(authorization, {
79
+ gameId: 14_402,
80
+ isRequestingUnofficialAchievements: true,
81
+ });
79
82
 
80
83
  // ASSERT
81
84
  expect(response).toEqual({
@@ -0,0 +1,77 @@
1
+ /* eslint-disable sonarjs/no-duplicate-string */
2
+
3
+ import { http, HttpResponse } from "msw";
4
+ import { setupServer } from "msw/node";
5
+
6
+ import { apiBaseUrl } from "../utils/internal";
7
+ import { buildAuthorization } from "../utils/public";
8
+ import { getGameHashes } from "./getGameHashes";
9
+ import type { GetGameHashesResponse } from "./models";
10
+
11
+ const server = setupServer();
12
+
13
+ describe("Function: getGameHashes", () => {
14
+ // MSW Setup
15
+ beforeAll(() => server.listen());
16
+ afterEach(() => server.resetHandlers());
17
+ afterAll(() => server.close());
18
+
19
+ it("is defined #sanity", () => {
20
+ // ASSERT
21
+ expect(getGameHashes).toBeDefined();
22
+ });
23
+
24
+ it("given a game ID, retrieves a list of linked hashes", async () => {
25
+ // ARRANGE
26
+ const authorization = buildAuthorization({
27
+ username: "mockUserName",
28
+ webApiKey: "mockWebApiKey",
29
+ });
30
+
31
+ const mockResponse: GetGameHashesResponse = {
32
+ Results: [
33
+ {
34
+ Name: "Sonic The Hedgehog (USA, Europe) (Ru) (NewGame).md",
35
+ MD5: "1b1d9ac862c387367e904036114c4825",
36
+ Labels: ["nointro", "rapatches"],
37
+ PatchUrl:
38
+ "https://github.com/RetroAchievements/RAPatches/raw/main/MD/Translation/Russian/1-Sonic1-Russian.zip",
39
+ },
40
+ {
41
+ Name: "Sonic The Hedgehog (USA, Europe).md",
42
+ MD5: "1bc674be034e43c96b86487ac69d9293",
43
+ Labels: ["nointro"],
44
+ PatchUrl: null,
45
+ },
46
+ ],
47
+ };
48
+
49
+ server.use(
50
+ http.get(`${apiBaseUrl}/API_GetGameHashes.php`, () =>
51
+ HttpResponse.json(mockResponse)
52
+ )
53
+ );
54
+
55
+ // ACT
56
+ const response = await getGameHashes(authorization, { gameId: 1 });
57
+
58
+ // ASSERT
59
+ expect(response).toEqual({
60
+ results: [
61
+ {
62
+ name: "Sonic The Hedgehog (USA, Europe) (Ru) (NewGame).md",
63
+ md5: "1b1d9ac862c387367e904036114c4825",
64
+ labels: ["nointro", "rapatches"],
65
+ patchUrl:
66
+ "https://github.com/RetroAchievements/RAPatches/raw/main/MD/Translation/Russian/1-Sonic1-Russian.zip",
67
+ },
68
+ {
69
+ name: "Sonic The Hedgehog (USA, Europe).md",
70
+ md5: "1bc674be034e43c96b86487ac69d9293",
71
+ labels: ["nointro"],
72
+ patchUrl: null,
73
+ },
74
+ ],
75
+ });
76
+ });
77
+ });
@@ -0,0 +1,66 @@
1
+ import type { ID } from "../utils/internal";
2
+ import {
3
+ apiBaseUrl,
4
+ buildRequestUrl,
5
+ call,
6
+ serializeProperties,
7
+ } from "../utils/internal";
8
+ import type { AuthObject } from "../utils/public";
9
+ import type { GameHashes, GetGameHashesResponse } from "./models";
10
+
11
+ /**
12
+ * A call to this function will retrieve a list of hashes linked to a game.
13
+ *
14
+ * @param authorization An object containing your username and webApiKey.
15
+ * This can be constructed with `buildAuthorization()`.
16
+ *
17
+ * @param payload.gameId The unique game ID. If you are unsure, open the
18
+ * game's page on the RetroAchievements.org website. For example, Dragster's
19
+ * URL is https://retroachievements.org/game/14402. We can see from the
20
+ * URL that the game ID is "14402".
21
+ *
22
+ * @example
23
+ * ```
24
+ * const game = await getGameHashes(
25
+ * authorization,
26
+ * { gameId: 14402 }
27
+ * );
28
+ * ```
29
+ *
30
+ * @returns An object containing a list of game hashes.
31
+ * ```json
32
+ * {
33
+ * "results": [
34
+ * {
35
+ * "md5": "1b1d9ac862c387367e904036114c4825",
36
+ * "name": "Sonic The Hedgehog (USA, Europe) (Ru) (NewGame).md",
37
+ * "labels": ["nointro", "rapatches"],
38
+ * "patchUrl": "https://github.com/RetroAchievements/RAPatches/raw/main/MD/Translation/Russian/1-Sonic1-Russian.zip"
39
+ * },
40
+ * {
41
+ * "md5": "1bc674be034e43c96b86487ac69d9293",
42
+ * "name": "Sonic The Hedgehog (USA, Europe).md",
43
+ * "labels": ["nointro"],
44
+ * "patchUrl": null
45
+ * }
46
+ * ]
47
+ * }
48
+ * ```
49
+ */
50
+ export const getGameHashes = async (
51
+ authorization: AuthObject,
52
+ payload: { gameId: ID }
53
+ ): Promise<GameHashes> => {
54
+ const { gameId } = payload;
55
+
56
+ const url = buildRequestUrl(
57
+ apiBaseUrl,
58
+ "/API_GetGameHashes.php",
59
+ authorization,
60
+ { i: gameId }
61
+ );
62
+
63
+ const rawResponse = await call<GetGameHashesResponse>({ url });
64
+
65
+ return serializeProperties(rawResponse);
66
+ };
package/src/game/index.ts CHANGED
@@ -2,6 +2,7 @@ export * from "./getAchievementCount";
2
2
  export * from "./getAchievementDistribution";
3
3
  export * from "./getGame";
4
4
  export * from "./getGameExtended";
5
+ export * from "./getGameHashes";
5
6
  export * from "./getGameRankAndScore";
6
7
  export * from "./getGameRating";
7
8
  export * from "./models";
@@ -0,0 +1,10 @@
1
+ interface GameHash {
2
+ md5: string;
3
+ name: string;
4
+ labels: string[];
5
+ patchUrl: string;
6
+ }
7
+
8
+ export interface GameHashes {
9
+ results: GameHash[];
10
+ }
@@ -0,0 +1,10 @@
1
+ interface GameHashResult {
2
+ MD5: string;
3
+ Name: string;
4
+ Labels: string[];
5
+ PatchUrl: string;
6
+ }
7
+
8
+ export interface GetGameHashesResponse {
9
+ Results: GameHashResult[];
10
+ }
@@ -4,11 +4,13 @@ export * from "./game.model";
4
4
  export * from "./game-extended.model";
5
5
  export * from "./game-extended-achievement-entity.model";
6
6
  export * from "./game-extended-claim-entity.model";
7
+ export * from "./game-hashes.model";
7
8
  export * from "./game-rank-and-score-entity.model";
8
9
  export * from "./game-rating.model";
9
10
  export * from "./get-achievement-count-response.model";
10
11
  export * from "./get-achievement-distribution-response.model";
11
12
  export * from "./get-game-extended-response.model";
13
+ export * from "./get-game-hashes-response.model";
12
14
  export * from "./get-game-rank-and-score-response.model";
13
15
  export * from "./get-game-rating-response.model";
14
16
  export * from "./get-game-response.model";
@@ -0,0 +1,75 @@
1
+ /* eslint-disable sonarjs/no-duplicate-string */
2
+
3
+ import { http, HttpResponse } from "msw";
4
+ import { setupServer } from "msw/node";
5
+
6
+ import { apiBaseUrl } from "../utils/internal";
7
+ import { buildAuthorization } from "../utils/public";
8
+ import { getUserWantToPlayList } from "./getUserWantToPlayList";
9
+ import type { GetUserWantToPlayListResponse } from "./models";
10
+
11
+ const server = setupServer();
12
+
13
+ describe("Function: getUserWantToPlayList", () => {
14
+ // MSW Setup
15
+ beforeAll(() => server.listen());
16
+ afterEach(() => server.resetHandlers());
17
+ afterAll(() => server.close());
18
+
19
+ it("is defined #sanity", () => {
20
+ // ASSERT
21
+ expect(getUserWantToPlayList).toBeDefined();
22
+ });
23
+
24
+ it('given a username, retrieves that users "Want To Play Games"', async () => {
25
+ // ARRANGE
26
+ const authorization = buildAuthorization({
27
+ username: "mockUserName",
28
+ webApiKey: "mockWebApiKey",
29
+ });
30
+
31
+ const mockResponse: GetUserWantToPlayListResponse = {
32
+ Count: 100,
33
+ Total: 1287,
34
+ Results: [
35
+ {
36
+ ID: 20_246,
37
+ Title: "~Hack~ Knuckles the Echidna in Sonic the Hedgehog",
38
+ ImageIcon: "/Images/074560.png",
39
+ ConsoleID: 1,
40
+ ConsoleName: "Genesis/Mega Drive",
41
+ PointsTotal: 1500,
42
+ AchievementsPublished: 50,
43
+ },
44
+ ],
45
+ };
46
+
47
+ server.use(
48
+ http.get(`${apiBaseUrl}/API_GetUserWantToPlayList.php`, () =>
49
+ HttpResponse.json(mockResponse)
50
+ )
51
+ );
52
+
53
+ // ACT
54
+ const response = await getUserWantToPlayList(authorization, {
55
+ username: "xelnia",
56
+ });
57
+
58
+ // ASSERT
59
+ expect(response).toEqual({
60
+ count: 100,
61
+ total: 1287,
62
+ results: [
63
+ {
64
+ id: 20_246,
65
+ title: "~Hack~ Knuckles the Echidna in Sonic the Hedgehog",
66
+ imageIcon: "/Images/074560.png",
67
+ consoleId: 1,
68
+ consoleName: "Genesis/Mega Drive",
69
+ pointsTotal: 1500,
70
+ achievementsPublished: 50,
71
+ },
72
+ ],
73
+ });
74
+ });
75
+ });
@@ -0,0 +1,76 @@
1
+ import {
2
+ apiBaseUrl,
3
+ buildRequestUrl,
4
+ call,
5
+ serializeProperties,
6
+ } from "../utils/internal";
7
+ import type { AuthObject } from "../utils/public";
8
+ import type {
9
+ GetUserWantToPlayListResponse,
10
+ UserWantToPlayList,
11
+ } from "./models";
12
+
13
+ /**
14
+ * A call to this function will retrieve a user's "Want to Play Games" list.
15
+ *
16
+ * @param authorization An object containing your username and webApiKey.
17
+ * This can be constructed with `buildAuthorization()`.
18
+ *
19
+ * @param payload.username The user for which to retrieve the
20
+ * want to play games list for.
21
+ *
22
+ * @param payload.offset Defaults to 0. The number of entries to skip.
23
+ *
24
+ * @param payload.count Defaults to 100, has a max of 500.
25
+ *
26
+ * @example
27
+ * ```
28
+ * const wantToPlayList = await getUserWantToPlayList(
29
+ * authorization,
30
+ * { username: "wv_pinball" }
31
+ * );
32
+ * ```
33
+ *
34
+ * @returns An object containing a user's list of "Want to Play Games".
35
+ * ```json
36
+ * {
37
+ * "count": 100,
38
+ * "total": 1287,
39
+ * "results": [
40
+ * {
41
+ * "id": 20246,
42
+ * "title": "~Hack~ Knuckles the Echidna in Sonic the Hedgehog",
43
+ * "imageIcon": "/Images/074560.png",
44
+ * "consoleID": 1,
45
+ * "consoleName": "Genesis/Mega Drive",
46
+ * "pointsTotal": 1500,
47
+ * "achievementsPublished": 50
48
+ * }
49
+ * ]
50
+ * }
51
+ * ```
52
+ */
53
+ export const getUserWantToPlayList = async (
54
+ authorization: AuthObject,
55
+ payload: { username: string; offset?: number; count?: number }
56
+ ): Promise<UserWantToPlayList> => {
57
+ const queryParams: Record<string, any> = {};
58
+ queryParams.u = payload.username;
59
+ if (payload?.offset) {
60
+ queryParams.o = payload.offset;
61
+ }
62
+ if (payload?.count) {
63
+ queryParams.c = payload.count;
64
+ }
65
+
66
+ const url = buildRequestUrl(
67
+ apiBaseUrl,
68
+ "/API_GetUserWantToPlayList.php",
69
+ authorization,
70
+ queryParams
71
+ );
72
+
73
+ const rawResponse = await call<GetUserWantToPlayListResponse>({ url });
74
+
75
+ return serializeProperties(rawResponse);
76
+ };
package/src/user/index.ts CHANGED
@@ -12,4 +12,5 @@ export * from "./getUserProgress";
12
12
  export * from "./getUserRecentAchievements";
13
13
  export * from "./getUserRecentlyPlayedGames";
14
14
  export * from "./getUserSummary";
15
+ export * from "./getUserWantToPlayList";
15
16
  export * from "./models";
@@ -0,0 +1,13 @@
1
+ export interface GetUserWantToPlayListResponse {
2
+ Count: number;
3
+ Total: number;
4
+ Results: Array<{
5
+ ID: number;
6
+ Title: string;
7
+ ImageIcon: string;
8
+ ConsoleID: number;
9
+ ConsoleName: string;
10
+ PointsTotal: number;
11
+ AchievementsPublished: number;
12
+ }>;
13
+ }
@@ -13,6 +13,7 @@ export * from "./get-user-progress-response.model";
13
13
  export * from "./get-user-recent-achievements-response.model";
14
14
  export * from "./get-user-recently-played-games-response.model";
15
15
  export * from "./get-user-summary-response.model";
16
+ export * from "./get-user-want-to-play-list-response.model";
16
17
  export * from "./user-awards.model";
17
18
  export * from "./user-claims.model";
18
19
  export * from "./user-claims-response.model";
@@ -26,3 +27,4 @@ export * from "./user-progress.model";
26
27
  export * from "./user-recent-achievement.model";
27
28
  export * from "./user-recently-played-games.model";
28
29
  export * from "./user-summary.model";
30
+ export * from "./user-want-to-play-list.model";
@@ -0,0 +1,13 @@
1
+ export interface UserWantToPlayList {
2
+ count: number;
3
+ total: number;
4
+ results: Array<{
5
+ id: number;
6
+ title: string;
7
+ imageIcon: string;
8
+ consoleId: number;
9
+ consoleName: string;
10
+ pointsTotal: number;
11
+ achievementsPublished: number;
12
+ }>;
13
+ }