-
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 Hunter Pets APIs
- Loading branch information
Showing
5 changed files
with
70 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 Hunter Pets APIs |
20 changes: 20 additions & 0 deletions
20
packages/wow/src/character-hunter-pets/character-hunter-pets.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 { 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
14
packages/wow/src/character-hunter-pets/character-hunter-pets.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 { 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, | ||
}; | ||
} |
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,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; | ||
} |
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