Skip to content

Commit

Permalink
[WoW] Add support for Character Hunter Pets APIs
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Aug 10, 2024
1 parent 9a9714e commit 333fcda
Show file tree
Hide file tree
Showing 5 changed files with 70 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/twelve-radios-sleep.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blizzard-api/wow': minor
---

Add support for Character Hunter Pets APIs
Original file line number Diff line number Diff line change
@@ -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);
});
});
14 changes: 14 additions & 0 deletions packages/wow/src/character-hunter-pets/character-hunter-pets.ts
Original file line number Diff line number Diff line change
@@ -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<CharacterHunterPetsSummaryResponse> {
return {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/hunter-pets`,
token,
};
}
25 changes: 25 additions & 0 deletions packages/wow/src/character-hunter-pets/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import type { Href, KeyBase, NameIdKey } from '../base';

export interface CharacterHunterPetsSummaryResponse {
_links: { self: Href };
character: Character;
hunter_pets: Array<HunterPet>;
}

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;
}
6 changes: 6 additions & 0 deletions packages/wow/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -214,6 +215,8 @@ export const wow = {
characterRaids,
//Character Equipment
characterEquipmentSummary,
//Character Hunter Pets
characterHunterPetsSummary,
//Connected Realm
connectedRealm,
connectedRealmIndex,
Expand Down Expand Up @@ -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';
Expand Down

0 comments on commit 333fcda

Please sign in to comment.