@retroachievements/api 2.0.0 → 2.2.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 (60) 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/getRecentGameAwards.d.ts +50 -0
  14. package/dist/feed/getRecentGameAwards.test.d.ts +1 -0
  15. package/dist/feed/index.d.ts +1 -0
  16. package/dist/feed/models/achievement-of-the-week.model.d.ts +1 -0
  17. package/dist/feed/models/get-achievement-of-the-week-response.model.d.ts +1 -0
  18. package/dist/feed/models/get-recent-game-awards-response.model.d.ts +14 -0
  19. package/dist/feed/models/index.d.ts +2 -0
  20. package/dist/feed/models/recent-game-awards.model.d.ts +14 -0
  21. package/dist/game/getGameHashes.d.ts +45 -0
  22. package/dist/game/getGameHashes.test.d.ts +1 -0
  23. package/dist/game/index.d.ts +1 -0
  24. package/dist/game/models/game-hashes.model.d.ts +10 -0
  25. package/dist/game/models/get-game-hashes-response.model.d.ts +10 -0
  26. package/dist/game/models/index.d.ts +2 -0
  27. package/dist/user/models/game-info-and-user-progress.model.d.ts +2 -1
  28. package/dist/user/models/get-game-info-and-user-progress-response.model.d.ts +2 -1
  29. package/dist/user/models/get-user-completion-progress-response.model.d.ts +2 -1
  30. package/dist/user/models/user-completion-progress-entity.model.d.ts +2 -1
  31. package/dist/utils/public/models/award-kind.model.d.ts +1 -0
  32. package/dist/utils/public/models/index.d.ts +1 -0
  33. package/package.json +1 -1
  34. package/src/achievement/getAchievementUnlocks.test.ts +2 -0
  35. package/src/achievement/getAchievementUnlocks.ts +7 -1
  36. package/src/achievement/models/achievement-unlock-entity.model.ts +1 -0
  37. package/src/achievement/models/get-achievement-unlocks-response.model.ts +1 -0
  38. package/src/console/getConsoleIds.test.ts +4 -1
  39. package/src/feed/getAchievementOfTheWeek.test.ts +4 -0
  40. package/src/feed/getAchievementOfTheWeek.ts +3 -1
  41. package/src/feed/getRecentGameAwards.test.ts +78 -0
  42. package/src/feed/getRecentGameAwards.ts +85 -0
  43. package/src/feed/index.ts +1 -0
  44. package/src/feed/models/achievement-of-the-week.model.ts +1 -0
  45. package/src/feed/models/get-achievement-of-the-week-response.model.ts +1 -0
  46. package/src/feed/models/get-recent-game-awards-response.model.ts +15 -0
  47. package/src/feed/models/index.ts +2 -0
  48. package/src/feed/models/recent-game-awards.model.ts +15 -0
  49. package/src/game/getGameHashes.test.ts +77 -0
  50. package/src/game/getGameHashes.ts +66 -0
  51. package/src/game/index.ts +1 -0
  52. package/src/game/models/game-hashes.model.ts +10 -0
  53. package/src/game/models/get-game-hashes-response.model.ts +10 -0
  54. package/src/game/models/index.ts +2 -0
  55. package/src/user/models/game-info-and-user-progress.model.ts +2 -6
  56. package/src/user/models/get-game-info-and-user-progress-response.model.ts +2 -6
  57. package/src/user/models/get-user-completion-progress-response.model.ts +3 -6
  58. package/src/user/models/user-completion-progress-entity.model.ts +3 -6
  59. package/src/utils/public/models/award-kind.model.ts +5 -0
  60. package/src/utils/public/models/index.ts +1 -0
