-
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 Soulbinds APIs
- Loading branch information
Showing
5 changed files
with
89 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 Soulbinds APIs |
20 changes: 20 additions & 0 deletions
20
packages/wow/src/character-soulbinds/character-soulbinds.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 { characterSoulbinds } from './character-soulbinds'; | ||
|
||
describe('characterSoulbinds', () => { | ||
it('returns the correct ProtectedResource object', () => { | ||
const realmSlug = 'example-realm'; | ||
const characterName = 'example-character'; | ||
const token = 'example-token'; | ||
|
||
const expectedResource = { | ||
namespace: 'profile', | ||
path: '/profile/wow/character/example-realm/example-character/soulbinds', | ||
token: 'example-token', | ||
}; | ||
|
||
const result = characterSoulbinds(realmSlug, characterName, token); | ||
|
||
expect(result).toEqual(expectedResource); | ||
}); | ||
}); |
14 changes: 14 additions & 0 deletions
14
packages/wow/src/character-soulbinds/character-soulbinds.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 { CharacterSoulbindsResponse } from './types'; | ||
|
||
export function characterSoulbinds( | ||
realmSlug: string, | ||
characterName: string, | ||
token: string, | ||
): ProtectedResource<CharacterSoulbindsResponse> { | ||
return { | ||
namespace: 'profile', | ||
path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/soulbinds`, | ||
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,44 @@ | ||
import type { NameIdKey, ResponseBase } from '../base'; | ||
|
||
export interface CharacterSoulbindsResponse extends ResponseBase { | ||
character: Character; | ||
chosen_covenant: NameIdKey; | ||
renown_level: number; | ||
soulbinds: Array<Soulbind>; | ||
} | ||
|
||
interface Realm extends NameIdKey { | ||
slug: string; | ||
} | ||
|
||
interface Character extends NameIdKey { | ||
realm: Realm; | ||
} | ||
|
||
interface Soulbind { | ||
is_active?: boolean; | ||
soulbind: NameIdKey; | ||
traits: Array<Trait>; | ||
} | ||
|
||
interface Trait { | ||
conduit_socket?: ConduitSocket; | ||
display_order: number; | ||
tier: number; | ||
trait?: NameIdKey; | ||
} | ||
|
||
interface ConduitSocket { | ||
socket: Socket; | ||
type: TypeClass; | ||
} | ||
|
||
interface Socket { | ||
conduit: NameIdKey; | ||
rank: number; | ||
} | ||
|
||
interface TypeClass { | ||
name: 'Endurance Conduit Slot' | 'Finesse Conduit Slot' | 'Potency Conduit Slot'; | ||
type: 'ENDURANCE' | 'FINESSE' | 'POTENCY'; | ||
} |
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