-
Notifications
You must be signed in to change notification settings - Fork 1
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 Equipment APIs
- Loading branch information
Showing
5 changed files
with
211 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 Equipment APIs |
20 changes: 20 additions & 0 deletions
20
packages/wow/src/character-equipment/character-equipment.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 { characterEquipmentSummary } from './character-equipment'; | ||
|
||
describe('characterEquipmentSummary', () => { | ||
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/equipment', | ||
token: 'test-token', | ||
}; | ||
|
||
const result = characterEquipmentSummary(realmSlug, characterName, token); | ||
|
||
expect(result).toEqual(expectedResource); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/wow/src/character-equipment/character-equipment.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 { CharacterEquipmentSummaryResponse } from './types'; | ||
|
||
export function characterEquipmentSummary( | ||
realmSlug: string, | ||
characterName: string, | ||
token: string, | ||
): ProtectedResource<CharacterEquipmentSummaryResponse> { | ||
return { | ||
namespace: 'profile', | ||
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/equipment`, | ||
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,166 @@ | ||
import type { Color, Href, KeyBase, NameIdKey } from '../base'; | ||
|
||
export interface CharacterEquipmentSummaryResponse { | ||
_links: { self: Href }; | ||
character: Character; | ||
equipped_item_sets: Array<Set>; | ||
equipped_items: Array<EquippedItem>; | ||
} | ||
|
||
interface Realm extends NameIdKey { | ||
slug: string; | ||
} | ||
|
||
interface Character extends NameIdKey { | ||
realm: Realm; | ||
} | ||
|
||
interface Set { | ||
display_string: string; | ||
effects: Array<Effect>; | ||
item_set: NameIdKey; | ||
items: Array<ItemElement>; | ||
} | ||
|
||
interface Effect { | ||
display_string: string; | ||
is_active: boolean; | ||
required_count: number; | ||
} | ||
|
||
interface ItemElement extends NameIdKey { | ||
is_equipped?: boolean; | ||
} | ||
|
||
interface EquippedItem { | ||
armor?: Armor; | ||
binding: NameType; | ||
bonus_list?: Array<number>; | ||
context: number; | ||
description?: string; | ||
durability?: DisplayStringValue; | ||
enchantments?: Array<Enchantment>; | ||
inventory_type: NameType; | ||
is_subclass_hidden?: boolean; | ||
item: { id: number } & KeyBase; | ||
item_class: NameIdKey; | ||
item_subclass: NameIdKey; | ||
level: DisplayStringValue; | ||
limit_category?: string; | ||
media: { id: number } & KeyBase; | ||
modified_appearance_id?: number; | ||
modified_crafting_stat?: Array<ModifiedCraftingStat>; | ||
name: string; | ||
name_description: NameDescription; | ||
quality: NameType; | ||
quantity: number; | ||
requirements?: Requirements; | ||
sell_price?: SellPrice; | ||
set?: Set; | ||
slot: NameType; | ||
sockets?: Array<Socket>; | ||
spells?: Array<Spell>; | ||
stats?: Array<Stat>; | ||
transmog?: Transmog; | ||
unique_equipped?: string; | ||
weapon?: Weapon; | ||
} | ||
|
||
interface Armor { | ||
display: NameDescription; | ||
value: number; | ||
} | ||
|
||
interface NameDescription { | ||
color: Color; | ||
display_string: string; | ||
} | ||
|
||
interface NameType { | ||
name: string; | ||
type: string; | ||
} | ||
|
||
interface DisplayStringValue { | ||
display_string: string; | ||
value: number; | ||
} | ||
|
||
interface Enchantment { | ||
display_string: string; | ||
enchantment_id: number; | ||
enchantment_slot: EnchantmentSlot; | ||
source_item?: NameIdKey; | ||
} | ||
|
||
interface EnchantmentSlot { | ||
id: number; | ||
type: string; | ||
} | ||
|
||
interface ModifiedCraftingStat { | ||
id: number; | ||
name: string; | ||
type: string; | ||
} | ||
|
||
interface Requirements { | ||
level: DisplayStringValue; | ||
playable_classes?: PlayableClasses; | ||
} | ||
|
||
interface PlayableClasses { | ||
display_string: string; | ||
links: Array<NameIdKey>; | ||
} | ||
|
||
interface SellPrice { | ||
display_strings: DisplayStrings; | ||
value: number; | ||
} | ||
|
||
interface DisplayStrings { | ||
copper: string; | ||
gold: string; | ||
header: string; | ||
silver: string; | ||
} | ||
|
||
interface Socket { | ||
display_string: string; | ||
item: NameIdKey; | ||
media: { id: number } & KeyBase; | ||
socket_type: NameType; | ||
} | ||
|
||
interface Spell { | ||
description: string; | ||
spell: NameIdKey; | ||
} | ||
|
||
interface Stat { | ||
display: NameDescription; | ||
is_equip_bonus?: boolean; | ||
is_negated?: boolean; | ||
type: NameType; | ||
value: number; | ||
} | ||
|
||
interface Transmog { | ||
display_string: string; | ||
item: NameIdKey; | ||
item_modified_appearance_id: number; | ||
} | ||
|
||
interface Weapon { | ||
attack_speed: DisplayStringValue; | ||
damage: Damage; | ||
dps: DisplayStringValue; | ||
} | ||
|
||
interface Damage { | ||
damage_class: NameType; | ||
display_string: string; | ||
max_value: number; | ||
min_value: 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