@@ -0,0 +1,50 @@
1
+ import type { AuthObject, AwardKind } from "../utils/public";
2
+ import type { RecentGameAwards } from "./models";
3
+ /**
4
+ * A call to this function will retrieve all recently granted game
5
+ * awards across the site's userbase.
6
+ *
7
+ * @param authorization An object containing your username and webApiKey.
8
+ * This can be constructed with `buildAuthorization()`.
9
+ *
10
+ * @param payload.startDate The date to fetch awards from.
11
+ *
12
+ * @param payload.offset Optional. Defaults to 0.
13
+ *
14
+ * @param payload.count Optional. Defaults to 25.
15
+ *
16
+ * @param payload.desiredAwardKinds Optional. Defaults to all. Accepts "beaten-softcore", "beaten-hardcore", "completed", and/or "mastered".
17
+ *
18
+ * @example
19
+ * ```
20
+ * const recentGameAwards = await getRecentGameAwards(
21
+ * authorization,
22
+ * );
23
+ * ```
24
+ *
25
+ * @returns An object containing metadata about all recently granted game
26
+ * awards across the site's userbase
27
+ * ```
28
+ * {
29
+ * count: 1,
30
+ * total: 1,
31
+ * results: [
32
+ * {
33
+ * user: "renanbrj",
34
+ * awardKind: "mastered",
35
+ * awardDate: "2022-01-01T23:48:04+00:00",
36
+ * gameId: 14_284,
37
+ * gameTitle: "Batman Returns",
38
+ * consoleId: 15,
39
+ * consoleName: "Game Gear",
40
+ * },
41
+ * ],
42
+ * }
43
+ * ```
44
+ */
45
+ export declare const getRecentGameAwards: (authorization: AuthObject, payload?: Partial<{
46
+ startDate: string;
47
+ offset: number;
48
+ count: number;
49
+ desiredAwardKinds: AwardKind[];
50
+ }>) => Promise<RecentGameAwards>;
@@ -0,0 +1 @@
1
+ export {};
@@ -1,5 +1,6 @@
1
1
  export * from "./getAchievementOfTheWeek";
2
2
  export * from "./getActiveClaims";
3
3
  export * from "./getClaims";
4
+ export * from "./getRecentGameAwards";
4
5
  export * from "./getTopTenUsers";
5
6
  export * from "./models";
