diff options
author | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 13:56:19 -0600 |
---|---|---|
committer | mat <27899617+mat-1@users.noreply.github.com> | 2021-02-13 13:56:19 -0600 |
commit | a23103ec24128f2e24b93ad101ade6dfdd4758c3 (patch) | |
tree | c4d543a2003062a7c213d37f5d06a826c2a88798 /cleaners/player.ts | |
parent | d7b9d1fc5cfc8c648604eb1d178091873ea698a6 (diff) | |
download | skyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.tar.gz skyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.tar.bz2 skyblock-api-a23103ec24128f2e24b93ad101ade6dfdd4758c3.zip |
Basic profile stats
Diffstat (limited to 'cleaners/player.ts')
-rw-r--r-- | cleaners/player.ts | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/cleaners/player.ts b/cleaners/player.ts new file mode 100644 index 0000000..c3afd6f --- /dev/null +++ b/cleaners/player.ts @@ -0,0 +1,28 @@ +import { CleanBasicProfile, cleanPlayerSkyblockProfiles, Included } from '../hypixel' +import { CleanSocialMedia, parseSocialMedia } from './socialmedia' +import { CleanRank, parseRank } from './rank' +import { HypixelPlayer } from '../hypixelApi' +import { undashUuid } from '../util' + +export interface CleanBasicPlayer { + uuid: string + username: string +} + +export interface CleanPlayer extends CleanBasicPlayer { + rank: CleanRank + socials: CleanSocialMedia + profiles?: CleanBasicProfile[] +} + +export async function cleanPlayerResponse(data: HypixelPlayer): Promise<CleanPlayer> { + // Cleans up a 'player' api response + console.log('cleanPlayerResponse', data.stats.SkyBlock.profiles) + return { + uuid: undashUuid(data.uuid), + username: data.displayname, + rank: parseRank(data), + socials: parseSocialMedia(data.socialMedia), + profiles: cleanPlayerSkyblockProfiles(data.stats.SkyBlock.profiles) + } +} |