Skip to content

Commit

Permalink
[Core] Separate Resource keys for simplicity and maintenancee
Browse files Browse the repository at this point in the history
  • Loading branch information
Pewtro committed Mar 28, 2024
1 parent 3d9b073 commit 512f778
Show file tree
Hide file tree
Showing 7 changed files with 46 additions and 32 deletions.
5 changes: 5 additions & 0 deletions .changeset/two-dodos-sparkle.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@blizzard-api/wow': patch
---

Shuffle around files a bit and separate resource keys for simplicity and maintenance
36 changes: 36 additions & 0 deletions packages/wow/src/achievements/index.ts
Original file line number Diff line number Diff line change
@@ -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<AchievementCategoryResponse> => {
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' };
},
};
3 changes: 3 additions & 0 deletions packages/wow/src/achievements/response.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
export interface AchievementCategoryResponse {
id: number;
}
File renamed without changes.
25 changes: 0 additions & 25 deletions packages/wow/src/game-data/achievement.ts

This file was deleted.

5 changes: 0 additions & 5 deletions packages/wow/src/game-data/index.ts

This file was deleted.

4 changes: 2 additions & 2 deletions packages/wow/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { gameDataApi } from './game-data';
import { achievements } from './achievements';

export const wow = {
...gameDataApi,
...achievements,
};

0 comments on commit 512f778

Please sign in to comment.