@@ -27,6 +27,7 @@ export interface AchievementOfTheWeek {
27
27
  unlocks: Array<{
28
28
  user: string;
29
29
  raPoints: number;
30
+ raSoftcorePoints: number;
30
31
  dateAwarded: string;
31
32
  hardcoreMode: boolean;
32
33
  }>;
@@ -27,6 +27,7 @@ export interface GetAchievementOfTheWeekResponse {
27
27
  Unlocks: Array<{
28
28
  User: string;
29
29
  RAPoints: string;
30
+ RASoftcorePoints: string;
30
31
  DateAwarded: string;
31
32
  HardcoreMode: string;
32
33
  }>;
@@ -0,0 +1,14 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+ export interface GetRecentGameAwardsResponse {
3
+ Count: number;
4
+ Total: number;
5
+ Results: Array<{
6
+ User: string;
7
+ AwardKind: AwardKind;
8
+ AwardDate: string;
9
+ GameID: number;
10
+ GameTitle: string;
11
+ ConsoleID: number;
12
+ ConsoleName: string;
13
+ }>;
14
+ }
@@ -3,8 +3,10 @@ export * from "./claim-set-type.enum";
3
3
  export * from "./claim-status.enum";
4
4
  export * from "./claim-type.enum";
5
5
  export * from "./get-achievement-of-the-week-response.model";
6
+ export * from "./get-recent-game-awards-response.model";
6
7
  export * from "./get-set-claims-response.model";
7
8
  export * from "./get-top-ten-users-response.model";
9
+ export * from "./recent-game-awards.model";
8
10
  export * from "./set-claim.model";
9
11
  export * from "./top-ten-users.model";
10
12
  export * from "./top-ten-users-entity.model";
@@ -0,0 +1,14 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+ export interface RecentGameAwards {
3
+ count: number;
4
+ total: number;
5
+ results: Array<{
6
+ user: string;
7
+ awardKind: AwardKind;
8
+ awardDate: string;
9
+ gameId: number;
10
+ gameTitle: string;
11
+ consoleId: number;
12
+ consoleName: string;
13
+ }>;
14
+ }
@@ -0,0 +1,45 @@
1
+ import type { ID } from "../utils/internal";
2
+ import type { AuthObject } from "../utils/public";
3
+ import type { GameHashes } from "./models";
4
+ /**
5
+ * A call to this function will retrieve a list of hashes linked to a game.
6
+ *
7
+ * @param authorization An object containing your username and webApiKey.
8
+ * This can be constructed with `buildAuthorization()`.
9
+ *
10
+ * @param payload.gameId The unique game ID. If you are unsure, open the
11
+ * game's page on the RetroAchievements.org website. For example, Dragster's
12
+ * URL is https://retroachievements.org/game/14402. We can see from the
13
+ * URL that the game ID is "14402".
14
+ *
15
+ * @example
16
+ * ```
17
+ * const game = await getGameHashes(
18
+ * authorization,
19
+ * { gameId: 14402 }
20
+ * );
21
+ * ```
22
+ *
23
+ * @returns An object containing a list of game hashes.
24
+ * ```json
25
+ * {
26
+ * "Results": [
27
+ * {
28
+ * "MD5": "1b1d9ac862c387367e904036114c4825",
29
+ * "Name": "Sonic The Hedgehog (USA, Europe) (Ru) (NewGame).md",
30
+ * "Labels": ["nointro", "rapatches"],
31
+ * "PatchUrl": "https://github.com/RetroAchievements/RAPatches/raw/main/MD/Translation/Russian/1-Sonic1-Russian.zip"
32
+ * },
33
+ * {
34
+ * "MD5": "1bc674be034e43c96b86487ac69d9293",
35
+ * "Name": "Sonic The Hedgehog (USA, Europe).md",
36
+ * "Labels": ["nointro"],
37
+ * "PatchUrl": null
38
+ * }
39
+ * ]
40
+ * }
41
+ * ```
42
+ */
43
+ export declare const getGameHashes: (authorization: AuthObject, payload: {
44
+ gameId: ID;
45
+ }) => Promise<GameHashes>;
@@ -0,0 +1 @@
1
+ export {};
@@ -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
+ export interface GameHashes {
8
+ results: GameHash[];
9
+ }
10
+ export {};
@@ -0,0 +1,10 @@
1
+ interface GameHashResult {
2
+ MD5: string;
3
+ Name: string;
4
+ Labels: string[];
5
+ PatchUrl: string;
6
+ }
7
+ export interface GetGameHashesResponse {
8
+ Results: GameHashResult[];
9
+ }
10
+ export {};
@@ -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";
@@ -1,4 +1,5 @@
1
1
  import type { GameExtended, GameExtendedAchievementEntity } from "../../game/models";
2
+ import type { AwardKind } from "../../utils/public";
2
3
  export type GameExtendedAchievementEntityWithUserProgress = GameExtendedAchievementEntity & {
3
4
  dateEarned: string;
4
5
  dateEarnedHardcore: string;
@@ -9,6 +10,6 @@ export interface GameInfoAndUserProgress extends GameExtended {
9
10
  numAwardedToUserHardcore: number;
10
11
  userCompletion: string;
11
12
  userCompletionHardcore: string;
12
- highestAwardKind?: "mastered" | "completed" | "beaten-hardcore" | "beaten-softcore" | null;
13
+ highestAwardKind?: AwardKind | null;
13
14
  highestAwardDate?: string;
14
15
  }
@@ -1,4 +1,5 @@
1
1
  import type { GameExtendedRawAchievementEntity, GetGameExtendedResponse } from "../../game/models";
2
+ import type { AwardKind } from "../../utils/public";
2
3
  type GetGameExtendedResponseWithoutClaims = Omit<GetGameExtendedResponse, "Claims">;
3
4
  type GameExtendedRawAchievementEntityWithUserProgress = GameExtendedRawAchievementEntity & {
4
5
  DateEarned: string;
@@ -10,7 +11,7 @@ export interface GetGameInfoAndUserProgressResponse extends GetGameExtendedRespo
10
11
  NumAwardedToUserHardcore: number;
11
12
  UserCompletion: string;
12
13
  UserCompletionHardcore: string;
13
- HighestAwardKind?: "mastered" | "completed" | "beaten-hardcore" | "beaten-softcore" | null;
14
+ HighestAwardKind?: AwardKind | null;
14
15
  HighestAwardDate?: string;
15
16
  }
16
17
  export {};
@@ -1,3 +1,4 @@
1
+ import type { AwardKind } from "../../utils/public";
1
2
  interface RawUserCompletionProgressEntity {
2
3
  GameID: number;
3
4
  Title: string;
@@ -8,7 +9,7 @@ interface RawUserCompletionProgressEntity {
8
9
  NumAwarded: number;
9
10
  NumAwardedHardcore: number;
10
11
  MostRecentAwardedDate?: string;
11
- HighestAwardKind?: "mastered" | "completed" | "beaten-hardcore" | "beaten-softcore" | null;
12
+ HighestAwardKind?: AwardKind | null;
12
13
  HighestAwardDate?: string | null;
13
14
  }
14
15
  export interface GetUserCompletionProgressResponse {
@@ -1,3 +1,4 @@
1
+ import type { AwardKind } from "../../utils/public";
1
2
  export interface UserCompletionProgressEntity {
2
3
  gameId: number;
3
4
  title: string;
@@ -8,6 +9,6 @@ export interface UserCompletionProgressEntity {
8
9
  numAwarded: number;
9
10
  numAwardedHardcore: number;
10
11
  mostRecentAwardedDate?: string;
11
- highestAwardKind?: "mastered" | "completed" | "beaten-hardcore" | "beaten-softcore" | null;
12
+ highestAwardKind?: AwardKind | null;
12
13
  highestAwardDate?: string;
13
14
  }
@@ -0,0 +1 @@
1
+ export type AwardKind = "beaten-softcore" | "beaten-hardcore" | "completed" | "mastered";
@@ -1 +1,2 @@
1
1
  export * from "./auth-object.model";
2
+ export * from "./award-kind.model";
package/package.json CHANGED
@@ -10,7 +10,7 @@
10
10
  "raweb",
11
11
  "retro gaming"
12
12
  ],
13
- "version": "2.0.0",
13
+ "version": "2.2.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"],
@@ -0,0 +1,78 @@
1
+ import { http, HttpResponse } from "msw";
2
+ import { setupServer } from "msw/node";
3
+
4
+ import { apiBaseUrl } from "../utils/internal";
5
+ import { buildAuthorization } from "../utils/public";
6
+ import { getRecentGameAwards } from "./getRecentGameAwards";
7
+ import type { GetRecentGameAwardsResponse, RecentGameAwards } from "./models";
8
+
9
+ const server = setupServer();
10
+
11
+ describe("Function: getRecentGameAwards", () => {
12
+ // MSW Setup
13
+ beforeAll(() => server.listen());
14
+ afterEach(() => server.resetHandlers());
15
+ afterAll(() => server.close());
16
+
17
+ it("is defined #sanity", () => {
18
+ // ASSERT
19
+ expect(getRecentGameAwards).toBeDefined();
20
+ });
21
+
22
+ it("retrieves metadata about all recently-earned game awards on the site", async () => {
23
+ // ARRANGE
24
+ const authorization = buildAuthorization({
25
+ username: "mockUserName",
26
+ webApiKey: "mockWebApiKey",
27
+ });
28
+
29
+ const mockResponse: GetRecentGameAwardsResponse = {
30
+ Count: 1,
31
+ Total: 1,
32
+ Results: [
33
+ {
34
+ User: "renanbrj",
35
+ AwardKind: "mastered",
36
+ AwardDate: "2022-01-01T23:48:04+00:00",
37
+ GameID: 14_284,
38
+ GameTitle: "Batman Returns",
39
+ ConsoleID: 15,
40
+ ConsoleName: "Game Gear",
41
+ },
42
+ ],
43
+ };
44
+
45
+ server.use(
46
+ http.get(`${apiBaseUrl}/API_GetRecentGameAwards.php`, () =>
47
+ HttpResponse.json(mockResponse)
48
+ )
49
+ );
50
+
51
+ // ACT
52
+ const response = await getRecentGameAwards(authorization, {
53
+ startDate: "2025-01-05",
54
+ offset: 10,
55
+ count: 10,
56
+ desiredAwardKinds: ["completed"],
57
+ });
58
+
59
+ const expectedResponse: RecentGameAwards = {
60
+ count: 1,
61
+ total: 1,
62
+ results: [
63
+ {
64
+ user: "renanbrj",
65
+ awardKind: "mastered",
66
+ awardDate: "2022-01-01T23:48:04+00:00",
67
+ gameId: 14_284,
68
+ gameTitle: "Batman Returns",
69
+ consoleId: 15,
70
+ consoleName: "Game Gear",
71
+ },
72
+ ],
73
+ };
74
+
75
+ // ASSERT
76
+ expect(response).toEqual(expectedResponse);
77
+ });
78
+ });
@@ -0,0 +1,85 @@
1
+ import {
2
+ apiBaseUrl,
3
+ buildRequestUrl,
4
+ call,
5
+ serializeProperties,
6
+ } from "../utils/internal";
7
+ import type { AuthObject, AwardKind } from "../utils/public";
8
+ import type { GetRecentGameAwardsResponse, RecentGameAwards } from "./models";
9
+
10
+ /**
11
+ * A call to this function will retrieve all recently granted game
12
+ * awards across the site's userbase.
13
+ *
14
+ * @param authorization An object containing your username and webApiKey.
15
+ * This can be constructed with `buildAuthorization()`.
16
+ *
17
+ * @param payload.startDate The date to fetch awards from.
18
+ *
19
+ * @param payload.offset Optional. Defaults to 0.
20
+ *
21
+ * @param payload.count Optional. Defaults to 25.
22
+ *
23
+ * @param payload.desiredAwardKinds Optional. Defaults to all. Accepts "beaten-softcore", "beaten-hardcore", "completed", and/or "mastered".
24
+ *
25
+ * @example
26
+ * ```
27
+ * const recentGameAwards = await getRecentGameAwards(
28
+ * authorization,
29
+ * );
30
+ * ```
31
+ *
32
+ * @returns An object containing metadata about all recently granted game
33
+ * awards across the site's userbase
34
+ * ```
35
+ * {
36
+ * count: 1,
37
+ * total: 1,
38
+ * results: [
39
+ * {
40
+ * user: "renanbrj",
41
+ * awardKind: "mastered",
42
+ * awardDate: "2022-01-01T23:48:04+00:00",
43
+ * gameId: 14_284,
44
+ * gameTitle: "Batman Returns",
45
+ * consoleId: 15,
46
+ * consoleName: "Game Gear",
47
+ * },
48
+ * ],
49
+ * }
50
+ * ```
51
+ */
52
+ export const getRecentGameAwards = async (
53
+ authorization: AuthObject,
54
+ payload?: Partial<{
55
+ startDate: string;
56
+ offset: number;
57
+ count: number;
58
+ desiredAwardKinds: AwardKind[];
59
+ }>
60
+ ): Promise<RecentGameAwards> => {
61
+ const queryParams: Record<string, any> = {};
62
+ if (payload?.startDate) {
63
+ queryParams.d = payload.startDate;
64
+ }
65
+ if (payload?.offset) {
66
+ queryParams.o = payload.offset;
67
+ }
68
+ if (payload?.count) {
69
+ queryParams.c = payload.count;
70
+ }
71
+ if (payload?.desiredAwardKinds) {
72
+ queryParams.k = payload.desiredAwardKinds.join(",");
73
+ }
74
+
75
+ const url = buildRequestUrl(
76
+ apiBaseUrl,
77
+ "/API_GetRecentGameAwards.php",
78
+ authorization,
79
+ queryParams
80
+ );
81
+
82
+ const rawResponse = await call<GetRecentGameAwardsResponse>({ url });
83
+
84
+ return serializeProperties(rawResponse);
85
+ };
package/src/feed/index.ts CHANGED
@@ -1,5 +1,6 @@
1
1
  export * from "./getAchievementOfTheWeek";
2
2
  export * from "./getActiveClaims";
3
3
  export * from "./getClaims";
4
+ export * from "./getRecentGameAwards";
4
5
  export * from "./getTopTenUsers";
5
6
  export * from "./models";
@@ -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
  }>;
@@ -0,0 +1,15 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+
3
+ export interface GetRecentGameAwardsResponse {
4
+ Count: number;
5
+ Total: number;
6
+ Results: Array<{
7
+ User: string;
8
+ AwardKind: AwardKind;
9
+ AwardDate: string;
10
+ GameID: number;
11
+ GameTitle: string;
12
+ ConsoleID: number;
13
+ ConsoleName: string;
14
+ }>;
15
+ }
@@ -3,8 +3,10 @@ export * from "./claim-set-type.enum";
3
3
  export * from "./claim-status.enum";
4
4
  export * from "./claim-type.enum";
5
5
  export * from "./get-achievement-of-the-week-response.model";
6
+ export * from "./get-recent-game-awards-response.model";
6
7
  export * from "./get-set-claims-response.model";
7
8
  export * from "./get-top-ten-users-response.model";
9
+ export * from "./recent-game-awards.model";
8
10
  export * from "./set-claim.model";
9
11
  export * from "./top-ten-users.model";
10
12
  export * from "./top-ten-users-entity.model";
@@ -0,0 +1,15 @@
1
+ import type { AwardKind } from "../../utils/public";
2
+
3
+ export interface RecentGameAwards {
4
+ count: number;
5
+ total: number;
6
+ results: Array<{
7
+ user: string;
8
+ awardKind: AwardKind;
9
+ awardDate: string;
10
+ gameId: number;
11
+ gameTitle: string;
12
+ consoleId: number;
13
+ consoleName: string;
14
+ }>;
15
+ }