From 512f778b9c4a2714b81ca1c55228f8ee0b336f10 Mon Sep 17 00:00:00 2001 From: Putro <29204244+Pewtro@users.noreply.github.com> Date: Thu, 28 Mar 2024 11:59:27 +0100 Subject: [PATCH] [Core] Separate Resource keys for simplicity and maintenancee --- .changeset/two-dodos-sparkle.md | 5 ++++ packages/wow/src/achievements/index.ts | 36 +++++++++++++++++++++++ packages/wow/src/achievements/response.ts | 3 ++ packages/wow/src/{game-data => }/base.ts | 0 packages/wow/src/game-data/achievement.ts | 25 ---------------- packages/wow/src/game-data/index.ts | 5 ---- packages/wow/src/index.ts | 4 +-- 7 files changed, 46 insertions(+), 32 deletions(-) create mode 100644 .changeset/two-dodos-sparkle.md create mode 100644 packages/wow/src/achievements/index.ts create mode 100644 packages/wow/src/achievements/response.ts rename packages/wow/src/{game-data => }/base.ts (100%) delete mode 100644 packages/wow/src/game-data/achievement.ts delete mode 100644 packages/wow/src/game-data/index.ts 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, };