-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[WoW] Add support for Character Appearance APIs
- Loading branch information
Showing
5 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@blizzard-api/wow': minor | ||
--- | ||
|
||
Add support for Character Appearance APIs |
20 changes: 20 additions & 0 deletions
20
packages/wow/src/character-appearance/character-appearance.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { describe, expect, it } from 'vitest'; | ||
import { characterAppearanceSummary } from './character-appearance'; | ||
|
||
describe('characterAppearanceSummary', () => { | ||
it('should return the correct ProtectedResource object', () => { | ||
const realmSlug = 'test-realm'; | ||
const characterName = 'test-character'; | ||
const token = 'test-token'; | ||
|
||
const expectedResource = { | ||
namespace: 'profile', | ||
path: '/profile/wow/character/test-realm/test-character/appearance', | ||
token: 'test-token', | ||
}; | ||
|
||
const result = characterAppearanceSummary(realmSlug, characterName, token); | ||
|
||
expect(result).toEqual(expectedResource); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/wow/src/character-appearance/character-appearance.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
import type { ProtectedResource } from '@blizzard-api/core'; | ||
import type { CharacterAppearanceResponse } from './types'; | ||
|
||
export function characterAppearanceSummary( | ||
realmSlug: string, | ||
characterName: string, | ||
token: string, | ||
): ProtectedResource<CharacterAppearanceResponse> { | ||
return { | ||
namespace: 'profile', | ||
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/appearance`, | ||
token, | ||
}; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
import type { Color, Faction, Gender, Href, KeyBase, NameId, NameIdKey } from '../base'; | ||
|
||
export interface CharacterAppearanceResponse { | ||
_links: { self: Href }; | ||
active_spec: NameIdKey; | ||
character: Character; | ||
customizations: Array<Customization>; | ||
faction: Faction; | ||
gender: Gender; | ||
guild_crest: GuildCrest; | ||
items: Array<Item>; | ||
playable_class: NameIdKey; | ||
playable_race: NameIdKey; | ||
} | ||
|
||
interface Character extends NameIdKey { | ||
realm: { slug: string } & NameIdKey; | ||
} | ||
|
||
interface Customization { | ||
choice: Choice; | ||
option: NameId; | ||
} | ||
|
||
interface Choice { | ||
display_order: number; | ||
id: number; | ||
name?: string; | ||
} | ||
|
||
interface GuildCrest { | ||
background: { color: RGBWithId }; | ||
border: BorderEmblem; | ||
emblem: BorderEmblem; | ||
} | ||
|
||
interface RGBWithId { | ||
id: number; | ||
rgba: Color; | ||
} | ||
|
||
interface BorderEmblem { | ||
color: RGBWithId; | ||
id: number; | ||
media: { id: number } & KeyBase; | ||
} | ||
|
||
interface Item { | ||
enchant: number; | ||
id: number; | ||
internal_slot_id: number; | ||
item_appearance_modifier_id: number; | ||
slot: { name: string; type: string }; | ||
subclass: number; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters