diff --git a/.changeset/twelve-radios-sleep.md b/.changeset/twelve-radios-sleep.md new file mode 100644 index 0000000..1f8917c --- /dev/null +++ b/.changeset/twelve-radios-sleep.md @@ -0,0 +1,5 @@ +--- +'@blizzard-api/wow': minor +--- + +Add support for Character Hunter Pets APIs diff --git a/packages/wow/src/character-hunter-pets/character-hunter-pets.test.ts b/packages/wow/src/character-hunter-pets/character-hunter-pets.test.ts new file mode 100644 index 0000000..d4cd550 --- /dev/null +++ b/packages/wow/src/character-hunter-pets/character-hunter-pets.test.ts @@ -0,0 +1,20 @@ +import { describe, expect, it } from 'vitest'; +import { characterHunterPetsSummary } from './character-hunter-pets'; + +describe('characterHunterPetsSummary', () => { + it('should return the correct ProtectedResource object', () => { + const realmSlug = 'testRealm'; + const characterName = 'testCharacter'; + const token = 'testToken'; + + const expectedResource = { + namespace: 'profile', + path: `/profile/wow/character/${realmSlug}/${characterName}/hunter-pets`, + token, + }; + + const result = characterHunterPetsSummary(realmSlug, characterName, token); + + expect(result).toEqual(expectedResource); + }); +}); diff --git a/packages/wow/src/character-hunter-pets/character-hunter-pets.ts b/packages/wow/src/character-hunter-pets/character-hunter-pets.ts new file mode 100644 index 0000000..f99feea --- /dev/null +++ b/packages/wow/src/character-hunter-pets/character-hunter-pets.ts @@ -0,0 +1,14 @@ +import type { ProtectedResource } from '@blizzard-api/core'; +import type { CharacterHunterPetsSummaryResponse } from './types'; + +export function characterHunterPetsSummary( + realmSlug: string, + characterName: string, + token: string, +): ProtectedResource { + return { + namespace: 'profile', + path: `/profile/wow/character/${realmSlug}/${characterName}/hunter-pets`, + token, + }; +} diff --git a/packages/wow/src/character-hunter-pets/types.ts b/packages/wow/src/character-hunter-pets/types.ts new file mode 100644 index 0000000..d131708 --- /dev/null +++ b/packages/wow/src/character-hunter-pets/types.ts @@ -0,0 +1,25 @@ +import type { Href, KeyBase, NameIdKey } from '../base'; + +export interface CharacterHunterPetsSummaryResponse { + _links: { self: Href }; + character: Character; + hunter_pets: Array; +} + +interface Realm extends NameIdKey { + slug: string; +} + +interface Character extends NameIdKey { + realm: Realm; +} + +interface HunterPet { + creature: NameIdKey; + creature_display: { id: number } & KeyBase; + is_active?: boolean; + is_summoned?: boolean; + level: number; + name: string; + slot: number; +} diff --git a/packages/wow/src/index.ts b/packages/wow/src/index.ts index 76fa24e..415e750 100644 --- a/packages/wow/src/index.ts +++ b/packages/wow/src/index.ts @@ -41,6 +41,7 @@ import { characterRaids, } from './character-encounters/character-encounters'; import { characterEquipmentSummary } from './character-equipment/character-equipment'; +import { characterHunterPetsSummary } from './character-hunter-pets/character-hunter-pets'; import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm'; import { conduit, @@ -214,6 +215,8 @@ export const wow = { characterRaids, //Character Equipment characterEquipmentSummary, + //Character Hunter Pets + characterHunterPetsSummary, //Connected Realm connectedRealm, connectedRealmIndex, @@ -404,6 +407,9 @@ export * from './character-encounters/types'; //Character Equipment export * from './character-equipment/character-equipment'; export * from './character-equipment/types'; +//Character Hunter Pets +export * from './character-hunter-pets/character-hunter-pets'; +export * from './character-hunter-pets/types'; //Connected Realm export * from './connected-realm/connected-realm'; export * from './connected-realm/types';