diff --git a/.changeset/two-dodos-sparkle.md b/.changeset/two-dodos-sparkle.md new file mode 100644 index 0000000..398c787 --- /dev/null +++ b/.changeset/two-dodos-sparkle.md @@ -0,0 +1,5 @@ +--- +'@blizzard-api/wow': patch +--- + +Shuffle around files a bit and separate resource keys for simplicity and maintenance diff --git a/packages/wow/src/achievements/index.ts b/packages/wow/src/achievements/index.ts new file mode 100644 index 0000000..169c4d1 --- /dev/null +++ b/packages/wow/src/achievements/index.ts @@ -0,0 +1,36 @@ +import type { Resource } from '@blizzard-api/core'; +import { base, mediaBase } from '../base'; +import type { AchievementCategoryResponse } from './response'; + +const achievementBase = `${base}/achievement`; +const achievementCategoryBase = `${base}/achievement-category`; + +export const achievements = { + achievementCategory: (achievementCategoryId: number): Resource => { + return { + path: `${achievementCategoryBase}/${achievementCategoryId}`, + namespace: 'static', + }; + }, + achievementCategoryIndex: (): Resource => { + return { + path: `${achievementCategoryBase}/index`, + namespace: 'static', + }; + }, + achievement: (achievementId: number): Resource => { + return { + path: `${achievementBase}/${achievementId}`, + namespace: 'static', + }; + }, + achievementIndex: (): Resource => { + return { + path: `${achievementBase}/index`, + namespace: 'static', + }; + }, + media: (achievementId: number): Resource => { + return { path: `${mediaBase}/achievement/${achievementId}`, namespace: 'static' }; + }, +}; diff --git a/packages/wow/src/achievements/response.ts b/packages/wow/src/achievements/response.ts new file mode 100644 index 0000000..62e79c1 --- /dev/null +++ b/packages/wow/src/achievements/response.ts @@ -0,0 +1,3 @@ +export interface AchievementCategoryResponse { + id: number; +} diff --git a/packages/wow/src/game-data/base.ts b/packages/wow/src/base.ts similarity index 100% rename from packages/wow/src/game-data/base.ts rename to packages/wow/src/base.ts diff --git a/packages/wow/src/game-data/achievement.ts b/packages/wow/src/game-data/achievement.ts deleted file mode 100644 index 571e819..0000000 --- a/packages/wow/src/game-data/achievement.ts +++ /dev/null @@ -1,25 +0,0 @@ -import type { Resource } from '@blizzard-api/core'; -import { base, mediaBase } from './base'; - -const achievementBase = `${base}/achievement`; -const achievementCategoryBase = `${base}/achievement-category`; - -export const achievement = { - achievementCategory: (achievementCategoryId?: number): Resource => { - return { - path: achievementCategoryId - ? `${achievementCategoryBase}/${achievementCategoryId}` - : `${achievementCategoryBase}/index`, - namespace: 'static', - }; - }, - achievement: (achievementId?: number): Resource => { - return { - path: achievementId ? `${achievementBase}/${achievementId}` : `${achievementBase}/index`, - namespace: 'static', - }; - }, - media: (achievementId: number): Resource => { - return { path: `${mediaBase}/achievement/${achievementId}`, namespace: 'static' }; - }, -}; diff --git a/packages/wow/src/game-data/index.ts b/packages/wow/src/game-data/index.ts deleted file mode 100644 index 2f36106..0000000 --- a/packages/wow/src/game-data/index.ts +++ /dev/null @@ -1,5 +0,0 @@ -import { achievement } from './achievement'; - -export const gameDataApi = { - achievement, -}; diff --git a/packages/wow/src/index.ts b/packages/wow/src/index.ts index 0aed9ae..e6f9ed3 100644 --- a/packages/wow/src/index.ts +++ b/packages/wow/src/index.ts @@ -1,5 +1,5 @@ -import { gameDataApi } from './game-data'; +import { achievements } from './achievements'; export const wow = { - ...gameDataApi, + ...achievements, };