diff --git a/.changeset/giant-bats-marry.md b/.changeset/giant-bats-marry.md new file mode 100644 index 0000000..7c1ccab --- /dev/null +++ b/.changeset/giant-bats-marry.md @@ -0,0 +1,5 @@ +--- +'@blizzard-api/wow': minor +--- + +Add support for Character Soulbinds APIs diff --git a/packages/wow/src/character-soulbinds/character-soulbinds.test.ts b/packages/wow/src/character-soulbinds/character-soulbinds.test.ts new file mode 100644 index 0000000..c3ff90a --- /dev/null +++ b/packages/wow/src/character-soulbinds/character-soulbinds.test.ts @@ -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); + }); +}); diff --git a/packages/wow/src/character-soulbinds/character-soulbinds.ts b/packages/wow/src/character-soulbinds/character-soulbinds.ts new file mode 100644 index 0000000..b3aa868 --- /dev/null +++ b/packages/wow/src/character-soulbinds/character-soulbinds.ts @@ -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 { + return { + namespace: 'profile', + path: `/profile/wow/character/${realmSlug}/${characterName.toLowerCase()}/soulbinds`, + token, + }; +} diff --git a/packages/wow/src/character-soulbinds/types.ts b/packages/wow/src/character-soulbinds/types.ts new file mode 100644 index 0000000..e4936a1 --- /dev/null +++ b/packages/wow/src/character-soulbinds/types.ts @@ -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; +} + +interface Realm extends NameIdKey { + slug: string; +} + +interface Character extends NameIdKey { + realm: Realm; +} + +interface Soulbind { + is_active?: boolean; + soulbind: NameIdKey; + traits: Array; +} + +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'; +} diff --git a/packages/wow/src/index.ts b/packages/wow/src/index.ts index 8a46309..6f4a7a9 100644 --- a/packages/wow/src/index.ts +++ b/packages/wow/src/index.ts @@ -52,6 +52,7 @@ import { characterProfileStatus, characterProfileSummary } from './character-pro import { characterPvpSummary } from './character-pvp/character-pvp'; import { characterCompletedQuests, characterQuests } from './character-quests/character-quests'; import { characterReputationsSummary } from './character-reputations/character-reputations'; +import { characterSoulbinds } from './character-soulbinds/character-soulbinds'; import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm'; import { conduit, @@ -244,6 +245,8 @@ export const wow = { characterQuests, //Character Reputations characterReputationsSummary, + //Character Soulbinds + characterSoulbinds, //Connected Realm connectedRealm, connectedRealmIndex, @@ -458,6 +461,9 @@ export * from './character-quests/types'; //Character Reputations export * from './character-reputations/character-reputations'; export * from './character-reputations/types'; +//Character Soulbinds +export * from './character-soulbinds/character-soulbinds'; +export * from './character-soulbinds/types'; //Connected Realm export * from './connected-realm/connected-realm'; export * from './connected-realm/types';