From 5d72a7962cf69e99c5e737d77f5ce19347031a0e Mon Sep 17 00:00:00 2001 From: Wes Copeland Date: Sat, 2 Dec 2023 08:40:50 -0500 Subject: [PATCH] feat(getUserAwards): add types and logic for beaten awards (#51) --- docs/v1/users/get-user-awards.md | 2 ++ src/user/getUserAwards.test.ts | 4 ++++ src/user/getUserAwards.ts | 2 ++ src/user/models/award-type.model.ts | 9 +++++---- src/user/models/get-user-awards-response.model.ts | 2 ++ src/user/models/user-awards.model.ts | 2 ++ 6 files changed, 17 insertions(+), 4 deletions(-) diff --git a/docs/v1/users/get-user-awards.md b/docs/v1/users/get-user-awards.md index 993141e..12b4019 100644 --- a/docs/v1/users/get-user-awards.md +++ b/docs/v1/users/get-user-awards.md @@ -18,6 +18,8 @@ const userAwards = await getUserAwards(authorization, { userName: "xelnia" }); "hiddenAwardsCount": 2, "masteryAwardsCount": 6, "completionAwardsCount": 0, + "beatenHardcoreAwardsCount": 24, + "beatenSoftcoreAwardsCount": 7, "eventAwardsCount": 0, "siteAwardsCount": 2, "visibleUserAwards": [ diff --git a/src/user/getUserAwards.test.ts b/src/user/getUserAwards.test.ts index b1174c5..1b2c45d 100644 --- a/src/user/getUserAwards.test.ts +++ b/src/user/getUserAwards.test.ts @@ -31,6 +31,8 @@ describe("Function: getUserAwards", () => { HiddenAwardsCount: 5, MasteryAwardsCount: 5, CompletionAwardsCount: 0, + BeatenHardcoreAwardsCount: 24, + BeatenSoftcoreAwardsCount: 7, EventAwardsCount: 0, SiteAwardsCount: 0, VisibleUserAwards: [ @@ -63,6 +65,8 @@ describe("Function: getUserAwards", () => { hiddenAwardsCount: 5, masteryAwardsCount: 5, completionAwardsCount: 0, + beatenHardcoreAwardsCount: 24, + beatenSoftcoreAwardsCount: 7, eventAwardsCount: 0, siteAwardsCount: 0, visibleUserAwards: [ diff --git a/src/user/getUserAwards.ts b/src/user/getUserAwards.ts index d2f7676..c1f752f 100644 --- a/src/user/getUserAwards.ts +++ b/src/user/getUserAwards.ts @@ -31,6 +31,8 @@ import type { GetUserAwardsResponse, UserAwards } from "./models"; * hiddenAwardsCount: 2, * masteryAwardsCount: 6, * completionAwardsCount: 0, + * beatenHardcoreAwardsCount: 24, + * beatenSoftcoreAwardsCount: 7, * eventAwardsCount: 0, * siteAwardsCount: 2, * visibleUserAwards: [ diff --git a/src/user/models/award-type.model.ts b/src/user/models/award-type.model.ts index ebaf6c9..5a298b1 100644 --- a/src/user/models/award-type.model.ts +++ b/src/user/models/award-type.model.ts @@ -1,7 +1,8 @@ export type AwardType = - | "Mastery/Completion" - | "Achievement Unlocks Yield" | "Achievement Points Yield" - | "Patreon Supporter" + | "Achievement Unlocks Yield" | "Certified Legend" - | "Invalid or deprecated award type"; + | "Game Beaten" + | "Invalid or deprecated award type" + | "Mastery/Completion" + | "Patreon Supporter"; diff --git a/src/user/models/get-user-awards-response.model.ts b/src/user/models/get-user-awards-response.model.ts index d8a4f2c..ad9c770 100644 --- a/src/user/models/get-user-awards-response.model.ts +++ b/src/user/models/get-user-awards-response.model.ts @@ -17,6 +17,8 @@ export interface GetUserAwardsResponse { HiddenAwardsCount: number; MasteryAwardsCount: number; CompletionAwardsCount: number; + BeatenHardcoreAwardsCount: number; + BeatenSoftcoreAwardsCount: number; EventAwardsCount: number; SiteAwardsCount: number; VisibleUserAwards: GetUserAwardsEntity[]; diff --git a/src/user/models/user-awards.model.ts b/src/user/models/user-awards.model.ts index 9dbbe3e..36c19b8 100644 --- a/src/user/models/user-awards.model.ts +++ b/src/user/models/user-awards.model.ts @@ -17,6 +17,8 @@ export interface UserAwards { hiddenAwardsCount: number; masteryAwardsCount: number; completionAwardsCount: number; + beatenHardcoreAwardsCount: number; + beatenSoftcoreAwardsCount: number; eventAwardsCount: number; siteAwardsCount: number; visibleUserAwards: UserAward[];