Skip to content

Commit

Permalink
Showing 5 changed files with 132 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/light-snakes-try.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blizzard-api/wow': minor
---

Add support for Character Mythic Keystone Profile APIs
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import { describe, expect, it } from 'vitest';
import {
characterMythicKeystoneProfileIndex,
characterMythicKeystoneSeasonDetails,
} from './character-mythic-keystone-profile';

describe('Character Mythic Keystone Profile', () => {
it('should return the correct ProtectedResource object for characterMythicKeystoneProfileIndex', () => {
const realmSlug = 'realm';
const characterName = 'character';
const token = 'token';

const result = characterMythicKeystoneProfileIndex(realmSlug, characterName, token);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile`,
token,
});
});

it('should return the correct ProtectedResource object for characterMythicKeystoneSeasonDetails', () => {
const realmSlug = 'realm';
const characterName = 'character';
const seasonId = 123;
const token = 'token';

const result = characterMythicKeystoneSeasonDetails(realmSlug, characterName, seasonId, token);

expect(result).toEqual({
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile/season/${seasonId}`,
token,
});
});
});
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import type { ProtectedResource } from '@blizzard-api/core';
import type {
CharacterMythicKeystoneProfileIndexResponse,
CharacterMythicKeystoneSeasonDetailsResponse,
} from './types';

export function characterMythicKeystoneProfileIndex(
realmSlug: string,
characterName: string,
token: string,
): ProtectedResource<CharacterMythicKeystoneProfileIndexResponse> {
return {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile`,
token,
};
}

export function characterMythicKeystoneSeasonDetails(
realmSlug: string,
characterName: string,
seasonId: number,
token: string,
): ProtectedResource<CharacterMythicKeystoneSeasonDetailsResponse> {
return {
namespace: 'profile',
path: `/profile/wow/character/${realmSlug}/${characterName}/mythic-keystone-profile/season/${seasonId}`,
token,
};
}
51 changes: 51 additions & 0 deletions packages/wow/src/character-mythic-keystone-profile/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
import type { Color, Href, KeyBase, NameId, NameIdKey } from '../base';

export interface CharacterMythicKeystoneProfileIndexResponse {
_links: { self: Href };
character: Character;
current_period: CurrentPeriod;
seasons: Array<{ id: number } & KeyBase>;
}

interface Realm extends NameIdKey {
slug: string;
}

interface Character extends NameIdKey {
realm: Realm;
}

interface CurrentPeriod {
period: { id: number } & KeyBase;
}

export interface CharacterMythicKeystoneSeasonDetailsResponse {
_links: { self: Href };
best_runs: Array<BestRun>;
character: NameIdKey;
mythic_rating: MythicRating;
season: { id: number } & KeyBase;
}

interface BestRun {
completed_timestamp: number;
dungeon: NameIdKey;
duration: number;
is_completed_within_time: boolean;
keystone_affixes: Array<NameIdKey>;
keystone_level: number;
members: Array<Member>;
mythic_rating: MythicRating;
}

interface Member {
character: { realm: Realm } & NameId;
equipped_item_level: number;
race: NameIdKey;
specialization: NameIdKey;
}

interface MythicRating {
color: Color;
rating: number;
}
10 changes: 10 additions & 0 deletions packages/wow/src/index.ts
Original file line number Diff line number Diff line change
@@ -43,6 +43,10 @@ import {
import { characterEquipmentSummary } from './character-equipment/character-equipment';
import { characterHunterPetsSummary } from './character-hunter-pets/character-hunter-pets';
import { characterMediaSummary } from './character-media/character-media';
import {
characterMythicKeystoneProfileIndex,
characterMythicKeystoneSeasonDetails,
} from './character-mythic-keystone-profile/character-mythic-keystone-profile';
import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm';
import {
conduit,
@@ -220,6 +224,9 @@ export const wow = {
characterHunterPetsSummary,
//Character Media
characterMediaSummary,
//Character Mythic Keystone Profile
characterMythicKeystoneProfileIndex,
characterMythicKeystoneSeasonDetails,
//Connected Realm
connectedRealm,
connectedRealmIndex,
@@ -416,6 +423,9 @@ export * from './character-hunter-pets/types';
//Character Media
export * from './character-media/character-media';
export * from './character-media/types';
//Character Mythic Keystone Profile
export * from './character-mythic-keystone-profile/character-mythic-keystone-profile';
export * from './character-mythic-keystone-profile/types';
//Connected Realm
export * from './connected-realm/connected-realm';
export * from './connected-realm/types';

0 comments on commit 455d766

Please sign in to comment.