diff --git a/.changeset/cold-clocks-hang.md b/.changeset/cold-clocks-hang.md new file mode 100644 index 0000000..87e2bec --- /dev/null +++ b/.changeset/cold-clocks-hang.md @@ -0,0 +1,6 @@ +--- +'@blizzard-api/classic-wow': minor +'@blizzard-api/wow': minor +--- + +Additionally export functionality from the root rather than only from the named wow/classicWow export diff --git a/README.md b/README.md index b0b17d0..b23cc5a 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,6 @@ # @blizzard-api/\* -The @blizzard-api collection aims to help you connect to the Blizzard Battle.net API as easily and painlessly as possible. - -## NOTE: STILL EARLY STAGES - -I am still in very early stages of development and the API can and will break a few times during development. Once a package is v1 or above, they will follow semantic versioning, but until then they should be considered experimental at best. +The @blizzard-api collection aims to help you connect to the Blizzard Battle.net API as easily and painlessly as possible. The packages are split up by game, and will contain all the endpoints, parameters, and responses you need to get started. ## Installation @@ -30,10 +26,13 @@ The core package gives you access to helper functions such as `getBlizzardApi` w The game package will let you access paths, namespaces, parameters and more for each endpoint. This can imported like so: ```ts -import { wow } from "@blizzard-api/wow" +import { achievement, wow } from "@blizzard-api/wow" const achievement = wow.achievement(123); ^ { path: string, namespace: string } +//OR LIKE SO +const achievement = achievement(123); + ^ { path: string, namespace: string } ``` If you additionally want to have a axios client with built in helpers, you can install `@blizzard-api/client` which will let you easily connect to the API and begin consuming it. @@ -67,10 +66,7 @@ Please refer to the [battle.net documentation](https://develop.battle.net/docume This list is generally prioritized but no promises that things will be addressed in this order. -- Release 1.0.0 of `@blizzard-api/client`, `@blizzard-api/core`, and `@blizzard-api/wow`. - Add a package for the following games/flavours - - World of Warcraft Classic - Diablo III - Hearthstone - - Overwatch League - StarCraft II diff --git a/package.json b/package.json index 6cf8780..034cc79 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,7 @@ "diablo", "d3", "hs", - "hearthstone", - "ow", - "overwatch" + "hearthstone" ], "devDependencies": { "@changesets/cli": "2.27.2", diff --git a/packages/classic-wow/README.md b/packages/classic-wow/README.md index 5786592..676b990 100644 --- a/packages/classic-wow/README.md +++ b/packages/classic-wow/README.md @@ -15,14 +15,14 @@ You can get paths, namespaces, parameters and more for a specific endpoint by ca ```ts import { classicWow } from "@blizzard-api/classic-wow" -const achievement = classicWow.achievement(123); +const powerType = classicWow.powerType("static-classic", 123); ^ { path: string, namespace: string } ``` If you need the response types, they are also exported with "Response" appended, so to get the response type from the above code, you can import it like this: ```ts -import type { AchievementResponse } from '@blizzard-api/classic-wow'; +import type { PowerTypeResponse } from '@blizzard-api/classic-wow'; ``` If you simply want to use the existing object, you can use the helper from `@blizzard-api/core` like so: @@ -30,9 +30,19 @@ If you simply want to use the existing object, you can use the helper from `@bli ```ts import { classicWow } from "@blizzard-api/classic-wow" -const achievement = classicWow.achievement(123); +const powerType = classicWow.powerType("static-classic", 123); ^ { path: string, namespace: string } -type AchievementResponse = ExtractResourceType; +type PowerTypeResponse = ExtractResourceType; +``` + +If you don't want to use the exported classicWow object, you can also access the functions directly: + +```ts +import { powerType } from "@blizzard-api/wow" + +const powerType = powerType("static-classic", 123); + ^ { path: string, namespace: string } +type PowerTypeResponse = ExtractResourceType; ``` ## Differences to @blizzard-api/wow diff --git a/packages/classic-wow/src/auction-house/auction-house.test.ts b/packages/classic-wow/src/auction-house/auction-house.test.ts index bf8f74e..46a746b 100644 --- a/packages/classic-wow/src/auction-house/auction-house.test.ts +++ b/packages/classic-wow/src/auction-house/auction-house.test.ts @@ -1,5 +1,5 @@ import { describe, it } from 'vitest'; -import { classicAuctionHouseApi } from './auction-house'; +import * as classicAuctionHouseApi from './auction-house'; describe.concurrent('classicAuctionHouseApi', () => { it('should return the correct resource for auctionHouseIndex', ({ expect }) => { diff --git a/packages/classic-wow/src/auction-house/auction-house.ts b/packages/classic-wow/src/auction-house/auction-house.ts index 86a0640..bdf38b1 100644 --- a/packages/classic-wow/src/auction-house/auction-house.ts +++ b/packages/classic-wow/src/auction-house/auction-house.ts @@ -2,41 +2,39 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base } from '../../../wow/src/base'; import type { AuctionHouseIndexResponse, AuctionsResponse } from './types'; -export const classicAuctionHouseApi = { - /** - * Returns an index of auction houses for a connected realm. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param connectedRealmId The ID of the connected realm. - * @returns The auction house index. See {@link AuctionHouseIndexResponse}. - */ - auctionHouseIndex: ( - namespace: Extract, - connectedRealmId: number, - ): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}/auctions/index`, - namespace, - }; - }, - /** - * Returns all active auctions for a specific auction house on a connected realm. - * - * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice. - * - * Depending on the number of active auctions on the specified connected realm, the response from this endpoint may be rather large, sometimes exceeding 10 MB. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param connectedRealmId The ID of the connected realm. - * @param auctionHouseId The ID of the auction house. - * @returns The auction house data. See {@link AuctionsResponse}. - */ - auctions: ( - namespace: Extract, - connectedRealmId: number, - auctionHouseId: number, - ): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}/auctions/${auctionHouseId}`, - namespace, - }; - }, -}; +/** + * Returns an index of auction houses for a connected realm. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param connectedRealmId The ID of the connected realm. + * @returns The auction house index. See {@link AuctionHouseIndexResponse}. + */ +export function auctionHouseIndex( + namespace: Extract, + connectedRealmId: number, +): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}/auctions/index`, + namespace, + }; +} +/** + * Returns all active auctions for a specific auction house on a connected realm. + * + * Auction house data updates at a set interval. The value was initially set at 1 hour; however, it might change over time without notice. + * + * Depending on the number of active auctions on the specified connected realm, the response from this endpoint may be rather large, sometimes exceeding 10 MB. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param connectedRealmId The ID of the connected realm. + * @param auctionHouseId The ID of the auction house. + * @returns The auction house data. See {@link AuctionsResponse}. + */ +export function auctions( + namespace: Extract, + connectedRealmId: number, + auctionHouseId: number, +): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}/auctions/${auctionHouseId}`, + namespace, + }; +} diff --git a/packages/classic-wow/src/connected-realm/connected-realm.test.ts b/packages/classic-wow/src/connected-realm/connected-realm.test.ts index da164ec..df874f9 100644 --- a/packages/classic-wow/src/connected-realm/connected-realm.test.ts +++ b/packages/classic-wow/src/connected-realm/connected-realm.test.ts @@ -1,6 +1,6 @@ import type { BlizzardNamespaces } from '@blizzard-api/core'; import { describe, it } from 'vitest'; -import { classicConnectedRealmApi } from '../connected-realm/connected-realm'; +import * as classicConnectedRealmApi from '../connected-realm/connected-realm'; const namespace: BlizzardNamespaces = 'dynamic-classic'; const namespace1x: BlizzardNamespaces = 'dynamic-classic1x'; diff --git a/packages/classic-wow/src/connected-realm/connected-realm.ts b/packages/classic-wow/src/connected-realm/connected-realm.ts index ce5b2d8..e3345ed 100644 --- a/packages/classic-wow/src/connected-realm/connected-realm.ts +++ b/packages/classic-wow/src/connected-realm/connected-realm.ts @@ -7,54 +7,52 @@ import type { ConnectedRealmSearchResponseItem, } from './types'; -export const classicConnectedRealmApi = { - /** - * Returns an index of connected realms. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The connected realm index. See {@link ConnectedRealmIndexResponse}. - */ - connectedRealmIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/connected-realm/index`, - namespace, - }; - }, - /** - * Returns a connected realm by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param connectedRealmId The connected realm ID. - * @returns The connected realm. See {@link ConnectedRealmResponse}. - */ - connectedRealm: ( - namespace: Extract, - connectedRealmId: number, - ): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}`, - namespace, - }; - }, - /** - * Performs a search of connected realms. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param options The search parameters. See {@link ConnectedRealmSearchParameters}. - * @returns The search results. See {@link SearchResponse} & {@link ConnectedRealmSearchResponseItem}. - */ - connectedRealmSearch: ( - namespace: Extract, - options: ConnectedRealmSearchParameters, - ): Resource, ConnectedRealmSearchParameters> => { - return { - namespace, - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - 'status.type': options['status.type'], - 'realms.timezone': options['realms.timezone'], - }, - path: `${base}/search/connected-realm`, - }; - }, -}; +/** + * Returns an index of connected realms. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The connected realm index. See {@link ConnectedRealmIndexResponse}. + */ +export function connectedRealmIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/connected-realm/index`, + namespace, + }; +} +/** + * Returns a connected realm by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param connectedRealmId The connected realm ID. + * @returns The connected realm. See {@link ConnectedRealmResponse}. + */ +export function connectedRealm( + namespace: Extract, + connectedRealmId: number, +): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}`, + namespace, + }; +} +/** + * Performs a search of connected realms. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param options The search parameters. See {@link ConnectedRealmSearchParameters}. + * @returns The search results. See {@link SearchResponse} & {@link ConnectedRealmSearchResponseItem}. + */ +export function connectedRealmSearch( + namespace: Extract, + options: ConnectedRealmSearchParameters, +): Resource, ConnectedRealmSearchParameters> { + return { + namespace, + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + 'status.type': options['status.type'], + 'realms.timezone': options['realms.timezone'], + }, + path: `${base}/search/connected-realm`, + }; +} diff --git a/packages/classic-wow/src/connected-realm/types.ts b/packages/classic-wow/src/connected-realm/types.ts index 2929030..1c171c9 100644 --- a/packages/classic-wow/src/connected-realm/types.ts +++ b/packages/classic-wow/src/connected-realm/types.ts @@ -1,2 +1,2 @@ //The classic version of the connected realm types are the same as the retail version. -export type * from '../../../wow/src/connected-realm/types.js'; +export type * from '../../../wow/src/connected-realm/types'; diff --git a/packages/classic-wow/src/creature/creature.test.ts b/packages/classic-wow/src/creature/creature.test.ts index 07d950a..343fbf4 100644 --- a/packages/classic-wow/src/creature/creature.test.ts +++ b/packages/classic-wow/src/creature/creature.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../../../wow/src/base'; -import { classicCreatureApi } from './creature'; +import * as classicCreatureApi from './creature'; describe.concurrent('classicCreatureApi', () => { const namespace = 'static-classic'; diff --git a/packages/classic-wow/src/creature/creature.ts b/packages/classic-wow/src/creature/creature.ts index cae03ea..82563c7 100644 --- a/packages/classic-wow/src/creature/creature.ts +++ b/packages/classic-wow/src/creature/creature.ts @@ -12,126 +12,124 @@ import type { CreatureTypeResponse, } from './types'; -export const classicCreatureApi = { - /** - * Returns a creature by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param creatureId The creature ID. - * @returns The creature. See {@link CreatureResponse}. - */ - creature: ( - namespace: Extract, - creatureId: number, - ): Resource => { - return { - path: `${base}/creature/${creatureId}`, - namespace, - }; - }, - /** - * Returns media for a creature display by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param creatureDisplayId The creature display ID. - * @returns The creature display media. See {@link CreatureDisplayMediaResponse}. - */ - creatureDisplayMedia: ( - namespace: Extract, - creatureDisplayId: number, - ): Resource => { - return { - path: `${mediaBase}/creature-display/${creatureDisplayId}`, - namespace, - }; - }, - /** - * Returns a creature family by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param creatureFamilyId The creature family ID. - * @returns The creature family. See {@link CreatureFamilyResponse}. - */ - creatureFamily: ( - namespace: Extract, - creatureFamilyId: number, - ): Resource => { - return { - path: `${base}/creature-family/${creatureFamilyId}`, - namespace, - }; - }, - /** - * Returns an index of creature families. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The creature family index. See {@link CreatureFamilyIndexResponse}. - */ - creatureFamilyIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/creature-family/index`, - namespace, - }; - }, - /** - * Returns media for a creature family by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param creatureFamilyId The creature family ID. - * @returns The creature family media. See {@link CreatureFamilyMediaResponse}. - */ - creatureFamilyMedia: ( - namespace: Extract, - creatureFamilyId: number, - ): Resource => { - return { - path: `${mediaBase}/creature-family/${creatureFamilyId}`, - namespace, - }; - }, - /** - * Returns a creature type by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param creatureTypeId The creature type ID. - * @returns The creature type. See {@link CreatureTypeResponse}. - */ - creatureType: ( - namespace: Extract, - creatureTypeId: number, - ): Resource => { - return { - path: `${base}/creature-type/${creatureTypeId}`, - namespace, - }; - }, - /** - * Returns an index of creature types. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The creature type index. See {@link CreatureTypeIndexResponse}. - */ - creatureTypeIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/creature-type/index`, - namespace, - }; - }, - /** - * Performs a search of creatures. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param options The creature search parameters. See {@link CreatureSearchParameters}. - * @returns The creature search results. See {@link SearchResponse} & {@link CreatureSearchResponseItem}. - */ - creatureSearch: ( - namespace: Extract, - options: CreatureSearchParameters, - ): Resource, Omit> => { - return { - namespace, - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/creature`, - }; - }, -}; +/** + * Returns a creature by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param creatureId The creature ID. + * @returns The creature. See {@link CreatureResponse}. + */ +export function creature( + namespace: Extract, + creatureId: number, +): Resource { + return { + path: `${base}/creature/${creatureId}`, + namespace, + }; +} +/** + * Returns media for a creature display by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param creatureDisplayId The creature display ID. + * @returns The creature display media. See {@link CreatureDisplayMediaResponse}. + */ +export function creatureDisplayMedia( + namespace: Extract, + creatureDisplayId: number, +): Resource { + return { + path: `${mediaBase}/creature-display/${creatureDisplayId}`, + namespace, + }; +} +/** + * Returns a creature family by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param creatureFamilyId The creature family ID. + * @returns The creature family. See {@link CreatureFamilyResponse}. + */ +export function creatureFamily( + namespace: Extract, + creatureFamilyId: number, +): Resource { + return { + path: `${base}/creature-family/${creatureFamilyId}`, + namespace, + }; +} +/** + * Returns an index of creature families. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The creature family index. See {@link CreatureFamilyIndexResponse}. + */ +export function creatureFamilyIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/creature-family/index`, + namespace, + }; +} +/** + * Returns media for a creature family by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param creatureFamilyId The creature family ID. + * @returns The creature family media. See {@link CreatureFamilyMediaResponse}. + */ +export function creatureFamilyMedia( + namespace: Extract, + creatureFamilyId: number, +): Resource { + return { + path: `${mediaBase}/creature-family/${creatureFamilyId}`, + namespace, + }; +} +/** + * Returns a creature type by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param creatureTypeId The creature type ID. + * @returns The creature type. See {@link CreatureTypeResponse}. + */ +export function creatureType( + namespace: Extract, + creatureTypeId: number, +): Resource { + return { + path: `${base}/creature-type/${creatureTypeId}`, + namespace, + }; +} +/** + * Returns an index of creature types. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The creature type index. See {@link CreatureTypeIndexResponse}. + */ +export function creatureTypeIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/creature-type/index`, + namespace, + }; +} +/** + * Performs a search of creatures. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param options The creature search parameters. See {@link CreatureSearchParameters}. + * @returns The creature search results. See {@link SearchResponse} & {@link CreatureSearchResponseItem}. + */ +export function creatureSearch( + namespace: Extract, + options: CreatureSearchParameters, +): Resource, Omit> { + return { + namespace, + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/creature`, + }; +} diff --git a/packages/classic-wow/src/creature/types.ts b/packages/classic-wow/src/creature/types.ts index 6e0b20c..3d4ac5a 100644 --- a/packages/classic-wow/src/creature/types.ts +++ b/packages/classic-wow/src/creature/types.ts @@ -1,2 +1,2 @@ //The classic version of the creature types are the same as the retail version. -export type * from '../../../wow/src/creature/types.js'; +export type * from '../../../wow/src/creature/types'; diff --git a/packages/classic-wow/src/guild-crest/guild-crest.test.ts b/packages/classic-wow/src/guild-crest/guild-crest.test.ts index 67388ae..7b879b7 100644 --- a/packages/classic-wow/src/guild-crest/guild-crest.test.ts +++ b/packages/classic-wow/src/guild-crest/guild-crest.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../../../wow/src/base'; -import { classicGuildCrestApi } from './guild-crest'; +import * as classicGuildCrestApi from './guild-crest'; const namespace = 'static-classic'; describe.concurrent('classicGuildCrestApi', () => { diff --git a/packages/classic-wow/src/guild-crest/guild-crest.ts b/packages/classic-wow/src/guild-crest/guild-crest.ts index e7df449..a390b38 100644 --- a/packages/classic-wow/src/guild-crest/guild-crest.ts +++ b/packages/classic-wow/src/guild-crest/guild-crest.ts @@ -2,48 +2,46 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base, mediaBase } from '../../../wow/src/base'; import type { GuildCrestBorderEmblemResponse, GuildCrestComponentsIndexResponse } from './types'; -export const classicGuildCrestApi = { - /** - * Returns an index of guild crest media. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The guild crest components index. See {@link GuildCrestComponentsIndexResponse}. - */ - guildCrestComponentsIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/guild-crest/index`, - namespace, - }; - }, - /** - * Returns media for a guild crest border by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param borderId The guild crest border ID. - * @returns The guild crest border. See {@link GuildCrestBorderEmblemResponse}. - */ - guildCrestBorder: ( - namespace: Extract, - borderId: number, - ): Resource => { - return { - path: `${mediaBase}/guild-crest/border/${borderId}`, - namespace, - }; - }, - /** - * Returns media for a guild crest emblem by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param emblemId The guild crest emblem ID. - * @returns The guild crest emblem. See {@link GuildCrestBorderEmblemResponse}. - */ - guildCrestEmblem: ( - namespace: Extract, - emblemId: number, - ): Resource => { - return { - path: `${mediaBase}/guild-crest/emblem/${emblemId}`, - namespace, - }; - }, -}; +/** + * Returns an index of guild crest media. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The guild crest components index. See {@link GuildCrestComponentsIndexResponse}. + */ +export function guildCrestComponentsIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/guild-crest/index`, + namespace, + }; +} +/** + * Returns media for a guild crest border by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param borderId The guild crest border ID. + * @returns The guild crest border. See {@link GuildCrestBorderEmblemResponse}. + */ +export function guildCrestBorder( + namespace: Extract, + borderId: number, +): Resource { + return { + path: `${mediaBase}/guild-crest/border/${borderId}`, + namespace, + }; +} +/** + * Returns media for a guild crest emblem by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param emblemId The guild crest emblem ID. + * @returns The guild crest emblem. See {@link GuildCrestBorderEmblemResponse}. + */ +export function guildCrestEmblem( + namespace: Extract, + emblemId: number, +): Resource { + return { + path: `${mediaBase}/guild-crest/emblem/${emblemId}`, + namespace, + }; +} diff --git a/packages/classic-wow/src/guild-crest/types.ts b/packages/classic-wow/src/guild-crest/types.ts index 1efb69d..934a3f3 100644 --- a/packages/classic-wow/src/guild-crest/types.ts +++ b/packages/classic-wow/src/guild-crest/types.ts @@ -1 +1 @@ -export type * from '../../../wow/src/guild-crest/types.js'; +export type * from '../../../wow/src/guild-crest/types'; diff --git a/packages/classic-wow/src/index.ts b/packages/classic-wow/src/index.ts index ff2b07d..8da2e53 100644 --- a/packages/classic-wow/src/index.ts +++ b/packages/classic-wow/src/index.ts @@ -1,52 +1,125 @@ -import { classicAuctionHouseApi } from './auction-house/auction-house'; -import { classicConnectedRealmApi } from './connected-realm/connected-realm'; -import { classicCreatureApi } from './creature/creature'; -import { classicGuildCrestApi } from './guild-crest/guild-crest'; -import { classicItemApi } from './item/item'; -import { classicMediaSearchApi } from './media-search/media-search'; -import { classicPlayableClassApi } from './playable-class/playable-class'; -import { classicPlayableRaceApi } from './playable-race/playable-race'; -import { classicPowerTypeApi } from './power-type/power-type'; -import { classicPvpSeasonApi } from './pvp-season/pvp-season'; -import { classicRealmApi } from './realm/realm'; -import { classicRegionApi } from './region/region'; +import { auctionHouseIndex, auctions } from './auction-house/auction-house'; +import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm'; +import { + creature, + creatureDisplayMedia, + creatureFamily, + creatureFamilyIndex, + creatureFamilyMedia, + creatureSearch, + creatureType, + creatureTypeIndex, +} from './creature/creature'; +import { guildCrestBorder, guildCrestComponentsIndex, guildCrestEmblem } from './guild-crest/guild-crest'; +import { item, itemClass, itemClassIndex, itemMedia, itemSearch, itemSubClass } from './item/item'; +import { mediaSearch } from './media-search/media-search'; +import { playableClass, playableClassIndex, playableClassMedia } from './playable-class/playable-class'; +import { playableRace, playableRaceIndex } from './playable-race/playable-race'; +import { powerType, powerTypeIndex } from './power-type/power-type'; +import { + pvpLeaderboard, + pvpLeaderboardIndex, + pvpRegionIndex, + pvpRegionalSeason, + pvpRegionalSeasonIndex, + pvpRewardsIndex, + pvpSeason, + pvpSeasonIndex, +} from './pvp-season/pvp-season'; +import { realm, realmIndex, realmSearch } from './realm/realm'; +import { region, regionIndex } from './region/region'; export const classicWow = { - ...classicAuctionHouseApi, - ...classicConnectedRealmApi, - ...classicCreatureApi, - ...classicGuildCrestApi, - ...classicItemApi, - ...classicMediaSearchApi, - ...classicPlayableClassApi, - ...classicPlayableRaceApi, - ...classicPowerTypeApi, - ...classicPvpSeasonApi, - ...classicRealmApi, - ...classicRegionApi, + //Auction House + auctionHouseIndex, + auctions, + //Connected Realm + connectedRealm, + connectedRealmIndex, + connectedRealmSearch, + //Creature + creature, + creatureDisplayMedia, + creatureFamily, + creatureFamilyIndex, + creatureFamilyMedia, + creatureType, + creatureTypeIndex, + creatureSearch, + //Guild Crest + guildCrestComponentsIndex, + guildCrestBorder, + guildCrestEmblem, + //Item + itemClassIndex, + itemClass, + itemSubClass, + item, + itemMedia, + itemSearch, + //Media Search + mediaSearch, + //Playable Class + playableClass, + playableClassIndex, + playableClassMedia, + //Playable Race + playableRace, + playableRaceIndex, + //Power Type + powerType, + powerTypeIndex, + //Pvp Season + pvpSeasonIndex, + pvpSeason, + pvpRegionIndex, + pvpRegionalSeasonIndex, + pvpRegionalSeason, + pvpLeaderboardIndex, + pvpLeaderboard, + pvpRewardsIndex, + //Realm + realm, + realmIndex, + realmSearch, + //Region + region, + regionIndex, }; //Auction House +export * from './auction-house/auction-house'; export type * from './auction-house/types'; //Connected Realm +export * from './connected-realm/connected-realm'; export type * from './connected-realm/types'; //Creature +export * from './creature/creature'; export type * from './creature/types'; //Guild Crest +export * from './guild-crest/guild-crest'; export type * from './guild-crest/types'; //Item -export type * from './item/types.js'; +export * from './item/item'; +export type * from './item/types'; //Media Search +export * from './media-search/media-search'; export type * from './media-search/types'; //Playable Class +export * from './playable-class/playable-class'; export type * from './playable-class/types'; //Playable Race -export type * from './playable-race/types.js'; +export * from './playable-race/playable-race'; +export type * from './playable-race/types'; //Power Type +export * from './power-type/power-type'; export type * from './power-type/types'; //Pvp Season +export * from './pvp-season/pvp-season'; export type * from './pvp-season/types'; //Realm +export * from './realm/realm'; export type * from './realm/types'; //Region +export * from './region/region'; export type * from './region/types'; diff --git a/packages/classic-wow/src/item/item.test.ts b/packages/classic-wow/src/item/item.test.ts index 6231c09..76563cb 100644 --- a/packages/classic-wow/src/item/item.test.ts +++ b/packages/classic-wow/src/item/item.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../../../wow/src/base'; -import { classicItemApi } from './item'; +import * as classicItemApi from './item'; import type { ItemSearchParameters } from './types'; const namespace = 'static-classic'; diff --git a/packages/classic-wow/src/item/item.ts b/packages/classic-wow/src/item/item.ts index e7fbbed..ed50463 100644 --- a/packages/classic-wow/src/item/item.ts +++ b/packages/classic-wow/src/item/item.ts @@ -10,100 +10,98 @@ import type { ItemSubClassResponse, } from './types'; -export const classicItemApi = { - /** - * Get an item class index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The item class index. See {@link ItemClassIndexResponse}. - */ - itemClassIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/item-class/index`, - namespace, - }; - }, - /** - * Get an item class by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param itemClassId The item class ID. - * @returns The item class. See {@link ItemClassResponse}. - */ - itemClass: ( - namespace: Extract, - itemClassId: number, - ): Resource => { - return { - namespace, - path: `${base}/item-class/${itemClassId}`, - }; - }, - /** - * Get an item subclass by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param itemClassId The item class ID. - * @param itemSubclassId The item subclass ID. - * @returns The item subclass. See {@link ItemSubClassResponse}. - */ - itemSubClass: ( - namespace: Extract, - itemClassId: number, - itemSubclassId: number, - ): Resource => { - return { - namespace, - path: `${base}/item-class/${itemClassId}/item-subclass/${itemSubclassId}`, - }; - }, - /** - * Get an item by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param itemId The item ID. - * @returns The item. See {@link ItemResponse}. - */ - item: ( - namespace: Extract, - itemId: number, - ): Resource => { - return { - namespace, - path: `${base}/item/${itemId}`, - }; - }, - /** - * Get item media by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param itemId The item ID. - * @returns The item media. See {@link ItemMediaResponse}. - */ - itemMedia: ( - namespace: Extract, - itemId: number, - ): Resource => { - return { - namespace, - path: `${mediaBase}/item/${itemId}`, - }; - }, - /** - * Search for items. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param options The search parameters. See {@link ItemSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - itemSearch: ( - namespace: Extract, - options: ItemSearchParameters, - ): Resource, Omit> => { - return { - namespace, - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/item`, - }; - }, -}; +/** + * Get an item class index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The item class index. See {@link ItemClassIndexResponse}. + */ +export function itemClassIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/item-class/index`, + namespace, + }; +} +/** + * Get an item class by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param itemClassId The item class ID. + * @returns The item class. See {@link ItemClassResponse}. + */ +export function itemClass( + namespace: Extract, + itemClassId: number, +): Resource { + return { + namespace, + path: `${base}/item-class/${itemClassId}`, + }; +} +/** + * Get an item subclass by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param itemClassId The item class ID. + * @param itemSubclassId The item subclass ID. + * @returns The item subclass. See {@link ItemSubClassResponse}. + */ +export function itemSubClass( + namespace: Extract, + itemClassId: number, + itemSubclassId: number, +): Resource { + return { + namespace, + path: `${base}/item-class/${itemClassId}/item-subclass/${itemSubclassId}`, + }; +} +/** + * Get an item by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param itemId The item ID. + * @returns The item. See {@link ItemResponse}. + */ +export function item( + namespace: Extract, + itemId: number, +): Resource { + return { + namespace, + path: `${base}/item/${itemId}`, + }; +} +/** + * Get item media by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param itemId The item ID. + * @returns The item media. See {@link ItemMediaResponse}. + */ +export function itemMedia( + namespace: Extract, + itemId: number, +): Resource { + return { + namespace, + path: `${mediaBase}/item/${itemId}`, + }; +} +/** + * Search for items. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param options The search parameters. See {@link ItemSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function itemSearch( + namespace: Extract, + options: ItemSearchParameters, +): Resource, Omit> { + return { + namespace, + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/item`, + }; +} diff --git a/packages/classic-wow/src/media-search/media-search.test.ts b/packages/classic-wow/src/media-search/media-search.test.ts index d88527f..f759813 100644 --- a/packages/classic-wow/src/media-search/media-search.test.ts +++ b/packages/classic-wow/src/media-search/media-search.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { searchBase } from '../../../wow/src/base'; -import { classicMediaSearchApi } from './media-search'; +import * as classicMediaSearchApi from './media-search'; const namespace = 'static-classic'; diff --git a/packages/classic-wow/src/media-search/media-search.ts b/packages/classic-wow/src/media-search/media-search.ts index 15fcea2..d114e1e 100644 --- a/packages/classic-wow/src/media-search/media-search.ts +++ b/packages/classic-wow/src/media-search/media-search.ts @@ -2,24 +2,22 @@ import type { BlizzardNamespaces, Resource, SearchResponse } from '@blizzard-api import { searchBase } from '../../../wow/src/base'; import type { MediaSearchParameters, MediaSearchResponseItem } from './types'; -export const classicMediaSearchApi = { - /** - * Search for media. - * @param options The search parameters. See {@link MediaSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - mediaSearch: ( - namespace: Extract, - options: MediaSearchParameters, - ): Resource, MediaSearchParameters> => { - return { - namespace, - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - tags: options.tags, - }, - path: `${searchBase}/media`, - }; - }, -}; +/** + * Search for media. + * @param options The search parameters. See {@link MediaSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function mediaSearch( + namespace: Extract, + options: MediaSearchParameters, +): Resource, MediaSearchParameters> { + return { + namespace, + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + tags: options.tags, + }, + path: `${searchBase}/media`, + }; +} diff --git a/packages/classic-wow/src/playable-class/playable-class.test.ts b/packages/classic-wow/src/playable-class/playable-class.test.ts index 0557b86..a22ea1e 100644 --- a/packages/classic-wow/src/playable-class/playable-class.test.ts +++ b/packages/classic-wow/src/playable-class/playable-class.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../../../wow/src/base'; -import { classicPlayableClassApi } from './playable-class'; +import * as classicPlayableClassApi from './playable-class'; const namespace = 'static-classic'; diff --git a/packages/classic-wow/src/playable-class/playable-class.ts b/packages/classic-wow/src/playable-class/playable-class.ts index 10f0ca4..03c89cd 100644 --- a/packages/classic-wow/src/playable-class/playable-class.ts +++ b/packages/classic-wow/src/playable-class/playable-class.ts @@ -2,48 +2,46 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base, mediaBase } from '../../../wow/src/base'; import type { PlayableClassIndexResponse, PlayableClassMediaResponse, PlayableClassResponse } from './types'; -export const classicPlayableClassApi = { - /** - * Get a playable class by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param playableClassId The playable class ID. - * @returns The playable class. See {@link PlayableClassResponse}. - */ - playableClass: ( - namespace: Extract, - playableClassId: number, - ): Resource => { - return { - namespace, - path: `${base}/playable-class/${playableClassId}`, - }; - }, - /** - * Get a playable class index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The playable class index. See {@link PlayableClassIndexResponse}. - */ - playableClassIndex: ( - namespace: Extract, - ): Resource => { - return { - namespace, - path: `${base}/playable-class/index`, - }; - }, - /** - * Get playable class media by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param playableClassId The playable class ID. - * @returns The playable class media. See {@link PlayableClassMediaResponse}. - */ - playableClassMedia: ( - namespace: Extract, - playableClassId: number, - ): Resource => { - return { - namespace, - path: `${mediaBase}/playable-class/${playableClassId}`, - }; - }, -}; +/** + * Get a playable class by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param playableClassId The playable class ID. + * @returns The playable class. See {@link PlayableClassResponse}. + */ +export function playableClass( + namespace: Extract, + playableClassId: number, +): Resource { + return { + namespace, + path: `${base}/playable-class/${playableClassId}`, + }; +} +/** + * Get a playable class index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The playable class index. See {@link PlayableClassIndexResponse}. + */ +export function playableClassIndex( + namespace: Extract, +): Resource { + return { + namespace, + path: `${base}/playable-class/index`, + }; +} +/** + * Get playable class media by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param playableClassId The playable class ID. + * @returns The playable class media. See {@link PlayableClassMediaResponse}. + */ +export function playableClassMedia( + namespace: Extract, + playableClassId: number, +): Resource { + return { + namespace, + path: `${mediaBase}/playable-class/${playableClassId}`, + }; +} diff --git a/packages/classic-wow/src/playable-race/playable-race.test.ts b/packages/classic-wow/src/playable-race/playable-race.test.ts index ffceeaa..06df633 100644 --- a/packages/classic-wow/src/playable-race/playable-race.test.ts +++ b/packages/classic-wow/src/playable-race/playable-race.test.ts @@ -1,7 +1,7 @@ import type { BlizzardNamespaces } from '@blizzard-api/core'; import { describe, it } from 'vitest'; import { base } from '../../../wow/src/base'; -import { classicPlayableRaceApi } from './playable-race'; +import * as classicPlayableRaceApi from './playable-race'; const namespace: BlizzardNamespaces = 'static-classic1x'; describe.concurrent('playableRaceApi', () => { diff --git a/packages/classic-wow/src/playable-race/playable-race.ts b/packages/classic-wow/src/playable-race/playable-race.ts index 3302ba5..19affa8 100644 --- a/packages/classic-wow/src/playable-race/playable-race.ts +++ b/packages/classic-wow/src/playable-race/playable-race.ts @@ -2,33 +2,31 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base } from '../../../wow/src/base'; import type { PlayableRaceIndexResponse, PlayableRaceResponse } from './types'; -export const classicPlayableRaceApi = { - /** - * Get a playable race by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param playableRaceId The playable race ID. - * @returns The playable race. See {@link PlayableRaceResponse}. - */ - playableRace: ( - namespace: Extract, - playableRaceId: number, - ): Resource => { - return { - namespace, - path: `${base}/playable-race/${playableRaceId}`, - }; - }, - /** - * Get a playable race index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The playable race index. See {@link PlayableRaceIndexResponse}. - */ - playableRaceIndex: ( - namespace: Extract, - ): Resource => { - return { - namespace, - path: `${base}/playable-race/index`, - }; - }, -}; +/** + * Get a playable race by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param playableRaceId The playable race ID. + * @returns The playable race. See {@link PlayableRaceResponse}. + */ +export function playableRace( + namespace: Extract, + playableRaceId: number, +): Resource { + return { + namespace, + path: `${base}/playable-race/${playableRaceId}`, + }; +} +/** + * Get a playable race index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The playable race index. See {@link PlayableRaceIndexResponse}. + */ +export function playableRaceIndex( + namespace: Extract, +): Resource { + return { + namespace, + path: `${base}/playable-race/index`, + }; +} diff --git a/packages/classic-wow/src/playable-race/types.ts b/packages/classic-wow/src/playable-race/types.ts index 3d9ed26..14af7f6 100644 --- a/packages/classic-wow/src/playable-race/types.ts +++ b/packages/classic-wow/src/playable-race/types.ts @@ -1 +1 @@ -export type * from '../../../wow/src/playable-race/types.js'; +export type * from '../../../wow/src/playable-race/types'; diff --git a/packages/classic-wow/src/power-type/power-type.test.ts b/packages/classic-wow/src/power-type/power-type.test.ts index b8f49fc..2d159c0 100644 --- a/packages/classic-wow/src/power-type/power-type.test.ts +++ b/packages/classic-wow/src/power-type/power-type.test.ts @@ -1,7 +1,7 @@ import type { BlizzardNamespaces } from '@blizzard-api/core'; import { describe, it } from 'vitest'; import { base } from '../../../wow/src/base'; -import { classicPowerTypeApi } from './power-type'; +import * as classicPowerTypeApi from './power-type'; const namespace: BlizzardNamespaces = 'static-classic1x'; diff --git a/packages/classic-wow/src/power-type/power-type.ts b/packages/classic-wow/src/power-type/power-type.ts index c480cfb..f5af794 100644 --- a/packages/classic-wow/src/power-type/power-type.ts +++ b/packages/classic-wow/src/power-type/power-type.ts @@ -2,33 +2,31 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base } from '../../../wow/src/base'; import type { PowerTypeIndexResponse, PowerTypeResponse } from './types'; -export const classicPowerTypeApi = { - /** - * Get a power type by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param powerTypeId The power type ID. - * @returns The power type. See {@link PowerTypeResponse}. - */ - powerType: ( - namespace: Extract, - powerTypeId: number, - ): Resource => { - return { - namespace, - path: `${base}/power-type/${powerTypeId}`, - }; - }, - /** - * Get a power type index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The power type index. See {@link PowerTypeIndexResponse}. - */ - powerTypeIndex: ( - namespace: Extract, - ): Resource => { - return { - namespace, - path: `${base}/power-type/index`, - }; - }, -}; +/** + * Get a power type by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param powerTypeId The power type ID. + * @returns The power type. See {@link PowerTypeResponse}. + */ +export function powerType( + namespace: Extract, + powerTypeId: number, +): Resource { + return { + namespace, + path: `${base}/power-type/${powerTypeId}`, + }; +} +/** + * Get a power type index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The power type index. See {@link PowerTypeIndexResponse}. + */ +export function powerTypeIndex( + namespace: Extract, +): Resource { + return { + namespace, + path: `${base}/power-type/index`, + }; +} diff --git a/packages/classic-wow/src/power-type/types.ts b/packages/classic-wow/src/power-type/types.ts index 096fbc6..bc627af 100644 --- a/packages/classic-wow/src/power-type/types.ts +++ b/packages/classic-wow/src/power-type/types.ts @@ -1 +1 @@ -export type * from '../../../wow/src/power-type/types.js'; +export type * from '../../../wow/src/power-type/types'; diff --git a/packages/classic-wow/src/pvp-season/pvp-season.test.ts b/packages/classic-wow/src/pvp-season/pvp-season.test.ts index 6845740..bbf644e 100644 --- a/packages/classic-wow/src/pvp-season/pvp-season.test.ts +++ b/packages/classic-wow/src/pvp-season/pvp-season.test.ts @@ -1,7 +1,7 @@ import type { BlizzardNamespaces } from '@blizzard-api/core'; import { describe, it } from 'vitest'; import { base } from '../../../wow/src/base'; -import { classicPvpSeasonApi } from './pvp-season'; +import * as classicPvpSeasonApi from './pvp-season'; const namespace: BlizzardNamespaces = 'dynamic-classic'; diff --git a/packages/classic-wow/src/pvp-season/pvp-season.ts b/packages/classic-wow/src/pvp-season/pvp-season.ts index 63a82c3..5bf6c44 100644 --- a/packages/classic-wow/src/pvp-season/pvp-season.ts +++ b/packages/classic-wow/src/pvp-season/pvp-season.ts @@ -2,125 +2,123 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base } from '../../../wow/src/base'; import type { PvpSeasonIndexResponse, PvpSeasonResponse } from './types'; -export const classicPvpSeasonApi = { - /** - * Get a PvP season index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. - */ - pvpSeasonIndex: ( - namespace: Extract, - ): Resource => { - return { - namespace, - path: `${base}/pvp-season/index`, - }; - }, - /** - * Get a PvP season by ID. - * @param pvpSeasonId The PvP season ID. - * @returns The PvP season. See {@link PvpSeasonResponse}. - */ - pvpSeason: ( - namespace: Extract, - pvpSeasonId: number, - ): Resource => { - return { - namespace, - path: `${base}/pvp-season/${pvpSeasonId}`, - }; - }, - /** - * Returns an index of PvP Regions. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - */ - pvpRegionIndex: ( - namespace: Extract, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/index`, - }; - }, - /** - * Returns an index of PvP Seasons in a PvP region. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param pvpRegionId The PvP region ID. - * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. - */ - pvpRegionalSeasonIndex: ( - namespace: Extract, - pvpRegionId: number, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/${pvpRegionId}/pvp-season/index`, - }; - }, - /** - * Returns a PvP season by region ID and season ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param pvpRegionId The PvP region ID. - * @param pvpSeasonId The PvP season ID. - */ - pvpRegionalSeason: ( - namespace: Extract, - pvpRegionId: number, - pvpSeasonId: number, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}`, - }; - }, - /** - * Returns an index of PvP leaderboards for a PvP season in a given PvP region. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param pvpRegionId The PvP region ID. - * @param pvpSeasonId The PvP season ID. - */ - pvpLeaderboardIndex: ( - namespace: Extract, - pvpRegionId: number, - pvpSeasonId: number, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-leaderboard/index`, - }; - }, - /** - * Get a PvP leaderboard by PvP season ID and bracket. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param pvpRegionId The PvP region ID. - * @param pvpSeasonId The PvP season ID. - * @param pvpBracket The PvP bracket. - */ - pvpLeaderboard: ( - namespace: Extract, - pvpRegionId: number, - pvpSeasonId: number, - pvpBracket: string, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-leaderboard/${pvpBracket}`, - }; - }, - /** - * Returns an index of PvP rewards for a PvP season in a given PvP region. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param pvpRegionId The PvP region ID. - * @param pvpSeasonId The PvP season ID. - */ - pvpRewardsIndex: ( - namespace: Extract, - pvpRegionId: number, - pvpSeasonId: number, - ): Resource => { - return { - namespace, - path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-reward/index`, - }; - }, -}; +/** + * Get a PvP season index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. + */ +export function pvpSeasonIndex( + namespace: Extract, +): Resource { + return { + namespace, + path: `${base}/pvp-season/index`, + }; +} +/** + * Get a PvP season by ID. + * @param pvpSeasonId The PvP season ID. + * @returns The PvP season. See {@link PvpSeasonResponse}. + */ +export function pvpSeason( + namespace: Extract, + pvpSeasonId: number, +): Resource { + return { + namespace, + path: `${base}/pvp-season/${pvpSeasonId}`, + }; +} +/** + * Returns an index of PvP Regions. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + */ +export function pvpRegionIndex( + namespace: Extract, +): Resource { + return { + namespace, + path: `${base}/pvp-region/index`, + }; +} +/** + * Returns an index of PvP Seasons in a PvP region. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param pvpRegionId The PvP region ID. + * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. + */ +export function pvpRegionalSeasonIndex( + namespace: Extract, + pvpRegionId: number, +): Resource { + return { + namespace, + path: `${base}/pvp-region/${pvpRegionId}/pvp-season/index`, + }; +} +/** + * Returns a PvP season by region ID and season ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param pvpRegionId The PvP region ID. + * @param pvpSeasonId The PvP season ID. + */ +export function pvpRegionalSeason( + namespace: Extract, + pvpRegionId: number, + pvpSeasonId: number, +): Resource { + return { + namespace, + path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}`, + }; +} +/** + * Returns an index of PvP leaderboards for a PvP season in a given PvP region. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param pvpRegionId The PvP region ID. + * @param pvpSeasonId The PvP season ID. + */ +export function pvpLeaderboardIndex( + namespace: Extract, + pvpRegionId: number, + pvpSeasonId: number, +): Resource { + return { + namespace, + path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-leaderboard/index`, + }; +} +/** + * Get a PvP leaderboard by PvP season ID and bracket. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param pvpRegionId The PvP region ID. + * @param pvpSeasonId The PvP season ID. + * @param pvpBracket The PvP bracket. + */ +export function pvpLeaderboard( + namespace: Extract, + pvpRegionId: number, + pvpSeasonId: number, + pvpBracket: string, +): Resource { + return { + namespace, + path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-leaderboard/${pvpBracket}`, + }; +} +/** + * Returns an index of PvP rewards for a PvP season in a given PvP region. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param pvpRegionId The PvP region ID. + * @param pvpSeasonId The PvP season ID. + */ +export function pvpRewardsIndex( + namespace: Extract, + pvpRegionId: number, + pvpSeasonId: number, +): Resource { + return { + namespace, + path: `${base}/pvp-region/${pvpRegionId}/pvp-season/${pvpSeasonId}/pvp-reward/index`, + }; +} diff --git a/packages/classic-wow/src/pvp-season/types.ts b/packages/classic-wow/src/pvp-season/types.ts index 7208574..5a831cc 100644 --- a/packages/classic-wow/src/pvp-season/types.ts +++ b/packages/classic-wow/src/pvp-season/types.ts @@ -1 +1 @@ -export type { PvpSeasonIndexResponse, PvpSeasonResponse } from '../../../wow/src/pvp-season/types.js'; +export type { PvpSeasonIndexResponse, PvpSeasonResponse } from '../../../wow/src/pvp-season/types'; diff --git a/packages/classic-wow/src/realm/realm.test.ts b/packages/classic-wow/src/realm/realm.test.ts index 17b40fd..376f728 100644 --- a/packages/classic-wow/src/realm/realm.test.ts +++ b/packages/classic-wow/src/realm/realm.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, searchBase } from '../../../wow/src/base'; -import { classicRealmApi } from './realm'; +import * as classicRealmApi from './realm'; import type { RealmSearchParameters } from './types'; const namespace = 'dynamic-classic'; diff --git a/packages/classic-wow/src/realm/realm.ts b/packages/classic-wow/src/realm/realm.ts index a4730e3..3c05770 100644 --- a/packages/classic-wow/src/realm/realm.ts +++ b/packages/classic-wow/src/realm/realm.ts @@ -2,53 +2,51 @@ import type { BlizzardNamespaces, Resource, SearchResponse } from '@blizzard-api import { base, searchBase } from '../../../wow/src/base'; import type { RealmIndexResponse, RealmResponse, RealmSearchParameters, RealmSearchResponseItem } from './types'; -export const classicRealmApi = { - /** - * Get a realm by slug. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param realmSlug The realm slug. - * @returns The realm. See {@link RealmResponse}. - */ - realm: ( - namespace: Extract, - realmSlug: string, - ): Resource => { - return { - path: `${base}/realm/${realmSlug}`, - namespace, - }; - }, - /** - * Get a realm index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The realm index. See {@link RealmIndexResponse}. - */ - realmIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/realm/index`, - namespace, - }; - }, - /** - * Search for realms. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param options The search parameters. See {@link RealmSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - realmSearch: ( - namespace: Extract, - options: RealmSearchParameters, - ): Resource, RealmSearchParameters> => { - return { - namespace, - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - timezone: options.timezone, - }, - path: `${searchBase}/realm`, - }; - }, -}; +/** + * Get a realm by slug. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param realmSlug The realm slug. + * @returns The realm. See {@link RealmResponse}. + */ +export function realm( + namespace: Extract, + realmSlug: string, +): Resource { + return { + path: `${base}/realm/${realmSlug}`, + namespace, + }; +} +/** + * Get a realm index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The realm index. See {@link RealmIndexResponse}. + */ +export function realmIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/realm/index`, + namespace, + }; +} +/** + * Search for realms. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param options The search parameters. See {@link RealmSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function realmSearch( + namespace: Extract, + options: RealmSearchParameters, +): Resource, RealmSearchParameters> { + return { + namespace, + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + timezone: options.timezone, + }, + path: `${searchBase}/realm`, + }; +} diff --git a/packages/classic-wow/src/region/region.test.ts b/packages/classic-wow/src/region/region.test.ts index dafe27c..2f8388a 100644 --- a/packages/classic-wow/src/region/region.test.ts +++ b/packages/classic-wow/src/region/region.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../../../wow/src/base'; -import { classicRegionApi } from './region'; +import * as classicRegionApi from './region'; describe.concurrent('classicRegionApi', () => { it('should return the region resource', ({ expect }) => { diff --git a/packages/classic-wow/src/region/region.ts b/packages/classic-wow/src/region/region.ts index 64829b0..f3dc013 100644 --- a/packages/classic-wow/src/region/region.ts +++ b/packages/classic-wow/src/region/region.ts @@ -2,33 +2,31 @@ import type { BlizzardNamespaces, Resource } from '@blizzard-api/core'; import { base } from '../../../wow/src/base'; import type { RegionIndexResponse, RegionResponse } from './types'; -export const classicRegionApi = { - /** - * Get a region by ID. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @param regionId The region ID. - * @returns The region. See {@link RegionResponse}. - */ - region: ( - namespace: Extract, - regionId: number, - ): Resource => { - return { - path: `${base}/region/${regionId}`, - namespace, - }; - }, - /** - * Get a region index. - * @param namespace The namespace to use. See {@link BlizzardNamespaces}. - * @returns The region index. See {@link RegionIndexResponse}. - */ - regionIndex: ( - namespace: Extract, - ): Resource => { - return { - path: `${base}/region/index`, - namespace, - }; - }, -}; +/** + * Get a region by ID. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @param regionId The region ID. + * @returns The region. See {@link RegionResponse}. + */ +export function region( + namespace: Extract, + regionId: number, +): Resource { + return { + path: `${base}/region/${regionId}`, + namespace, + }; +} +/** + * Get a region index. + * @param namespace The namespace to use. See {@link BlizzardNamespaces}. + * @returns The region index. See {@link RegionIndexResponse}. + */ +export function regionIndex( + namespace: Extract, +): Resource { + return { + path: `${base}/region/index`, + namespace, + }; +} diff --git a/packages/core/src/index.ts b/packages/core/src/index.ts index c32e4a2..d6071da 100644 --- a/packages/core/src/index.ts +++ b/packages/core/src/index.ts @@ -1,11 +1,11 @@ //Blizzard API -export * from './blizzard-api.js'; +export * from './blizzard-api'; //Namespace -export * from './namespace.js'; +export * from './namespace'; //Resource -export * from './resource.js'; +export * from './resource'; //Search -export * from './search.js'; +export * from './search'; diff --git a/packages/wow/README.md b/packages/wow/README.md index b9f663f..63c5d48 100644 --- a/packages/wow/README.md +++ b/packages/wow/README.md @@ -35,6 +35,16 @@ const achievement = wow.achievement(123); type AchievementResponse = ExtractResourceType; ``` +If you don't want to use the exported wow object, you can also access the functions directly: + +```ts +import { achievement } from "@blizzard-api/wow" + +const achievement = achievement(123); + ^ { path: string, namespace: string } +type AchievementResponse = ExtractResourceType; +``` + ## Differences to @blizzard-api/classic-wow This package is specifically for World of Warcraft (retail or modern), and as such, the endpoints and responses are different from the classic variants. If you are looking for the classic version of World of Warcraft, you should use `@blizzard-api/classic-wow` instead. diff --git a/packages/wow/src/achievements/achievements.test.ts b/packages/wow/src/achievements/achievements.test.ts index fa6ce97..f4b0cbc 100644 --- a/packages/wow/src/achievements/achievements.test.ts +++ b/packages/wow/src/achievements/achievements.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; -import { base, mediaBase } from '../base.js'; -import { achievementApi } from './achievements.js'; +import { base, mediaBase } from '../base'; +import * as achievementApi from './achievements'; describe.concurrent('Achievements', () => { it('should return correct path and namespace for achievementCategory', ({ expect }) => { diff --git a/packages/wow/src/achievements/achievements.ts b/packages/wow/src/achievements/achievements.ts index febff34..f31f482 100644 --- a/packages/wow/src/achievements/achievements.ts +++ b/packages/wow/src/achievements/achievements.ts @@ -11,55 +11,53 @@ import type { const achievementBase = `${base}/achievement`; const achievementCategoryBase = `${base}/achievement-category`; -export const achievementApi = { - /** - * Get an achievement category by ID. - * @param achievementCategoryId The achievement category ID. - * @returns The achievement category. See {@link AchievementCategoryResponse}. - */ - achievementCategory: (achievementCategoryId: number): Resource => { - return { - path: `${achievementCategoryBase}/${achievementCategoryId}`, - namespace: 'static', - }; - }, - /** - * Get an achievement category index. - * @returns The achievement category index. See {@link AchievementCategoryIndexResponse}. - */ - achievementCategoryIndex: (): Resource => { - return { - path: `${achievementCategoryBase}/index`, - namespace: 'static', - }; - }, - /** - * Get an achievement by ID. - * @param achievementId The achievement ID. - * @returns The achievement. See {@link AchievementResponse}. - */ - achievement: (achievementId: number): Resource => { - return { - path: `${achievementBase}/${achievementId}`, - namespace: 'static', - }; - }, - /** - * Get an achievement index. - * @returns The achievement index. See {@link AchievementIndexResponse}. - */ - achievementIndex: (): Resource => { - return { - path: `${achievementBase}/index`, - namespace: 'static', - }; - }, - /** - * Get achievement media by ID. - * @param achievementId The achievement ID. - * @returns The achievement media. See {@link AchievementMediaResponse}. - */ - achievementMedia: (achievementId: number): Resource => { - return { path: `${mediaBase}/achievement/${achievementId}`, namespace: 'static' }; - }, -}; +/** + * Get an achievement category by ID. + * @param achievementCategoryId The achievement category ID. + * @returns The achievement category. See {@link AchievementCategoryResponse}. + */ +export function achievementCategory(achievementCategoryId: number): Resource { + return { + path: `${achievementCategoryBase}/${achievementCategoryId}`, + namespace: 'static', + }; +} +/** + * Get an achievement category index. + * @returns The achievement category index. See {@link AchievementCategoryIndexResponse}. + */ +export function achievementCategoryIndex(): Resource { + return { + path: `${achievementCategoryBase}/index`, + namespace: 'static', + }; +} +/** + * Get an achievement by ID. + * @param achievementId The achievement ID. + * @returns The achievement. See {@link AchievementResponse}. + */ +export function achievement(achievementId: number): Resource { + return { + path: `${achievementBase}/${achievementId}`, + namespace: 'static', + }; +} +/** + * Get an achievement index. + * @returns The achievement index. See {@link AchievementIndexResponse}. + */ +export function achievementIndex(): Resource { + return { + path: `${achievementBase}/index`, + namespace: 'static', + }; +} +/** + * Get achievement media by ID. + * @param achievementId The achievement ID. + * @returns The achievement media. See {@link AchievementMediaResponse}. + */ +export function achievementMedia(achievementId: number): Resource { + return { path: `${mediaBase}/achievement/${achievementId}`, namespace: 'static' }; +} diff --git a/packages/wow/src/auction-house/auction-house.test.ts b/packages/wow/src/auction-house/auction-house.test.ts index 628658a..874d6d6 100644 --- a/packages/wow/src/auction-house/auction-house.test.ts +++ b/packages/wow/src/auction-house/auction-house.test.ts @@ -1,5 +1,5 @@ import { describe, it } from 'vitest'; -import { auctionHouseApi } from './auction-house'; +import * as auctionHouseApi from './auction-house'; describe.concurrent('auctionHouse', () => { it('should return the correct resource for auctions', ({ expect }) => { diff --git a/packages/wow/src/auction-house/auction-house.ts b/packages/wow/src/auction-house/auction-house.ts index 6677d1b..81d66e1 100644 --- a/packages/wow/src/auction-house/auction-house.ts +++ b/packages/wow/src/auction-house/auction-house.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { AuctionHouseCommoditiesResponse, AuctionHouseResponse } from './types'; -export const auctionHouseApi = { - /** - * Get auction house data for a connected realm. - * @param connectedRealmId The ID of the connected realm. - * @returns The auction house data. See {@link AuctionHouseResponse}. - */ - auctions: (connectedRealmId: number): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}/auctions`, - namespace: 'dynamic', - }; - }, - /** - * Get auction house data for all connected realms. - * @returns The auction house data. See {@link AuctionHouseResponse}. - */ - commodities: (): Resource => { - return { - path: `${base}/auctions/commodities`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get auction house data for a connected realm. + * @param connectedRealmId The ID of the connected realm. + * @returns The auction house data. See {@link AuctionHouseResponse}. + */ +export function auctions(connectedRealmId: number): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}/auctions`, + namespace: 'dynamic', + }; +} +/** + * Get auction house data for all connected realms. + * @returns The auction house data. See {@link AuctionHouseResponse}. + */ +export function commodities(): Resource { + return { + path: `${base}/auctions/commodities`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/azerite-essence/azerite-essence.test.ts b/packages/wow/src/azerite-essence/azerite-essence.test.ts index 2447d8a..a7d31bd 100644 --- a/packages/wow/src/azerite-essence/azerite-essence.test.ts +++ b/packages/wow/src/azerite-essence/azerite-essence.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../base'; -import { azeriteEssenceApi } from './azerite-essence'; +import * as azeriteEssenceApi from './azerite-essence'; describe.concurrent('azeriteEssenceApi', () => { it('should return the correct path and namespace for azeriteEssence', ({ expect }) => { diff --git a/packages/wow/src/azerite-essence/azerite-essence.ts b/packages/wow/src/azerite-essence/azerite-essence.ts index 64daf80..4cc106b 100644 --- a/packages/wow/src/azerite-essence/azerite-essence.ts +++ b/packages/wow/src/azerite-essence/azerite-essence.ts @@ -8,52 +8,50 @@ import type { AzeriteEssenceSearchResponseItem, } from './types'; -export const azeriteEssenceApi = { - /** - * Get an azerite essence by ID. - * @param azeriteEssenceId The azerite essence ID. - * @returns The azerite essence. See {@link AzeriteEssenceResponse}. - */ - azeriteEssence: (azeriteEssenceId: number): Resource => { - return { - path: `${base}/azerite-essence/${azeriteEssenceId}`, - namespace: 'static', - }; - }, - /** - * Get an azerite essence index. - * @returns The azerite essence index. See {@link AzeriteEssenceIndexResponse}. - */ - azeriteEssenceIndex: (): Resource => { - return { - path: `${base}/azerite-essence/index`, - namespace: 'static', - }; - }, - /** - * Get azerite essence media by ID. - * @param azeriteEssenceId The azerite essence ID. - * @returns The azerite essence media. See {@link AzeriteEssenceMediaResponse}. - */ - azeriteEssenceMedia: (azeriteEssenceId: number): Resource => { - return { path: `${mediaBase}/azerite-essence/${azeriteEssenceId}`, namespace: 'static' }; - }, - /** - * Search for azerite essences. - * @param options The search parameters. See {@link AzeriteEssenceSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - azeriteEssenceSearch: ( - options: AzeriteEssenceSearchParameters, - ): Resource, AzeriteEssenceSearchParameters> => { - return { - path: `${searchBase}/azerite-essence`, - namespace: 'static', - parameters: { - _page: options._page, - 'allowed_specializations.id': options['allowed_specializations.id'], - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - }, - }; - }, -}; +/** + * Get an azerite essence by ID. + * @param azeriteEssenceId The azerite essence ID. + * @returns The azerite essence. See {@link AzeriteEssenceResponse}. + */ +export function azeriteEssence(azeriteEssenceId: number): Resource { + return { + path: `${base}/azerite-essence/${azeriteEssenceId}`, + namespace: 'static', + }; +} +/** + * Get an azerite essence index. + * @returns The azerite essence index. See {@link AzeriteEssenceIndexResponse}. + */ +export function azeriteEssenceIndex(): Resource { + return { + path: `${base}/azerite-essence/index`, + namespace: 'static', + }; +} +/** + * Get azerite essence media by ID. + * @param azeriteEssenceId The azerite essence ID. + * @returns The azerite essence media. See {@link AzeriteEssenceMediaResponse}. + */ +export function azeriteEssenceMedia(azeriteEssenceId: number): Resource { + return { path: `${mediaBase}/azerite-essence/${azeriteEssenceId}`, namespace: 'static' }; +} +/** + * Search for azerite essences. + * @param options The search parameters. See {@link AzeriteEssenceSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function azeriteEssenceSearch( + options: AzeriteEssenceSearchParameters, +): Resource, AzeriteEssenceSearchParameters> { + return { + path: `${searchBase}/azerite-essence`, + namespace: 'static', + parameters: { + _page: options._page, + 'allowed_specializations.id': options['allowed_specializations.id'], + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + }, + }; +} diff --git a/packages/wow/src/connected-realm/connected-realm.test.ts b/packages/wow/src/connected-realm/connected-realm.test.ts index a9bf582..39bee2a 100644 --- a/packages/wow/src/connected-realm/connected-realm.test.ts +++ b/packages/wow/src/connected-realm/connected-realm.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { searchBase } from '../base'; -import { connectedRealmApi } from './connected-realm'; +import * as connectedRealmApi from './connected-realm'; describe.concurrent('connectedRealm', () => { it('should return the correct resource for connected realm index', ({ expect }) => { diff --git a/packages/wow/src/connected-realm/connected-realm.ts b/packages/wow/src/connected-realm/connected-realm.ts index 4549105..10a72e8 100644 --- a/packages/wow/src/connected-realm/connected-realm.ts +++ b/packages/wow/src/connected-realm/connected-realm.ts @@ -7,45 +7,43 @@ import type { ConnectedRealmSearchResponseItem, } from './types'; -export const connectedRealmApi = { - /** - * Get a connected realm index. - * @returns The connected realm index. See {@link ConnectedRealmIndexResponse}. - */ - connectedRealmIndex: (): Resource => { - return { - path: `${base}/connected-realm/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a connected realm by ID. - * @param connectedRealmId The connected realm ID. - * @returns The connected realm. See {@link ConnectedRealmResponse}. - */ - connectedRealm: (connectedRealmId: number): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}`, - namespace: 'dynamic', - }; - }, - /** - * Search for connected realms. - * @param options The search parameters. See {@link ConnectedRealmSearchParameters}. - * @returns The search results. See {@link SearchResponse} & {@link ConnectedRealmSearchResponseItem}. - */ - connectedRealmSearch: ( - options: ConnectedRealmSearchParameters, - ): Resource, ConnectedRealmSearchParameters> => { - return { - namespace: 'dynamic', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - 'status.type': options['status.type'], - 'realms.timezone': options['realms.timezone'], - }, - path: `${base}/search/connected-realm`, - }; - }, -}; +/** + * Get a connected realm index. + * @returns The connected realm index. See {@link ConnectedRealmIndexResponse}. + */ +export function connectedRealmIndex(): Resource { + return { + path: `${base}/connected-realm/index`, + namespace: 'dynamic', + }; +} +/** + * Get a connected realm by ID. + * @param connectedRealmId The connected realm ID. + * @returns The connected realm. See {@link ConnectedRealmResponse}. + */ +export function connectedRealm(connectedRealmId: number): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}`, + namespace: 'dynamic', + }; +} +/** + * Search for connected realms. + * @param options The search parameters. See {@link ConnectedRealmSearchParameters}. + * @returns The search results. See {@link SearchResponse} & {@link ConnectedRealmSearchResponseItem}. + */ +export function connectedRealmSearch( + options: ConnectedRealmSearchParameters, +): Resource, ConnectedRealmSearchParameters> { + return { + namespace: 'dynamic', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + 'status.type': options['status.type'], + 'realms.timezone': options['realms.timezone'], + }, + path: `${base}/search/connected-realm`, + }; +} diff --git a/packages/wow/src/covenant/covenant.test.ts b/packages/wow/src/covenant/covenant.test.ts index 0f1d29a..10719f6 100644 --- a/packages/wow/src/covenant/covenant.test.ts +++ b/packages/wow/src/covenant/covenant.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { covenantApi } from './covenant'; +import * as covenantApi from './covenant'; describe.concurrent('covenantApi', () => { it('should return the correct path and namespace for conduit', ({ expect }) => { diff --git a/packages/wow/src/covenant/covenant.ts b/packages/wow/src/covenant/covenant.ts index 4c61afd..1cc3f3c 100644 --- a/packages/wow/src/covenant/covenant.ts +++ b/packages/wow/src/covenant/covenant.ts @@ -10,79 +10,77 @@ import type { SoulbindResponse, } from './types'; -export const covenantApi = { - /** - * Get a conduit by ID. - * @param conduitId The conduit ID. - * @returns The conduit. See {@link ConduitResponse}. - */ - conduit: (conduitId: number): Resource => { - return { - path: `${base}/covenant/conduit/${conduitId}`, - namespace: 'static', - }; - }, - /** - * Get a conduit index. - * @returns The conduit index. See {@link ConduitIndexResponse}. - */ - conduitIndex: (): Resource => { - return { - path: `${base}/covenant/conduit/index`, - namespace: 'static', - }; - }, - /** - * Get a covenant by ID. - * @param covenantId The covenant ID. - * @returns The covenant. See {@link CovenantResponse}. - */ - covenant: (covenantId: number): Resource => { - return { - path: `${base}/covenant/${covenantId}`, - namespace: 'static', - }; - }, - /** - * Get a covenant index. - * @returns The covenant index. See {@link CovenantIndexResponse}. - */ - covenantIndex: (): Resource => { - return { - path: `${base}/covenant/index`, - namespace: 'static', - }; - }, - /** - * Get covenant media by ID. - * @param covenantId The covenant ID. - * @returns The covenant media. See {@link CovenantMediaResponse}. - */ - covenantMedia: (covenantId: number): Resource => { - return { - path: `${mediaBase}/covenant/${covenantId}`, - namespace: 'static', - }; - }, - /** - * Get a soulbind by ID. - * @param soulbindId The soulbind ID. - * @returns The soulbind. See {@link SoulbindResponse}. - */ - soulbind: (soulbindId: number): Resource => { - return { - path: `${base}/covenant/soulbind/${soulbindId}`, - namespace: 'static', - }; - }, - /** - * Get a soulbind index. - * @returns The soulbind index. See {@link SoulbindIndexResponse}. - */ - soulbindIndex: (): Resource => { - return { - path: `${base}/covenant/soulbind/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a conduit by ID. + * @param conduitId The conduit ID. + * @returns The conduit. See {@link ConduitResponse}. + */ +export function conduit(conduitId: number): Resource { + return { + path: `${base}/covenant/conduit/${conduitId}`, + namespace: 'static', + }; +} +/** + * Get a conduit index. + * @returns The conduit index. See {@link ConduitIndexResponse}. + */ +export function conduitIndex(): Resource { + return { + path: `${base}/covenant/conduit/index`, + namespace: 'static', + }; +} +/** + * Get a covenant by ID. + * @param covenantId The covenant ID. + * @returns The covenant. See {@link CovenantResponse}. + */ +export function covenant(covenantId: number): Resource { + return { + path: `${base}/covenant/${covenantId}`, + namespace: 'static', + }; +} +/** + * Get a covenant index. + * @returns The covenant index. See {@link CovenantIndexResponse}. + */ +export function covenantIndex(): Resource { + return { + path: `${base}/covenant/index`, + namespace: 'static', + }; +} +/** + * Get covenant media by ID. + * @param covenantId The covenant ID. + * @returns The covenant media. See {@link CovenantMediaResponse}. + */ +export function covenantMedia(covenantId: number): Resource { + return { + path: `${mediaBase}/covenant/${covenantId}`, + namespace: 'static', + }; +} +/** + * Get a soulbind by ID. + * @param soulbindId The soulbind ID. + * @returns The soulbind. See {@link SoulbindResponse}. + */ +export function soulbind(soulbindId: number): Resource { + return { + path: `${base}/covenant/soulbind/${soulbindId}`, + namespace: 'static', + }; +} +/** + * Get a soulbind index. + * @returns The soulbind index. See {@link SoulbindIndexResponse}. + */ +export function soulbindIndex(): Resource { + return { + path: `${base}/covenant/soulbind/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/creature/creature.test.ts b/packages/wow/src/creature/creature.test.ts index 2897f61..e892964 100644 --- a/packages/wow/src/creature/creature.test.ts +++ b/packages/wow/src/creature/creature.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../base'; -import { creatureApi } from './creature'; +import * as creatureApi from './creature'; describe.concurrent('creatureApi', () => { it('should return the correct path and namespace for creature', ({ expect }) => { diff --git a/packages/wow/src/creature/creature.ts b/packages/wow/src/creature/creature.ts index 752bd42..f9e670d 100644 --- a/packages/wow/src/creature/creature.ts +++ b/packages/wow/src/creature/creature.ts @@ -12,98 +12,96 @@ import type { CreatureTypeResponse, } from './types'; -export const creatureApi = { - /** - * Get a creature by ID. - * @param creatureId The creature ID. - * @returns The creature. See {@link CreatureResponse}. - */ - creature: (creatureId: number): Resource => { - return { - path: `${base}/creature/${creatureId}`, - namespace: 'static', - }; - }, - /** - * Get creature display media by ID. - * @param creatureDisplayId The creature display ID. - * @returns The creature display media. See {@link CreatureDisplayMediaResponse}. - */ - creatureDisplayMedia: (creatureDisplayId: number): Resource => { - return { - path: `${mediaBase}/creature-display/${creatureDisplayId}`, - namespace: 'static', - }; - }, - /** - * Get a creature family by ID. - * @param creatureFamilyId The creature family ID. - * @returns The creature family. See {@link CreatureFamilyResponse}. - */ - creatureFamily: (creatureFamilyId: number): Resource => { - return { - path: `${base}/creature-family/${creatureFamilyId}`, - namespace: 'static', - }; - }, - /** - * Get a creature family index. - * @returns The creature family index. See {@link CreatureFamilyIndexResponse}. - */ - creatureFamilyIndex: (): Resource => { - return { - path: `${base}/creature-family/index`, - namespace: 'static', - }; - }, - /** - * Get creature family media by ID. - * @param creatureFamilyId The creature family ID. - * @returns The creature family media. See {@link CreatureFamilyMediaResponse}. - */ - creatureFamilyMedia: (creatureFamilyId: number): Resource => { - return { - path: `${mediaBase}/creature-family/${creatureFamilyId}`, - namespace: 'static', - }; - }, - /** - * Get a creature type by ID. - * @param creatureTypeId The creature type ID. - * @returns The creature type. See {@link CreatureTypeResponse}. - */ - creatureType: (creatureTypeId: number): Resource => { - return { - path: `${base}/creature-type/${creatureTypeId}`, - namespace: 'static', - }; - }, - /** - * Get a creature type index. - * @returns The creature type index. See {@link CreatureTypeIndexResponse}. - */ - creatureTypeIndex: (): Resource => { - return { - path: `${base}/creature-type/index`, - namespace: 'static', - }; - }, - /** - * Search for creatures. - * @param options The creature search parameters. See {@link CreatureSearchParameters}. - * @returns The creature search results. See {@link SearchResponse} & {@link CreatureSearchResponseItem}. - */ - creatureSearch: ( - options: CreatureSearchParameters, - ): Resource, Omit> => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/creature`, - }; - }, -}; +/** + * Get a creature by ID. + * @param creatureId The creature ID. + * @returns The creature. See {@link CreatureResponse}. + */ +export function creature(creatureId: number): Resource { + return { + path: `${base}/creature/${creatureId}`, + namespace: 'static', + }; +} +/** + * Get creature display media by ID. + * @param creatureDisplayId The creature display ID. + * @returns The creature display media. See {@link CreatureDisplayMediaResponse}. + */ +export function creatureDisplayMedia(creatureDisplayId: number): Resource { + return { + path: `${mediaBase}/creature-display/${creatureDisplayId}`, + namespace: 'static', + }; +} +/** + * Get a creature family by ID. + * @param creatureFamilyId The creature family ID. + * @returns The creature family. See {@link CreatureFamilyResponse}. + */ +export function creatureFamily(creatureFamilyId: number): Resource { + return { + path: `${base}/creature-family/${creatureFamilyId}`, + namespace: 'static', + }; +} +/** + * Get a creature family index. + * @returns The creature family index. See {@link CreatureFamilyIndexResponse}. + */ +export function creatureFamilyIndex(): Resource { + return { + path: `${base}/creature-family/index`, + namespace: 'static', + }; +} +/** + * Get creature family media by ID. + * @param creatureFamilyId The creature family ID. + * @returns The creature family media. See {@link CreatureFamilyMediaResponse}. + */ +export function creatureFamilyMedia(creatureFamilyId: number): Resource { + return { + path: `${mediaBase}/creature-family/${creatureFamilyId}`, + namespace: 'static', + }; +} +/** + * Get a creature type by ID. + * @param creatureTypeId The creature type ID. + * @returns The creature type. See {@link CreatureTypeResponse}. + */ +export function creatureType(creatureTypeId: number): Resource { + return { + path: `${base}/creature-type/${creatureTypeId}`, + namespace: 'static', + }; +} +/** + * Get a creature type index. + * @returns The creature type index. See {@link CreatureTypeIndexResponse}. + */ +export function creatureTypeIndex(): Resource { + return { + path: `${base}/creature-type/index`, + namespace: 'static', + }; +} +/** + * Search for creatures. + * @param options The creature search parameters. See {@link CreatureSearchParameters}. + * @returns The creature search results. See {@link SearchResponse} & {@link CreatureSearchResponseItem}. + */ +export function creatureSearch( + options: CreatureSearchParameters, +): Resource, Omit> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/creature`, + }; +} diff --git a/packages/wow/src/guild-crest/guild-crest.test.ts b/packages/wow/src/guild-crest/guild-crest.test.ts index 99a8cfd..909991d 100644 --- a/packages/wow/src/guild-crest/guild-crest.test.ts +++ b/packages/wow/src/guild-crest/guild-crest.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { guildCrestApi } from './guild-crest'; +import * as guildCrestApi from './guild-crest'; describe.concurrent('guildCrestApi', () => { it('should return the guild crest components index resource', ({ expect }) => { diff --git a/packages/wow/src/guild-crest/guild-crest.ts b/packages/wow/src/guild-crest/guild-crest.ts index d315ab8..8f4307c 100644 --- a/packages/wow/src/guild-crest/guild-crest.ts +++ b/packages/wow/src/guild-crest/guild-crest.ts @@ -2,37 +2,35 @@ import type { Resource } from '@blizzard-api/core'; import { base, mediaBase } from '../base'; import type { GuildCrestBorderEmblemResponse, GuildCrestComponentsIndexResponse } from './types'; -export const guildCrestApi = { - /** - * Get the guild crest components index. - * @returns The guild crest components index. See {@link GuildCrestComponentsIndexResponse}. - */ - guildCrestComponentsIndex: (): Resource => { - return { - path: `${base}/guild-crest/index`, - namespace: 'static', - }; - }, - /** - * Get a guild crest border by ID. - * @param borderId The guild crest border ID. - * @returns The guild crest border. See {@link GuildCrestBorderEmblemResponse}. - */ - guildCrestBorder: (borderId: number): Resource => { - return { - path: `${mediaBase}/guild-crest/border/${borderId}`, - namespace: 'static', - }; - }, - /** - * Get a guild crest emblem by ID. - * @param emblemId The guild crest emblem ID. - * @returns The guild crest emblem. See {@link GuildCrestBorderEmblemResponse}. - */ - guildCrestEmblem: (emblemId: number): Resource => { - return { - path: `${mediaBase}/guild-crest/emblem/${emblemId}`, - namespace: 'static', - }; - }, -}; +/** + * Get the guild crest components index. + * @returns The guild crest components index. See {@link GuildCrestComponentsIndexResponse}. + */ +export function guildCrestComponentsIndex(): Resource { + return { + path: `${base}/guild-crest/index`, + namespace: 'static', + }; +} +/** + * Get a guild crest border by ID. + * @param borderId The guild crest border ID. + * @returns The guild crest border. See {@link GuildCrestBorderEmblemResponse}. + */ +export function guildCrestBorder(borderId: number): Resource { + return { + path: `${mediaBase}/guild-crest/border/${borderId}`, + namespace: 'static', + }; +} +/** + * Get a guild crest emblem by ID. + * @param emblemId The guild crest emblem ID. + * @returns The guild crest emblem. See {@link GuildCrestBorderEmblemResponse}. + */ +export function guildCrestEmblem(emblemId: number): Resource { + return { + path: `${mediaBase}/guild-crest/emblem/${emblemId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/heirloom/heirloom.test.ts b/packages/wow/src/heirloom/heirloom.test.ts index 7c001ce..7a03c07 100644 --- a/packages/wow/src/heirloom/heirloom.test.ts +++ b/packages/wow/src/heirloom/heirloom.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { heirloomApi } from './heirloom'; +import * as heirloomApi from './heirloom'; describe.concurrent('heirloomApi', () => { it('should return the heirloom resource for a given heirloomId', ({ expect }) => { diff --git a/packages/wow/src/heirloom/heirloom.ts b/packages/wow/src/heirloom/heirloom.ts index dc21ed6..ae5873f 100644 --- a/packages/wow/src/heirloom/heirloom.ts +++ b/packages/wow/src/heirloom/heirloom.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { HeirloomIndexResponse, HeirloomResponse } from './types'; -export const heirloomApi = { - /** - * Get a heirloom by ID. - * @param heirloomId The heirloom ID. - * @returns The heirloom. See {@link HeirloomResponse}. - */ - heirloom: (heirloomId: number): Resource => { - return { - path: `${base}/heirloom/${heirloomId}`, - namespace: 'static', - }; - }, - /** - * Get the heirloom index. - * @returns The heirloom index. See {@link HeirloomIndexResponse}. - */ - heirloomIndex: (): Resource => { - return { - path: `${base}/heirloom/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a heirloom by ID. + * @param heirloomId The heirloom ID. + * @returns The heirloom. See {@link HeirloomResponse}. + */ +export function heirloom(heirloomId: number): Resource { + return { + path: `${base}/heirloom/${heirloomId}`, + namespace: 'static', + }; +} +/** + * Get the heirloom index. + * @returns The heirloom index. See {@link HeirloomIndexResponse}. + */ +export function heirloomIndex(): Resource { + return { + path: `${base}/heirloom/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/index.ts b/packages/wow/src/index.ts index 8ffc0c9..7d33c15 100644 --- a/packages/wow/src/index.ts +++ b/packages/wow/src/index.ts @@ -1,148 +1,427 @@ -import { achievementApi } from './achievements/achievements'; -import { auctionHouseApi } from './auction-house/auction-house'; -import { azeriteEssenceApi } from './azerite-essence/azerite-essence'; -import { connectedRealmApi } from './connected-realm/connected-realm'; -import { covenantApi } from './covenant/covenant'; -import { creatureApi } from './creature/creature'; -import { guildCrestApi } from './guild-crest/guild-crest'; -import { heirloomApi } from './heirloom/heirloom'; -import { itemApi } from './item/item'; -import { journalApi } from './journal/journal'; -import { mediaSearchApi } from './media-search/media-search'; -import { modifiedCraftingApi } from './modified-crafting/modified-crafting'; -import { mountApi } from './mount/mount'; -import { mythicKeystoneAffixApi } from './mythic-keystone-affix/mythic-keystone-affix'; -import { mythicKeystoneDungeonApi } from './mythic-keystone-dungeon/mythic-keystone-dungeon'; -import { mythicKeystoneLeaderboardApi } from './mythic-keystone-leaderboard/mythic-keystone-leaderboard'; -import { mythicRaidLeaderboardApi } from './mythic-raid-leaderboard/mythic-raid-leaderboard'; -import { petApi } from './pet/pet'; -import { playableClassApi } from './playable-class/playable-class'; -import { playableRaceApi } from './playable-race/playable-race'; -import { playableSpecializationApi } from './playable-specialization/playable-specialization'; -import { powerTypeApi } from './power-type/power-type'; -import { professionApi } from './profession/profession'; -import { pvpSeasonApi } from './pvp-season/pvp-season'; -import { pvpTierApi } from './pvp-tier/pvp-tier'; -import { questApi } from './quest/quest'; -import { realmApi } from './realm/realm'; -import { regionApi } from './region/region'; -import { reputationApi } from './reputations/reputations'; -import { spellApi } from './spell/spell'; -import { talentApi } from './talent/talent'; -import { techTalentApi } from './tech-talent/tech-talent'; -import { titleApi } from './title/title'; -import { toyApi } from './toy/toy'; -import { wowTokenApi } from './wow-token/wow-token'; +import { + achievement, + achievementCategory, + achievementCategoryIndex, + achievementIndex, + achievementMedia, +} from './achievements/achievements'; +import { auctions, commodities } from './auction-house/auction-house'; +import { + azeriteEssence, + azeriteEssenceIndex, + azeriteEssenceMedia, + azeriteEssenceSearch, +} from './azerite-essence/azerite-essence'; +import { connectedRealm, connectedRealmIndex, connectedRealmSearch } from './connected-realm/connected-realm'; +import { + conduit, + conduitIndex, + covenant, + covenantIndex, + covenantMedia, + soulbind, + soulbindIndex, +} from './covenant/covenant'; +import { + creature, + creatureDisplayMedia, + creatureFamily, + creatureFamilyIndex, + creatureFamilyMedia, + creatureSearch, + creatureType, + creatureTypeIndex, +} from './creature/creature'; +import { guildCrestBorder, guildCrestComponentsIndex, guildCrestEmblem } from './guild-crest/guild-crest'; +import { heirloom, heirloomIndex } from './heirloom/heirloom'; +import { + item, + itemClass, + itemClassIndex, + itemMedia, + itemSearch, + itemSet, + itemSetIndex, + itemSubClass, +} from './item/item'; +import { + journalEncounter, + journalEncounterIndex, + journalEncounterSearch, + journalExpansion, + journalExpansionIndex, + journalInstance, + journalInstanceIndex, + journalInstanceMedia, +} from './journal/journal'; +import { mediaSearch } from './media-search/media-search'; +import { + modifiedCraftingCategory, + modifiedCraftingCategoryIndex, + modifiedCraftingIndex, + modifiedCraftingReagentSlotType, + modifiedCraftingReagentSlotTypeIndex, +} from './modified-crafting/modified-crafting'; +import { mount, mountIndex, mountSearch } from './mount/mount'; +import { + mythicKeystoneAffix, + mythicKeystoneAffixIndex, + mythicKeystoneAffixMedia, +} from './mythic-keystone-affix/mythic-keystone-affix'; +import { + mythicKeystoneDungeon, + mythicKeystoneDungeonIndex, + mythicKeystoneIndex, + mythicKeystonePeriod, + mythicKeystonePeriodIndex, + mythicKeystoneSeason, + mythicKeystoneSeasonIndex, +} from './mythic-keystone-dungeon/mythic-keystone-dungeon'; +import { + mythicKeystoneLeaderboard, + mythicKeystoneLeaderboardIndex, +} from './mythic-keystone-leaderboard/mythic-keystone-leaderboard'; +import { mythicRaidLeaderboard } from './mythic-raid-leaderboard/mythic-raid-leaderboard'; +import { pet, petAbility, petAbilityIndex, petAbilityMedia, petIndex, petMedia } from './pet/pet'; +import { playableClass, playableClassIndex, playableClassMedia, pvpTalentSlots } from './playable-class/playable-class'; +import { playableRace, playableRaceIndex } from './playable-race/playable-race'; +import { + playableSpecialization, + playableSpecializationIndex, + playableSpecializationMedia, +} from './playable-specialization/playable-specialization'; +import { powerType, powerTypeIndex } from './power-type/power-type'; +import { + profession, + professionIndex, + professionMedia, + professionSkillTier, + recipe, + recipeMedia, +} from './profession/profession'; +import { + pvpLeaderboard, + pvpLeaderboardIndex, + pvpRewardsIndex, + pvpSeason, + pvpSeasonIndex, +} from './pvp-season/pvp-season'; +import { pvpTier, pvpTierIndex, pvpTierMedia } from './pvp-tier/pvp-tier'; +import { + quest, + questArea, + questAreaIndex, + questCategory, + questCategoryIndex, + questIndex, + questType, + questTypeIndex, +} from './quest/quest'; +import { realm, realmIndex, realmSearch } from './realm/realm'; +import { region, regionIndex } from './region/region'; +import { + reputationFaction, + reputationFactionIndex, + reputationTiers, + reputationTiersIndex, +} from './reputations/reputations'; +import { spell, spellMedia, spellSearch } from './spell/spell'; +import { pvpTalent, pvpTalentIndex, talentIndex, talentTree, talentTreeIndex, talentTreeNodes } from './talent/talent'; +import { + techTalent, + techTalentIndex, + techTalentMedia, + techTalentTree, + techTalentTreeIndex, +} from './tech-talent/tech-talent'; +import { title, titleIndex } from './title/title'; +import { toy, toyIndex } from './toy/toy'; +import { wowToken } from './wow-token/wow-token'; /** * The Blizzard API for World of Warcraft. * @see https://develop.battle.net/documentation/world-of-warcraft */ + export const wow = { - ...achievementApi, - ...auctionHouseApi, - ...azeriteEssenceApi, - ...connectedRealmApi, - ...covenantApi, - ...creatureApi, - ...guildCrestApi, - ...heirloomApi, - ...itemApi, - ...journalApi, - ...mediaSearchApi, - ...modifiedCraftingApi, - ...mountApi, - ...mythicKeystoneAffixApi, - ...mythicKeystoneDungeonApi, - ...mythicKeystoneLeaderboardApi, - ...mythicRaidLeaderboardApi, - ...petApi, - ...playableClassApi, - ...playableRaceApi, - ...playableSpecializationApi, - ...powerTypeApi, - ...professionApi, - ...pvpSeasonApi, - ...pvpTierApi, - ...questApi, - ...realmApi, - ...regionApi, - ...reputationApi, - ...spellApi, - ...talentApi, - ...techTalentApi, - ...titleApi, - ...toyApi, - ...wowTokenApi, + //Achievements + achievement, + achievementCategory, + achievementCategoryIndex, + achievementIndex, + achievementMedia, + //Auction House + auctions, + commodities, + //Azerite Essence + azeriteEssence, + azeriteEssenceIndex, + azeriteEssenceMedia, + azeriteEssenceSearch, + //Connected Realm + connectedRealm, + connectedRealmIndex, + connectedRealmSearch, + //Covenant + conduit, + conduitIndex, + covenant, + covenantIndex, + covenantMedia, + soulbind, + soulbindIndex, + //Creature + creature, + creatureDisplayMedia, + creatureFamily, + creatureFamilyIndex, + creatureFamilyMedia, + creatureType, + creatureTypeIndex, + creatureSearch, + //Guild Crest + guildCrestComponentsIndex, + guildCrestBorder, + guildCrestEmblem, + //Heirloom + heirloom, + heirloomIndex, + //Item + item, + itemClass, + itemSubClass, + itemClassIndex, + itemMedia, + itemSet, + itemSetIndex, + itemSearch, + //Journal + journalEncounter, + journalEncounterIndex, + journalEncounterSearch, + journalExpansion, + journalExpansionIndex, + journalInstance, + journalInstanceIndex, + journalInstanceMedia, + //Media Search + mediaSearch, + //Modified Crafting + modifiedCraftingCategory, + modifiedCraftingCategoryIndex, + modifiedCraftingIndex, + modifiedCraftingReagentSlotType, + modifiedCraftingReagentSlotTypeIndex, + //Mount + mount, + mountIndex, + mountSearch, + //Mythic Keystone Affix + mythicKeystoneAffix, + mythicKeystoneAffixIndex, + mythicKeystoneAffixMedia, + //Mythic Keystone Dungeon + mythicKeystoneDungeon, + mythicKeystoneDungeonIndex, + mythicKeystoneIndex, + mythicKeystonePeriod, + mythicKeystonePeriodIndex, + mythicKeystoneSeason, + mythicKeystoneSeasonIndex, + //Mythic Keystone Leaderboard + mythicKeystoneLeaderboard, + mythicKeystoneLeaderboardIndex, + //Mythic Raid Leaderboard + mythicRaidLeaderboard, + //Pet + pet, + petIndex, + petMedia, + petAbility, + petAbilityIndex, + petAbilityMedia, + //Playable Class + playableClass, + playableClassIndex, + playableClassMedia, + pvpTalentSlots, + //Playable + playableRace, + playableRaceIndex, + //Playable Specialization + playableSpecialization, + playableSpecializationIndex, + playableSpecializationMedia, + //Power Type + powerType, + powerTypeIndex, + //Profession + profession, + professionIndex, + professionMedia, + professionSkillTier, + recipe, + recipeMedia, + //Pvp Season + pvpLeaderboard, + pvpLeaderboardIndex, + pvpRewardsIndex, + pvpSeason, + pvpSeasonIndex, + //Pvp Tier + pvpTier, + pvpTierIndex, + pvpTierMedia, + //Quest + quest, + questIndex, + questArea, + questAreaIndex, + questCategory, + questCategoryIndex, + questType, + questTypeIndex, + //Realm + realm, + realmIndex, + realmSearch, + //Region + region, + regionIndex, + //Reputations + reputationFaction, + reputationFactionIndex, + reputationTiers, + reputationTiersIndex, + //Spell + spell, + spellMedia, + spellSearch, + //Talent + pvpTalent, + pvpTalentIndex, + talentIndex, + talentTree, + talentTreeIndex, + talentTreeNodes, + //Tech Talent + techTalent, + techTalentIndex, + techTalentMedia, + techTalentTree, + techTalentTreeIndex, + //Title + title, + titleIndex, + //Toy + toy, + toyIndex, + //WoW Token + wowToken, }; //Achievements -export * from './achievements/types.js'; +export * from './achievements/achievements'; +export * from './achievements/types'; //Auction House -export * from './auction-house/types.js'; +export * from './auction-house/auction-house'; +export * from './auction-house/types'; //Azerite Essence -export * from './azerite-essence/types.js'; +export * from './azerite-essence/azerite-essence'; +export * from './azerite-essence/types'; //Connected Realm -export * from './connected-realm/types.js'; +export * from './connected-realm/connected-realm'; +export * from './connected-realm/types'; //Covenant -export * from './covenant/types.js'; +export * from './covenant/covenant'; +export * from './covenant/types'; //Creature -export * from './creature/types.js'; +export * from './creature/creature'; +export * from './creature/types'; //Guild Crest -export * from './guild-crest/types.js'; +export * from './guild-crest/guild-crest'; +export * from './guild-crest/types'; //Heirloom -export * from './heirloom/types.js'; +export * from './heirloom/heirloom'; +export * from './heirloom/types'; //Item -export * from './item/types.js'; +export * from './item/item'; +export * from './item/types'; //Journal -export * from './journal/types.js'; +export * from './journal/journal'; +export * from './journal/types'; //Media Search -export * from './media-search/types.js'; +export * from './media-search/media-search'; +export * from './media-search/types'; //Modified Crafting -export * from './modified-crafting/types.js'; +export * from './modified-crafting/modified-crafting'; +export * from './modified-crafting/types'; //Mount -export * from './mount/types.js'; +export * from './mount/mount'; +export * from './mount/types'; //Mythic Keystone Affix -export * from './mythic-keystone-affix/types.js'; +export * from './mythic-keystone-affix/mythic-keystone-affix'; +export * from './mythic-keystone-affix/types'; //Mythic Keystone Dungeon -export * from './mythic-keystone-dungeon/types.js'; +export * from './mythic-keystone-dungeon/mythic-keystone-dungeon'; +export * from './mythic-keystone-dungeon/types'; //Mythic Keystone Leaderboard -export * from './mythic-keystone-leaderboard/types.js'; +export * from './mythic-keystone-leaderboard/mythic-keystone-leaderboard'; +export * from './mythic-keystone-leaderboard/types'; //Mythic Raid Leaderboard -export * from './mythic-raid-leaderboard/types.js'; +export * from './mythic-raid-leaderboard/mythic-raid-leaderboard'; +export * from './mythic-raid-leaderboard/types'; //Pet -export * from './pet/types.js'; +export * from './pet/pet'; +export * from './pet/types'; //Playable Class -export * from './playable-class/types.js'; +export * from './playable-class/playable-class'; +export * from './playable-class/types'; //Playable Race -export * from './playable-race/types.js'; +export * from './playable-race/playable-race'; +export * from './playable-race/types'; //Playable Specialization -export * from './playable-specialization/types.js'; +export * from './playable-specialization/playable-specialization'; +export * from './playable-specialization/types'; //Power Type -export * from './power-type/types.js'; +export * from './power-type/power-type'; +export * from './power-type/types'; //Profession -export * from './profession/types.js'; +export * from './profession/profession'; +export * from './profession/types'; //Pvp Season -export * from './pvp-season/types.js'; +export * from './pvp-season/pvp-season'; +export * from './pvp-season/types'; //Pvp Tier -export * from './pvp-tier/types.js'; +export * from './pvp-tier/pvp-tier'; +export * from './pvp-tier/types'; //Quest -export * from './quest/types.js'; +export * from './quest/quest'; +export * from './quest/types'; //Realm -export * from './realm/types.js'; +export * from './realm/realm'; +export * from './realm/types'; //Region -export * from './region/types.js'; +export * from './region/region'; +export * from './region/types'; //Reputations -export * from './reputations/types.js'; +export * from './reputations/reputations'; +export * from './reputations/types'; //Spell -export * from './spell/types.js'; +export * from './spell/spell'; +export * from './spell/types'; //Talent -export * from './talent/types.js'; +export * from './talent/talent'; +export * from './talent/types'; //Tech Talent -export * from './tech-talent/types.js'; +export * from './tech-talent/tech-talent'; +export * from './tech-talent/types'; //Title -export * from './title/types.js'; +export * from './title/title'; +export * from './title/types'; //Toy -export * from './toy/types.js'; +export * from './toy/toy'; +export * from './toy/types'; //WoW Token -export * from './wow-token/types.js'; +export * from './wow-token/wow-token'; +export * from './wow-token/types'; diff --git a/packages/wow/src/item/item.test.ts b/packages/wow/src/item/item.test.ts index 43f50c0..3592782 100644 --- a/packages/wow/src/item/item.test.ts +++ b/packages/wow/src/item/item.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../base'; -import { itemApi } from './item'; +import * as itemApi from './item'; describe.concurrent('itemApi', () => { it('should return the item resource for a given itemId', ({ expect }) => { diff --git a/packages/wow/src/item/item.ts b/packages/wow/src/item/item.ts index aefd48e..5b284d6 100644 --- a/packages/wow/src/item/item.ts +++ b/packages/wow/src/item/item.ts @@ -12,99 +12,97 @@ import type { ItemSubClassResponse, } from './types'; -export const itemApi = { - /** - * Get an item by ID. - * @param itemId The item ID. - * @returns The item. See {@link ItemResponse}. - */ - item: (itemId: number): Resource => { - return { - path: `${base}/item/${itemId}`, - namespace: 'static', - }; - }, - /** - * Get an item class by ID. - * @param itemClassId The item class ID. - * @returns The item class. See {@link ItemClassResponse}. - */ - itemClass: (itemClassId: number): Resource => { - return { - path: `${base}/item-class/${itemClassId}`, - namespace: 'static', - }; - }, - /** - * Get an item subclass by ID. - * @param itemClassId The item class ID. - * @param itemSubclassId The item subclass ID. - * @returns The item subclass. See {@link ItemSubClassResponse}. - */ - itemSubClass: (itemClassId: number, itemSubclassId: number): Resource => { - return { - path: `${base}/item-class/${itemClassId}/item-subclass/${itemSubclassId}`, - namespace: 'static', - }; - }, - /** - * Get an item class index. - * @returns The item class index. See {@link ItemClassIndexResponse}. - */ - itemClassIndex: (): Resource => { - return { - path: `${base}/item-class/index`, - namespace: 'static', - }; - }, - /** - * Get item media by ID. - * @param itemId The item ID. - * @returns The item media. See {@link ItemMediaResponse}. - */ - itemMedia: (itemId: number): Resource => { - return { - path: `${mediaBase}/item/${itemId}`, - namespace: 'static', - }; - }, - /** - * Get an item set by ID. - * @param itemSetId The item set ID. - * @returns The item set. See {@link ItemSetResponse}. - */ - itemSet: (itemSetId: number): Resource => { - return { - path: `${base}/item-set/${itemSetId}`, - namespace: 'static', - }; - }, - /** - * Get an item set index. - * @returns The item set index. See {@link ItemSetIndexResponse}. - */ - itemSetIndex: (): Resource => { - return { - path: `${base}/item-set/index`, - namespace: 'static', - }; - }, - /** - * Search for items. - * @param options The search parameters. See {@link ItemSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - itemSearch: ( - options: ItemSearchParameters, - ): Resource, Omit> => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/item`, - }; - }, -}; +/** + * Get an item by ID. + * @param itemId The item ID. + * @returns The item. See {@link ItemResponse}. + */ +export function item(itemId: number): Resource { + return { + path: `${base}/item/${itemId}`, + namespace: 'static', + }; +} +/** + * Get an item class by ID. + * @param itemClassId The item class ID. + * @returns The item class. See {@link ItemClassResponse}. + */ +export function itemClass(itemClassId: number): Resource { + return { + path: `${base}/item-class/${itemClassId}`, + namespace: 'static', + }; +} +/** + * Get an item subclass by ID. + * @param itemClassId The item class ID. + * @param itemSubclassId The item subclass ID. + * @returns The item subclass. See {@link ItemSubClassResponse}. + */ +export function itemSubClass(itemClassId: number, itemSubclassId: number): Resource { + return { + path: `${base}/item-class/${itemClassId}/item-subclass/${itemSubclassId}`, + namespace: 'static', + }; +} +/** + * Get an item class index. + * @returns The item class index. See {@link ItemClassIndexResponse}. + */ +export function itemClassIndex(): Resource { + return { + path: `${base}/item-class/index`, + namespace: 'static', + }; +} +/** + * Get item media by ID. + * @param itemId The item ID. + * @returns The item media. See {@link ItemMediaResponse}. + */ +export function itemMedia(itemId: number): Resource { + return { + path: `${mediaBase}/item/${itemId}`, + namespace: 'static', + }; +} +/** + * Get an item set by ID. + * @param itemSetId The item set ID. + * @returns The item set. See {@link ItemSetResponse}. + */ +export function itemSet(itemSetId: number): Resource { + return { + path: `${base}/item-set/${itemSetId}`, + namespace: 'static', + }; +} +/** + * Get an item set index. + * @returns The item set index. See {@link ItemSetIndexResponse}. + */ +export function itemSetIndex(): Resource { + return { + path: `${base}/item-set/index`, + namespace: 'static', + }; +} +/** + * Search for items. + * @param options The search parameters. See {@link ItemSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function itemSearch( + options: ItemSearchParameters, +): Resource, Omit> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/item`, + }; +} diff --git a/packages/wow/src/journal/journal.test.ts b/packages/wow/src/journal/journal.test.ts index c2bf2dd..bff9573 100644 --- a/packages/wow/src/journal/journal.test.ts +++ b/packages/wow/src/journal/journal.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../base'; -import { journalApi } from './journal'; +import * as journalApi from './journal'; describe.concurrent('journalApi', () => { it('should return the journal encounter resource for a given journalEncounterId', ({ expect }) => { diff --git a/packages/wow/src/journal/journal.ts b/packages/wow/src/journal/journal.ts index 9f53cfa..af4cabe 100644 --- a/packages/wow/src/journal/journal.ts +++ b/packages/wow/src/journal/journal.ts @@ -12,100 +12,98 @@ import type { JournalInstanceResponse, } from './types'; -export const journalApi = { - /** - * Get a journal encounter by ID. - * @param journalEncounterId The journal encounter ID. - * @returns The journal encounter. See {@link JournalEncounterResponse}. - */ - journalEncounter: (journalEncounterId: number): Resource => { - return { - path: `${base}/journal-encounter/${journalEncounterId}`, - namespace: 'static', - }; - }, - /** - * Get the journal encounter index. - * @returns The journal encounter index. See {@link JournalEncounterIndexResponse}. - */ - journalEncounterIndex: (): Resource => { - return { - path: `${base}/journal-encounter/index`, - namespace: 'static', - }; - }, - /** - * Search for journal encounters. - * @param options The search parameters. See {@link JournalEncounterSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - journalEncounterSearch: ( - options: JournalEncounterSearchParameters, - ): Resource< - SearchResponse, - Omit - > => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`instance.name.${options.locale}`]: options.instanceName, - }, - path: `${searchBase}/journal-encounter`, - }; - }, - /** - * Get a journal expansion by ID. - * @param journalExpansionId The journal expansion ID. - * @returns The journal expansion. See {@link JournalExpansionResponse}. - */ - journalExpansion: (journalExpansionId: number): Resource => { - return { - path: `${base}/journal-expansion/${journalExpansionId}`, - namespace: 'static', - }; - }, - /** - * Get the journal expansion index. - * @returns The journal expansion index. See {@link JournalExpansionIndexResponse}. - */ - journalExpansionIndex: (): Resource => { - return { - path: `${base}/journal-expansion/index`, - namespace: 'static', - }; - }, - /** - * Get a journal instance by ID. - * @param journalInstanceId The journal instance ID. - * @returns The journal instance. See {@link JournalInstanceResponse}. - */ - journalInstance: (journalInstanceId: number): Resource => { - return { - path: `${base}/journal-instance/${journalInstanceId}`, - namespace: 'static', - }; - }, - /** - * Get the journal instance index. - * @returns The journal instance index. See {@link JournalInstanceIndexResponse}. - */ - journalInstanceIndex: (): Resource => { - return { - path: `${base}/journal-instance/index`, - namespace: 'static', - }; - }, - /** - * Get journal instance media by ID. - * @param journalInstanceId The journal instance ID. - * @returns The journal instance media. See {@link JournalInstanceMediaResponse}. - */ - journalInstanceMedia: (journalInstanceId: number): Resource => { - return { - path: `${mediaBase}/journal-instance/${journalInstanceId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a journal encounter by ID. + * @param journalEncounterId The journal encounter ID. + * @returns The journal encounter. See {@link JournalEncounterResponse}. + */ +export function journalEncounter(journalEncounterId: number): Resource { + return { + path: `${base}/journal-encounter/${journalEncounterId}`, + namespace: 'static', + }; +} +/** + * Get the journal encounter index. + * @returns The journal encounter index. See {@link JournalEncounterIndexResponse}. + */ +export function journalEncounterIndex(): Resource { + return { + path: `${base}/journal-encounter/index`, + namespace: 'static', + }; +} +/** + * Search for journal encounters. + * @param options The search parameters. See {@link JournalEncounterSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function journalEncounterSearch( + options: JournalEncounterSearchParameters, +): Resource< + SearchResponse, + Omit +> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`instance.name.${options.locale}`]: options.instanceName, + }, + path: `${searchBase}/journal-encounter`, + }; +} +/** + * Get a journal expansion by ID. + * @param journalExpansionId The journal expansion ID. + * @returns The journal expansion. See {@link JournalExpansionResponse}. + */ +export function journalExpansion(journalExpansionId: number): Resource { + return { + path: `${base}/journal-expansion/${journalExpansionId}`, + namespace: 'static', + }; +} +/** + * Get the journal expansion index. + * @returns The journal expansion index. See {@link JournalExpansionIndexResponse}. + */ +export function journalExpansionIndex(): Resource { + return { + path: `${base}/journal-expansion/index`, + namespace: 'static', + }; +} +/** + * Get a journal instance by ID. + * @param journalInstanceId The journal instance ID. + * @returns The journal instance. See {@link JournalInstanceResponse}. + */ +export function journalInstance(journalInstanceId: number): Resource { + return { + path: `${base}/journal-instance/${journalInstanceId}`, + namespace: 'static', + }; +} +/** + * Get the journal instance index. + * @returns The journal instance index. See {@link JournalInstanceIndexResponse}. + */ +export function journalInstanceIndex(): Resource { + return { + path: `${base}/journal-instance/index`, + namespace: 'static', + }; +} +/** + * Get journal instance media by ID. + * @param journalInstanceId The journal instance ID. + * @returns The journal instance media. See {@link JournalInstanceMediaResponse}. + */ +export function journalInstanceMedia(journalInstanceId: number): Resource { + return { + path: `${mediaBase}/journal-instance/${journalInstanceId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/media-search/media-search.test.ts b/packages/wow/src/media-search/media-search.test.ts index 3a814b2..dc885dc 100644 --- a/packages/wow/src/media-search/media-search.test.ts +++ b/packages/wow/src/media-search/media-search.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { searchBase } from '../base'; -import { mediaSearchApi } from './media-search'; +import * as mediaSearchApi from './media-search'; describe.concurrent('mediaSearchApi', () => { it('should return the media search resource', ({ expect }) => { diff --git a/packages/wow/src/media-search/media-search.ts b/packages/wow/src/media-search/media-search.ts index afbe359..92e3768 100644 --- a/packages/wow/src/media-search/media-search.ts +++ b/packages/wow/src/media-search/media-search.ts @@ -2,23 +2,21 @@ import type { Resource, SearchResponse } from '@blizzard-api/core'; import { searchBase } from '../base'; import type { MediaSearchParameters, MediaSearchResponseItem } from './types'; -export const mediaSearchApi = { - /** - * Search for media. - * @param options The search parameters. See {@link MediaSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - mediaSearch: ( - options: MediaSearchParameters, - ): Resource, MediaSearchParameters> => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - tags: options.tags, - }, - path: `${searchBase}/media`, - }; - }, -}; +/** + * Search for media. + * @param options The search parameters. See {@link MediaSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function mediaSearch( + options: MediaSearchParameters, +): Resource, MediaSearchParameters> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + tags: options.tags, + }, + path: `${searchBase}/media`, + }; +} diff --git a/packages/wow/src/modified-crafting/modified-crafting.test.ts b/packages/wow/src/modified-crafting/modified-crafting.test.ts index 93509f4..59da2b7 100644 --- a/packages/wow/src/modified-crafting/modified-crafting.test.ts +++ b/packages/wow/src/modified-crafting/modified-crafting.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { modifiedCraftingApi } from './modified-crafting'; +import * as modifiedCraftingApi from './modified-crafting'; describe.concurrent('modifiedCraftingApi', () => { it('should return the correct path for modifiedCraftingCategory', ({ expect }) => { diff --git a/packages/wow/src/modified-crafting/modified-crafting.ts b/packages/wow/src/modified-crafting/modified-crafting.ts index f7d52a3..ec57e5c 100644 --- a/packages/wow/src/modified-crafting/modified-crafting.ts +++ b/packages/wow/src/modified-crafting/modified-crafting.ts @@ -8,59 +8,59 @@ import type { ModifiedCraftingReagentSlotTypeResponse, } from './types'; -export const modifiedCraftingApi = { - /** - * Get a modified crafting category by ID. - * @param modifiedCraftingCategoryId The modified crafting category ID. - * @returns The modified crafting category. See {@link ModifiedCraftingCategoryResponse}. - */ - modifiedCraftingCategory: (modifiedCraftingCategoryId: number): Resource => { - return { - path: `${base}/modified-crafting/category/${modifiedCraftingCategoryId}`, - namespace: 'static', - }; - }, - /** - * Get a modified crafting category index. - * @returns The modified crafting category index. See {@link ModifiedCraftingCategoryIndexResponse}. - */ - modifiedCraftingCategoryIndex: (): Resource => { - return { - path: `${base}/modified-crafting/category/index`, - namespace: 'static', - }; - }, - /** - * Get a modified crafting index. - * @returns The modified crafting index. See {@link ModifiedCraftingIndexResponse}. - */ - modifiedCraftingIndex: (): Resource => { - return { - path: `${base}/modified-crafting/index`, - namespace: 'static', - }; - }, - /** - * Get a modified crafting reagent slot type by ID. - * @param modifiedCraftingReagentSlotTypeId The modified crafting reagent slot type ID. - * @returns The modified crafting reagent slot type. See {@link ModifiedCraftingReagentSlotTypeResponse}. - */ - modifiedCraftingReagentSlotType: ( - modifiedCraftingReagentSlotTypeId: number, - ): Resource => { - return { - path: `${base}/modified-crafting/reagent-slot-type/${modifiedCraftingReagentSlotTypeId}`, - namespace: 'static', - }; - }, - /** - * Get a modified crafting reagent slot type index. - * @returns The modified crafting reagent slot type index. See {@link ModifiedCraftingReagentSlotTypeIndexResponse}. - */ - modifiedCraftingReagentSlotTypeIndex: (): Resource => { - return { - path: `${base}/modified-crafting/reagent-slot-type/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a modified crafting category by ID. + * @param modifiedCraftingCategoryId The modified crafting category ID. + * @returns The modified crafting category. See {@link ModifiedCraftingCategoryResponse}. + */ +export function modifiedCraftingCategory( + modifiedCraftingCategoryId: number, +): Resource { + return { + path: `${base}/modified-crafting/category/${modifiedCraftingCategoryId}`, + namespace: 'static', + }; +} +/** + * Get a modified crafting category index. + * @returns The modified crafting category index. See {@link ModifiedCraftingCategoryIndexResponse}. + */ +export function modifiedCraftingCategoryIndex(): Resource { + return { + path: `${base}/modified-crafting/category/index`, + namespace: 'static', + }; +} +/** + * Get a modified crafting index. + * @returns The modified crafting index. See {@link ModifiedCraftingIndexResponse}. + */ +export function modifiedCraftingIndex(): Resource { + return { + path: `${base}/modified-crafting/index`, + namespace: 'static', + }; +} +/** + * Get a modified crafting reagent slot type by ID. + * @param modifiedCraftingReagentSlotTypeId The modified crafting reagent slot type ID. + * @returns The modified crafting reagent slot type. See {@link ModifiedCraftingReagentSlotTypeResponse}. + */ +export function modifiedCraftingReagentSlotType( + modifiedCraftingReagentSlotTypeId: number, +): Resource { + return { + path: `${base}/modified-crafting/reagent-slot-type/${modifiedCraftingReagentSlotTypeId}`, + namespace: 'static', + }; +} +/** + * Get a modified crafting reagent slot type index. + * @returns The modified crafting reagent slot type index. See {@link ModifiedCraftingReagentSlotTypeIndexResponse}. + */ +export function modifiedCraftingReagentSlotTypeIndex(): Resource { + return { + path: `${base}/modified-crafting/reagent-slot-type/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/mount/mount.test.ts b/packages/wow/src/mount/mount.test.ts index b93c540..22e9d5e 100644 --- a/packages/wow/src/mount/mount.test.ts +++ b/packages/wow/src/mount/mount.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, searchBase } from '../base'; -import { mountApi } from './mount'; +import * as mountApi from './mount'; describe.concurrent('mountApi', () => { it('mount should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/mount/mount.ts b/packages/wow/src/mount/mount.ts index 85d3fab..4b043a7 100644 --- a/packages/wow/src/mount/mount.ts +++ b/packages/wow/src/mount/mount.ts @@ -2,44 +2,42 @@ import type { Resource, SearchResponse } from '@blizzard-api/core'; import { base, searchBase } from '../base'; import type { MountIndexResponse, MountResponse, MountSearchParameters, MountSearchResponseItem } from './types'; -export const mountApi = { - /** - * Get a mount by ID. - * @param mountId The mount ID. - * @returns The mount. See {@link MountResponse}. - */ - mount: (mountId: number): Resource => { - return { - path: `${base}/mount/${mountId}`, - namespace: 'static', - }; - }, - /** - * Get a mount index. - * @returns The mount index. See {@link MountIndexResponse}. - */ - mountIndex: (): Resource => { - return { - path: `${base}/mount/index`, - namespace: 'static', - }; - }, - /** - * Get a mount search. - * @param options The search parameters. See {@link MountSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - mountSearch: ( - options: MountSearchParameters, - ): Resource, Omit> => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/mount`, - }; - }, -}; +/** + * Get a mount by ID. + * @param mountId The mount ID. + * @returns The mount. See {@link MountResponse}. + */ +export function mount(mountId: number): Resource { + return { + path: `${base}/mount/${mountId}`, + namespace: 'static', + }; +} +/** + * Get a mount index. + * @returns The mount index. See {@link MountIndexResponse}. + */ +export function mountIndex(): Resource { + return { + path: `${base}/mount/index`, + namespace: 'static', + }; +} +/** + * Get a mount search. + * @param options The search parameters. See {@link MountSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function mountSearch( + options: MountSearchParameters, +): Resource, Omit> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/mount`, + }; +} diff --git a/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.test.ts b/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.test.ts index cb00bbe..4f4060a 100644 --- a/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.test.ts +++ b/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { mythicKeystoneAffixApi } from './mythic-keystone-affix'; +import * as mythicKeystoneAffixApi from './mythic-keystone-affix'; describe.concurrent('mythicKeystoneAffixApi', () => { it('mythicKeystoneAffix should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.ts b/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.ts index 5ff3334..118da69 100644 --- a/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.ts +++ b/packages/wow/src/mythic-keystone-affix/mythic-keystone-affix.ts @@ -6,35 +6,33 @@ import type { MythicKeystoneAffixResponse, } from './types'; -export const mythicKeystoneAffixApi = { - /** - * Get a list of all Mythic Keystone affixes. - * @returns A list of all Mythic Keystone affixes. See {@link MythicKeystoneAffixIndexResponse} - */ - mythicKeystoneAffix: (mythicKeystoneAffixId: number): Resource => { - return { - path: `${base}/keystone-affix/${mythicKeystoneAffixId}`, - namespace: 'static', - }; - }, - /** - * Get a list of all Mythic Keystone affixes. - * @returns A list of all Mythic Keystone affixes. See {@link MythicKeystoneAffixIndexResponse} - */ - mythicKeystoneAffixIndex: (): Resource => { - return { - path: `${base}/keystone-affix/index`, - namespace: 'static', - }; - }, - /** - * Get a list of all Mythic Keystone affix media. - * @returns A list of all Mythic Keystone affix media. See {@link MythicKeystoneAffixMediaResponse} - */ - mythicKeystoneAffixMedia: (mythicKeystoneAffixId: number): Resource => { - return { - path: `${mediaBase}/keystone-affix/${mythicKeystoneAffixId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a list of all Mythic Keystone affixes. + * @returns A list of all Mythic Keystone affixes. See {@link MythicKeystoneAffixIndexResponse} + */ +export function mythicKeystoneAffix(mythicKeystoneAffixId: number): Resource { + return { + path: `${base}/keystone-affix/${mythicKeystoneAffixId}`, + namespace: 'static', + }; +} +/** + * Get a list of all Mythic Keystone affixes. + * @returns A list of all Mythic Keystone affixes. See {@link MythicKeystoneAffixIndexResponse} + */ +export function mythicKeystoneAffixIndex(): Resource { + return { + path: `${base}/keystone-affix/index`, + namespace: 'static', + }; +} +/** + * Get a list of all Mythic Keystone affix media. + * @returns A list of all Mythic Keystone affix media. See {@link MythicKeystoneAffixMediaResponse} + */ +export function mythicKeystoneAffixMedia(mythicKeystoneAffixId: number): Resource { + return { + path: `${mediaBase}/keystone-affix/${mythicKeystoneAffixId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.test.ts b/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.test.ts index c535b5d..5f2948f 100644 --- a/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.test.ts +++ b/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { mythicKeystoneDungeonApi } from './mythic-keystone-dungeon'; +import * as mythicKeystoneDungeonApi from './mythic-keystone-dungeon'; describe.concurrent('mythicKeystoneDungeonApi', () => { it('mythicKeystoneDungeon should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.ts b/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.ts index 6e17745..cc202a4 100644 --- a/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.ts +++ b/packages/wow/src/mythic-keystone-dungeon/mythic-keystone-dungeon.ts @@ -10,78 +10,76 @@ import type { MythicKeystoneSeasonResponse, } from './types'; -export const mythicKeystoneDungeonApi = { - /** - * Get a Mythic Keystone dungeon by ID. - * @param mythicKeystoneDungeonId The Mythic Keystone dungeon ID. - * @returns The Mythic Keystone dungeon. See {@link MythicKeystoneDungeonResponse}. - */ - mythicKeystoneDungeon: (mythicKeystoneDungeonId: number): Resource => { - return { - path: `${base}/mythic-keystone/dungeon/${mythicKeystoneDungeonId}`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone dungeon index. - * @returns The Mythic Keystone dungeon index. See {@link MythicKeystoneDungeonIndexResponse}. - */ - mythicKeystoneDungeonIndex: (): Resource => { - return { - path: `${base}/mythic-keystone/dungeon/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone index. - * @returns The Mythic Keystone index. See {@link MythicKeystoneIndexResponse}. - */ - mythicKeystoneIndex: (): Resource => { - return { - path: `${base}/mythic-keystone/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone period by ID. - * @param mythicKeystonePeriodId The Mythic Keystone period ID. - * @returns The Mythic Keystone period. See {@link MythicKeystonePeriodResponse}. - */ - mythicKeystonePeriod: (mythicKeystonePeriodId: number): Resource => { - return { - path: `${base}/mythic-keystone/period/${mythicKeystonePeriodId}`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone period index. - * @returns The Mythic Keystone period index. See {@link MythicKeystonePeriodIndexResponse}. - */ - mythicKeystonePeriodIndex: (): Resource => { - return { - path: `${base}/mythic-keystone/period/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone season by ID. - * @param mythicKeystoneSeasonId The Mythic Keystone season ID. - * @returns The Mythic Keystone season. See {@link MythicKeystoneSeasonResponse}. - */ - mythicKeystoneSeason: (mythicKeystoneSeasonId: number): Resource => { - return { - path: `${base}/mythic-keystone/season/${mythicKeystoneSeasonId}`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone season index. - * @returns The Mythic Keystone season index. See {@link MythicKeystoneSeasonIndexResponse}. - */ - mythicKeystoneSeasonIndex: (): Resource => { - return { - path: `${base}/mythic-keystone/season/index`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get a Mythic Keystone dungeon by ID. + * @param mythicKeystoneDungeonId The Mythic Keystone dungeon ID. + * @returns The Mythic Keystone dungeon. See {@link MythicKeystoneDungeonResponse}. + */ +export function mythicKeystoneDungeon(mythicKeystoneDungeonId: number): Resource { + return { + path: `${base}/mythic-keystone/dungeon/${mythicKeystoneDungeonId}`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone dungeon index. + * @returns The Mythic Keystone dungeon index. See {@link MythicKeystoneDungeonIndexResponse}. + */ +export function mythicKeystoneDungeonIndex(): Resource { + return { + path: `${base}/mythic-keystone/dungeon/index`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone index. + * @returns The Mythic Keystone index. See {@link MythicKeystoneIndexResponse}. + */ +export function mythicKeystoneIndex(): Resource { + return { + path: `${base}/mythic-keystone/index`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone period by ID. + * @param mythicKeystonePeriodId The Mythic Keystone period ID. + * @returns The Mythic Keystone period. See {@link MythicKeystonePeriodResponse}. + */ +export function mythicKeystonePeriod(mythicKeystonePeriodId: number): Resource { + return { + path: `${base}/mythic-keystone/period/${mythicKeystonePeriodId}`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone period index. + * @returns The Mythic Keystone period index. See {@link MythicKeystonePeriodIndexResponse}. + */ +export function mythicKeystonePeriodIndex(): Resource { + return { + path: `${base}/mythic-keystone/period/index`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone season by ID. + * @param mythicKeystoneSeasonId The Mythic Keystone season ID. + * @returns The Mythic Keystone season. See {@link MythicKeystoneSeasonResponse}. + */ +export function mythicKeystoneSeason(mythicKeystoneSeasonId: number): Resource { + return { + path: `${base}/mythic-keystone/season/${mythicKeystoneSeasonId}`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone season index. + * @returns The Mythic Keystone season index. See {@link MythicKeystoneSeasonIndexResponse}. + */ +export function mythicKeystoneSeasonIndex(): Resource { + return { + path: `${base}/mythic-keystone/season/index`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.test.ts b/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.test.ts index e0004f6..89d4c60 100644 --- a/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.test.ts +++ b/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { mythicKeystoneLeaderboardApi } from './mythic-keystone-leaderboard'; +import * as mythicKeystoneLeaderboardApi from './mythic-keystone-leaderboard'; describe.concurrent('mythicKeystoneLeaderboardApi', () => { it('mythicKeystoneLeaderboard should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.ts b/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.ts index 9710c05..b2f5020 100644 --- a/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.ts +++ b/packages/wow/src/mythic-keystone-leaderboard/mythic-keystone-leaderboard.ts @@ -2,33 +2,33 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { MythicKeystoneLeaderboardIndexResponse, MythicKeystoneLeaderboardResponse } from './types'; -export const mythicKeystoneLeaderboardApi = { - /** - * Get a Mythic Keystone leaderboard by connected realm ID, dungeon ID, and period. - * @param connectedRealmId The connected realm ID. - * @param dungeonId The dungeon ID. - * @param period The period ID. - * @returns The Mythic Keystone leaderboard. See {@link MythicKeystoneLeaderboardResponse}. - */ - mythicKeystoneLeaderboard: ( - connectedRealmId: number, - dungeonId: number, - period: number, - ): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}/mythic-leaderboard/${dungeonId}/period/${period}`, - namespace: 'dynamic', - }; - }, - /** - * Get a Mythic Keystone leaderboard index by connected realm ID. - * @param connectedRealmId The connected realm ID. - * @returns The Mythic Keystone leaderboard index. See {@link MythicKeystoneLeaderboardIndexResponse}. - */ - mythicKeystoneLeaderboardIndex: (connectedRealmId: number): Resource => { - return { - path: `${base}/connected-realm/${connectedRealmId}/mythic-leaderboard/index`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get a Mythic Keystone leaderboard by connected realm ID, dungeon ID, and period. + * @param connectedRealmId The connected realm ID. + * @param dungeonId The dungeon ID. + * @param period The period ID. + * @returns The Mythic Keystone leaderboard. See {@link MythicKeystoneLeaderboardResponse}. + */ +export function mythicKeystoneLeaderboard( + connectedRealmId: number, + dungeonId: number, + period: number, +): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}/mythic-leaderboard/${dungeonId}/period/${period}`, + namespace: 'dynamic', + }; +} +/** + * Get a Mythic Keystone leaderboard index by connected realm ID. + * @param connectedRealmId The connected realm ID. + * @returns The Mythic Keystone leaderboard index. See {@link MythicKeystoneLeaderboardIndexResponse}. + */ +export function mythicKeystoneLeaderboardIndex( + connectedRealmId: number, +): Resource { + return { + path: `${base}/connected-realm/${connectedRealmId}/mythic-leaderboard/index`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.test.ts b/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.test.ts index c0f6e69..98f1f30 100644 --- a/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.test.ts +++ b/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { mythicRaidLeaderboardApi } from './mythic-raid-leaderboard'; +import * as mythicRaidLeaderboardApi from './mythic-raid-leaderboard'; describe.concurrent('mythicRaidLeaderboardApi', () => { it('mythicRaidLeaderboard should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.ts b/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.ts index e32d534..164d255 100644 --- a/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.ts +++ b/packages/wow/src/mythic-raid-leaderboard/mythic-raid-leaderboard.ts @@ -3,20 +3,18 @@ import type { Factions } from '../base'; import { base } from '../base'; import type { MythicRaidLeaderboardResponse } from './types'; -export const mythicRaidLeaderboardApi = { - /** - * Get a Mythic Raid leaderboard by raid and faction. - * @param raid The slug of the raid. - * @param faction The faction. Either 'alliance' or 'horde'. - * @returns The Mythic Raid leaderboard. See {@link MythicRaidLeaderboardResponse}. - */ - mythicRaidLeaderboard: ( - raid: string, - faction: Lowercase, - ): Resource => { - return { - path: `${base}/leaderboard/hall-of-fame/${raid}/${faction}`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get a Mythic Raid leaderboard by raid and faction. + * @param raid The slug of the raid. + * @param faction The faction. Either 'alliance' or 'horde'. + * @returns The Mythic Raid leaderboard. See {@link MythicRaidLeaderboardResponse}. + */ +export function mythicRaidLeaderboard( + raid: string, + faction: Lowercase, +): Resource { + return { + path: `${base}/leaderboard/hall-of-fame/${raid}/${faction}`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/pet/pet.test.ts b/packages/wow/src/pet/pet.test.ts index fb91527..0cd37aa 100644 --- a/packages/wow/src/pet/pet.test.ts +++ b/packages/wow/src/pet/pet.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { petApi } from './pet'; +import * as petApi from './pet'; describe.concurrent('petApi', () => { it('pet should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/pet/pet.ts b/packages/wow/src/pet/pet.ts index 8257af5..9bfb9d8 100644 --- a/packages/wow/src/pet/pet.ts +++ b/packages/wow/src/pet/pet.ts @@ -9,69 +9,67 @@ import type { PetResponse, } from './types'; -export const petApi = { - /** - * Get a pet by ID. - * @param petId The pet ID. - * @returns The pet. See {@link PetResponse}. - */ - pet: (petId: number): Resource => { - return { - path: `${base}/pet/${petId}`, - namespace: 'static', - }; - }, - /** - * Get a pet index. - * @returns The pet index. See {@link PetIndexResponse}. - */ - petIndex: (): Resource => { - return { - path: `${base}/pet/index`, - namespace: 'static', - }; - }, - /** - * Get a pet media by ID. - * @param petId The pet ID. - * @returns The pet media. See {@link PetMediaResponse}. - */ - petMedia: (petId: number): Resource => { - return { - path: `${mediaBase}/pet/${petId}`, - namespace: 'static', - }; - }, - /** - * Get a pet ability by ID. - * @param petAbilityId The pet ability ID. - * @returns The pet ability. See {@link PetAbilityResponse}. - */ - petAbility: (petAbilityId: number): Resource => { - return { - path: `${base}/pet-ability/${petAbilityId}`, - namespace: 'static', - }; - }, - /** - * Get a pet ability index. - * @returns The pet ability index. See {@link PetAbilityIndexResponse}. - */ - petAbilityIndex: (): Resource => { - return { - path: `${base}/pet-ability/index`, - namespace: 'static', - }; - }, - /** - * Get a pet ability media by ID. - * @param petAbilityId The pet ability ID. - * @returns The pet ability media. See {@link PetAbilityMediaResponse}. - */ - petAbilityMedia: (petAbilityId: number): Resource => { - return { - path: `${mediaBase}/pet-ability/${petAbilityId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a pet by ID. + * @param petId The pet ID. + * @returns The pet. See {@link PetResponse}. + */ +export function pet(petId: number): Resource { + return { + path: `${base}/pet/${petId}`, + namespace: 'static', + }; +} +/** + * Get a pet index. + * @returns The pet index. See {@link PetIndexResponse}. + */ +export function petIndex(): Resource { + return { + path: `${base}/pet/index`, + namespace: 'static', + }; +} +/** + * Get a pet media by ID. + * @param petId The pet ID. + * @returns The pet media. See {@link PetMediaResponse}. + */ +export function petMedia(petId: number): Resource { + return { + path: `${mediaBase}/pet/${petId}`, + namespace: 'static', + }; +} +/** + * Get a pet ability by ID. + * @param petAbilityId The pet ability ID. + * @returns The pet ability. See {@link PetAbilityResponse}. + */ +export function petAbility(petAbilityId: number): Resource { + return { + path: `${base}/pet-ability/${petAbilityId}`, + namespace: 'static', + }; +} +/** + * Get a pet ability index. + * @returns The pet ability index. See {@link PetAbilityIndexResponse}. + */ +export function petAbilityIndex(): Resource { + return { + path: `${base}/pet-ability/index`, + namespace: 'static', + }; +} +/** + * Get a pet ability media by ID. + * @param petAbilityId The pet ability ID. + * @returns The pet ability media. See {@link PetAbilityMediaResponse}. + */ +export function petAbilityMedia(petAbilityId: number): Resource { + return { + path: `${mediaBase}/pet-ability/${petAbilityId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/playable-class/playable-class.test.ts b/packages/wow/src/playable-class/playable-class.test.ts index a150429..d1e7112 100644 --- a/packages/wow/src/playable-class/playable-class.test.ts +++ b/packages/wow/src/playable-class/playable-class.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { playableClassApi } from './playable-class'; +import * as playableClassApi from './playable-class'; describe.concurrent('playableClassApi', () => { it('playableClass should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/playable-class/playable-class.ts b/packages/wow/src/playable-class/playable-class.ts index 895476a..844b6d1 100644 --- a/packages/wow/src/playable-class/playable-class.ts +++ b/packages/wow/src/playable-class/playable-class.ts @@ -7,48 +7,46 @@ import type { PvpTalentSlotsResponse, } from './types'; -export const playableClassApi = { - /** - * Get a playable class by ID. - * @param playableClassId The playable class ID. - * @returns The playable class. See {@link PlayableClassResponse}. - */ - playableClass: (playableClassId: number): Resource => { - return { - path: `${base}/playable-class/${playableClassId}`, - namespace: 'static', - }; - }, - /** - * Get a playable class index. - * @returns The playable class index. See {@link PlayableClassIndexResponse}. - */ - playableClassIndex: (): Resource => { - return { - path: `${base}/playable-class/index`, - namespace: 'static', - }; - }, - /** - * Get playable class media by ID. - * @param playableClassId The playable class ID. - * @returns The playable class media. See {@link PlayableClassMediaResponse}. - */ - playableClassMedia: (playableClassId: number): Resource => { - return { - path: `${mediaBase}/playable-class/${playableClassId}`, - namespace: 'static', - }; - }, - /** - * Get a playable class's PvP talent slots by ID. - * @param playableClassId The playable class ID. - * @returns The playable class's PvP talent slots. See {@link PvpTalentSlotsResponse}. - */ - pvpTalentSlots: (playableClassId: number): Resource => { - return { - path: `${base}/playable-class/${playableClassId}/pvp-talent-slots`, - namespace: 'static', - }; - }, -}; +/** + * Get a playable class by ID. + * @param playableClassId The playable class ID. + * @returns The playable class. See {@link PlayableClassResponse}. + */ +export function playableClass(playableClassId: number): Resource { + return { + path: `${base}/playable-class/${playableClassId}`, + namespace: 'static', + }; +} +/** + * Get a playable class index. + * @returns The playable class index. See {@link PlayableClassIndexResponse}. + */ +export function playableClassIndex(): Resource { + return { + path: `${base}/playable-class/index`, + namespace: 'static', + }; +} +/** + * Get playable class media by ID. + * @param playableClassId The playable class ID. + * @returns The playable class media. See {@link PlayableClassMediaResponse}. + */ +export function playableClassMedia(playableClassId: number): Resource { + return { + path: `${mediaBase}/playable-class/${playableClassId}`, + namespace: 'static', + }; +} +/** + * Get a playable class's PvP talent slots by ID. + * @param playableClassId The playable class ID. + * @returns The playable class's PvP talent slots. See {@link PvpTalentSlotsResponse}. + */ +export function pvpTalentSlots(playableClassId: number): Resource { + return { + path: `${base}/playable-class/${playableClassId}/pvp-talent-slots`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/playable-race/playable-race.test.ts b/packages/wow/src/playable-race/playable-race.test.ts index aea5e62..7ff0de8 100644 --- a/packages/wow/src/playable-race/playable-race.test.ts +++ b/packages/wow/src/playable-race/playable-race.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { playableRaceApi } from './playable-race'; +import * as playableRaceApi from './playable-race'; describe.concurrent('playableRaceApi', () => { it('playableRace should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/playable-race/playable-race.ts b/packages/wow/src/playable-race/playable-race.ts index bd9391b..7c3e167 100644 --- a/packages/wow/src/playable-race/playable-race.ts +++ b/packages/wow/src/playable-race/playable-race.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { PlayableRaceIndexResponse, PlayableRaceResponse } from './types'; -export const playableRaceApi = { - /** - * Get a playable race by ID. - * @param playableRaceId The playable race ID. - * @returns The playable race. See {@link PlayableRaceResponse}. - */ - playableRace: (playableRaceId: number): Resource => { - return { - path: `${base}/playable-race/${playableRaceId}`, - namespace: 'static', - }; - }, - /** - * Get a playable race index. - * @returns The playable race index. See {@link PlayableRaceIndexResponse}. - */ - playableRaceIndex: (): Resource => { - return { - path: `${base}/playable-race/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a playable race by ID. + * @param playableRaceId The playable race ID. + * @returns The playable race. See {@link PlayableRaceResponse}. + */ +export function playableRace(playableRaceId: number): Resource { + return { + path: `${base}/playable-race/${playableRaceId}`, + namespace: 'static', + }; +} +/** + * Get a playable race index. + * @returns The playable race index. See {@link PlayableRaceIndexResponse}. + */ +export function playableRaceIndex(): Resource { + return { + path: `${base}/playable-race/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/playable-specialization/playable-specialization.test.ts b/packages/wow/src/playable-specialization/playable-specialization.test.ts index 935f1a1..a889ee9 100644 --- a/packages/wow/src/playable-specialization/playable-specialization.test.ts +++ b/packages/wow/src/playable-specialization/playable-specialization.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { playableSpecializationApi } from './playable-specialization'; +import * as playableSpecializationApi from './playable-specialization'; describe.concurrent('playableSpecializationApi', () => { it('playableSpecialization should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/playable-specialization/playable-specialization.ts b/packages/wow/src/playable-specialization/playable-specialization.ts index c6dbaa6..4403063 100644 --- a/packages/wow/src/playable-specialization/playable-specialization.ts +++ b/packages/wow/src/playable-specialization/playable-specialization.ts @@ -6,37 +6,35 @@ import type { PlayableSpecializationResponse, } from './types'; -export const playableSpecializationApi = { - /** - * Get a playable specialization by ID. - * @param specializationId The playable specialization ID. - * @returns The playable specialization. See {@link PlayableSpecializationResponse}. - */ - playableSpecialization: (specializationId: number): Resource => { - return { - path: `${base}/playable-specialization/${specializationId}`, - namespace: 'static', - }; - }, - /** - * Get a playable specialization index. - * @returns The playable specialization index. See {@link PlayableSpecializationIndexResponse}. - */ - playableSpecializationIndex: (): Resource => { - return { - path: `${base}/playable-specialization/index`, - namespace: 'static', - }; - }, - /** - * Get a playable specialization media by ID. - * @param specializationId The playable specialization ID. - * @returns The playable specialization media. See {@link PlayableSpecializationMediaResponse}. - */ - playableSpecializationMedia: (specializationId: number): Resource => { - return { - path: `${mediaBase}/playable-specialization/${specializationId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a playable specialization by ID. + * @param specializationId The playable specialization ID. + * @returns The playable specialization. See {@link PlayableSpecializationResponse}. + */ +export function playableSpecialization(specializationId: number): Resource { + return { + path: `${base}/playable-specialization/${specializationId}`, + namespace: 'static', + }; +} +/** + * Get a playable specialization index. + * @returns The playable specialization index. See {@link PlayableSpecializationIndexResponse}. + */ +export function playableSpecializationIndex(): Resource { + return { + path: `${base}/playable-specialization/index`, + namespace: 'static', + }; +} +/** + * Get a playable specialization media by ID. + * @param specializationId The playable specialization ID. + * @returns The playable specialization media. See {@link PlayableSpecializationMediaResponse}. + */ +export function playableSpecializationMedia(specializationId: number): Resource { + return { + path: `${mediaBase}/playable-specialization/${specializationId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/power-type/power-type.test.ts b/packages/wow/src/power-type/power-type.test.ts index 48eb303..e9e543f 100644 --- a/packages/wow/src/power-type/power-type.test.ts +++ b/packages/wow/src/power-type/power-type.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { powerTypeApi } from './power-type'; +import * as powerTypeApi from './power-type'; describe.concurrent('powerTypeApi', () => { it('powerType should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/power-type/power-type.ts b/packages/wow/src/power-type/power-type.ts index 296a571..dcbfa94 100644 --- a/packages/wow/src/power-type/power-type.ts +++ b/packages/wow/src/power-type/power-type.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { PowerTypeIndexResponse, PowerTypeResponse } from './types'; -export const powerTypeApi = { - /** - * Get a power type by ID. - * @param powerTypeId The power type ID. - * @returns The power type. See {@link PowerTypeResponse}. - */ - powerType: (powerTypeId: number): Resource => { - return { - path: `${base}/power-type/${powerTypeId}`, - namespace: 'static', - }; - }, - /** - * Get a power type index. - * @returns The power type index. See {@link PowerTypeIndexResponse}. - */ - powerTypeIndex: (): Resource => { - return { - path: `${base}/power-type/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a power type by ID. + * @param powerTypeId The power type ID. + * @returns The power type. See {@link PowerTypeResponse}. + */ +export function powerType(powerTypeId: number): Resource { + return { + path: `${base}/power-type/${powerTypeId}`, + namespace: 'static', + }; +} +/** + * Get a power type index. + * @returns The power type index. See {@link PowerTypeIndexResponse}. + */ +export function powerTypeIndex(): Resource { + return { + path: `${base}/power-type/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/profession/profession.test.ts b/packages/wow/src/profession/profession.test.ts index 4b40f3b..61f3162 100644 --- a/packages/wow/src/profession/profession.test.ts +++ b/packages/wow/src/profession/profession.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { professionApi } from './profession'; +import * as professionApi from './profession'; describe.concurrent('professionApi', () => { it('profession should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/profession/profession.ts b/packages/wow/src/profession/profession.ts index 6045a56..b2e1282 100644 --- a/packages/wow/src/profession/profession.ts +++ b/packages/wow/src/profession/profession.ts @@ -9,71 +9,69 @@ import type { RecipeResponse, } from './types'; -export const professionApi = { - /** - * Get a profession by ID. - * @param professionId The profession ID. - * @returns The profession. See {@link ProfessionResponse}. - */ - profession: (professionId: number): Resource => { - return { - path: `${base}/profession/${professionId}`, - namespace: 'static', - }; - }, - /** - * Get a profession index. - * @returns The profession index. See {@link ProfessionIndexResponse}. - */ - professionIndex: (): Resource => { - return { - path: `${base}/profession/index`, - namespace: 'static', - }; - }, - /** - * Get profession media by ID. - * @param professionId The profession ID. - * @returns The profession media. See {@link ProfessionMediaResponse}. - */ - professionMedia: (professionId: number): Resource => { - return { - path: `${mediaBase}/profession/${professionId}`, - namespace: 'static', - }; - }, - /** - * Get a profession's skill tier by ID. - * @param professionId The profession ID. - * @param skillTierId The skill tier ID. - * @returns The profession's skill tier. See {@link ProfessionSkillTierResponse}. - */ - professionSkillTier: (professionId: number, skillTierId: number): Resource => { - return { - path: `${base}/profession/${professionId}/skill-tier/${skillTierId}`, - namespace: 'static', - }; - }, - /** - * Get a recipe by ID. - * @param recipeId The recipe ID. - * @returns The recipe. See {@link RecipeResponse}. - */ - recipe: (recipeId: number): Resource => { - return { - path: `${base}/recipe/${recipeId}`, - namespace: 'static', - }; - }, - /** - * Get recipe media by ID. - * @param recipeId The recipe ID. - * @returns The recipe media. See {@link RecipeMediaResponse}. - */ - recipeMedia: (recipeId: number): Resource => { - return { - path: `${mediaBase}/recipe/${recipeId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a profession by ID. + * @param professionId The profession ID. + * @returns The profession. See {@link ProfessionResponse}. + */ +export function profession(professionId: number): Resource { + return { + path: `${base}/profession/${professionId}`, + namespace: 'static', + }; +} +/** + * Get a profession index. + * @returns The profession index. See {@link ProfessionIndexResponse}. + */ +export function professionIndex(): Resource { + return { + path: `${base}/profession/index`, + namespace: 'static', + }; +} +/** + * Get profession media by ID. + * @param professionId The profession ID. + * @returns The profession media. See {@link ProfessionMediaResponse}. + */ +export function professionMedia(professionId: number): Resource { + return { + path: `${mediaBase}/profession/${professionId}`, + namespace: 'static', + }; +} +/** + * Get a profession's skill tier by ID. + * @param professionId The profession ID. + * @param skillTierId The skill tier ID. + * @returns The profession's skill tier. See {@link ProfessionSkillTierResponse}. + */ +export function professionSkillTier(professionId: number, skillTierId: number): Resource { + return { + path: `${base}/profession/${professionId}/skill-tier/${skillTierId}`, + namespace: 'static', + }; +} +/** + * Get a recipe by ID. + * @param recipeId The recipe ID. + * @returns The recipe. See {@link RecipeResponse}. + */ +export function recipe(recipeId: number): Resource { + return { + path: `${base}/recipe/${recipeId}`, + namespace: 'static', + }; +} +/** + * Get recipe media by ID. + * @param recipeId The recipe ID. + * @returns The recipe media. See {@link RecipeMediaResponse}. + */ +export function recipeMedia(recipeId: number): Resource { + return { + path: `${mediaBase}/recipe/${recipeId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/pvp-season/pvp-season.test.ts b/packages/wow/src/pvp-season/pvp-season.test.ts index 5a29608..adb2fae 100644 --- a/packages/wow/src/pvp-season/pvp-season.test.ts +++ b/packages/wow/src/pvp-season/pvp-season.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { pvpSeasonApi } from './pvp-season'; +import * as pvpSeasonApi from './pvp-season'; describe.concurrent('pvpSeasonApi', () => { const pvpSeasonId = 123; diff --git a/packages/wow/src/pvp-season/pvp-season.ts b/packages/wow/src/pvp-season/pvp-season.ts index 3a79cdd..72766c4 100644 --- a/packages/wow/src/pvp-season/pvp-season.ts +++ b/packages/wow/src/pvp-season/pvp-season.ts @@ -8,60 +8,58 @@ import type { PvpSeasonResponse, } from './types'; -export const pvpSeasonApi = { - /** - * Get a PvP leaderboard by PvP season ID and bracket. - * @param pvpSeasonId The PvP season ID. - * @param bracket The PvP bracket. - * @returns The PvP leaderboard. See {@link PvpLeaderboardResponse}. - */ - pvpLeaderboard: (pvpSeasonId: number, bracket: string): Resource => { - return { - path: `${base}/pvp-season/${pvpSeasonId}/pvp-leaderboard/${bracket}`, - namespace: 'dynamic', - }; - }, - /** - * Get a PvP leaderboard index by PvP season ID. - * @param pvpSeasonId The PvP season ID. - * @returns The PvP leaderboard index. See {@link PvpLeaderboardIndexResponse}. - */ - pvpLeaderboardIndex: (pvpSeasonId: number): Resource => { - return { - path: `${base}/pvp-season/${pvpSeasonId}/pvp-leaderboard/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a PvP reward index by PvP season ID. - * @param pvpSeasonId The PvP season ID. - * @returns The PvP reward index. See {@link PvpRewardsIndexResponse}. - */ - pvpRewardsIndex: (pvpSeasonId: number): Resource => { - return { - path: `${base}/pvp-season/${pvpSeasonId}/pvp-reward/index`, - namespace: 'dynamic', - }; - }, - /** - * Get a PvP season by ID. - * @param pvpSeasonId The PvP season ID. - * @returns The PvP season. See {@link PvpSeasonResponse}. - */ - pvpSeason: (pvpSeasonId: number): Resource => { - return { - path: `${base}/pvp-season/${pvpSeasonId}`, - namespace: 'dynamic', - }; - }, - /** - * Get a PvP season index. - * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. - */ - pvpSeasonIndex: (): Resource => { - return { - path: `${base}/pvp-season/index`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get a PvP leaderboard by PvP season ID and bracket. + * @param pvpSeasonId The PvP season ID. + * @param bracket The PvP bracket. + * @returns The PvP leaderboard. See {@link PvpLeaderboardResponse}. + */ +export function pvpLeaderboard(pvpSeasonId: number, bracket: string): Resource { + return { + path: `${base}/pvp-season/${pvpSeasonId}/pvp-leaderboard/${bracket}`, + namespace: 'dynamic', + }; +} +/** + * Get a PvP leaderboard index by PvP season ID. + * @param pvpSeasonId The PvP season ID. + * @returns The PvP leaderboard index. See {@link PvpLeaderboardIndexResponse}. + */ +export function pvpLeaderboardIndex(pvpSeasonId: number): Resource { + return { + path: `${base}/pvp-season/${pvpSeasonId}/pvp-leaderboard/index`, + namespace: 'dynamic', + }; +} +/** + * Get a PvP reward index by PvP season ID. + * @param pvpSeasonId The PvP season ID. + * @returns The PvP reward index. See {@link PvpRewardsIndexResponse}. + */ +export function pvpRewardsIndex(pvpSeasonId: number): Resource { + return { + path: `${base}/pvp-season/${pvpSeasonId}/pvp-reward/index`, + namespace: 'dynamic', + }; +} +/** + * Get a PvP season by ID. + * @param pvpSeasonId The PvP season ID. + * @returns The PvP season. See {@link PvpSeasonResponse}. + */ +export function pvpSeason(pvpSeasonId: number): Resource { + return { + path: `${base}/pvp-season/${pvpSeasonId}`, + namespace: 'dynamic', + }; +} +/** + * Get a PvP season index. + * @returns The PvP season index. See {@link PvpSeasonIndexResponse}. + */ +export function pvpSeasonIndex(): Resource { + return { + path: `${base}/pvp-season/index`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/pvp-tier/pvp-tier.test.ts b/packages/wow/src/pvp-tier/pvp-tier.test.ts index 59690bd..e9f96d5 100644 --- a/packages/wow/src/pvp-tier/pvp-tier.test.ts +++ b/packages/wow/src/pvp-tier/pvp-tier.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { pvpTierApi } from './pvp-tier'; +import * as pvpTierApi from './pvp-tier'; describe.concurrent('pvpTierApi', () => { it('pvpTier should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/pvp-tier/pvp-tier.ts b/packages/wow/src/pvp-tier/pvp-tier.ts index 4b1a087..e50ae3e 100644 --- a/packages/wow/src/pvp-tier/pvp-tier.ts +++ b/packages/wow/src/pvp-tier/pvp-tier.ts @@ -2,37 +2,35 @@ import type { Resource } from '@blizzard-api/core'; import { base, mediaBase } from '../base'; import type { PvpTierIndexResponse, PvpTierMediaResponse, PvpTierResponse } from './types'; -export const pvpTierApi = { - /** - * Get a PvP tier by ID. - * @param pvpTierId The PvP tier ID. - * @returns The PvP tier. See {@link PvpTierResponse}. - */ - pvpTier: (pvpTierId: number): Resource => { - return { - path: `${base}/pvp-tier/${pvpTierId}`, - namespace: 'static', - }; - }, - /** - * Get a PvP tier index. - * @returns The PvP tier index. See {@link PvpTierIndexResponse}. - */ - pvpTierIndex: (): Resource => { - return { - path: `${base}/pvp-tier/index`, - namespace: 'static', - }; - }, - /** - * Get PvP tier media by ID. - * @param pvpTierId The PvP tier ID. - * @returns The PvP tier media. See {@link PvpTierMediaResponse}. - */ - pvpTierMedia: (pvpTierId: number): Resource => { - return { - path: `${mediaBase}/pvp-tier/${pvpTierId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a PvP tier by ID. + * @param pvpTierId The PvP tier ID. + * @returns The PvP tier. See {@link PvpTierResponse}. + */ +export function pvpTier(pvpTierId: number): Resource { + return { + path: `${base}/pvp-tier/${pvpTierId}`, + namespace: 'static', + }; +} +/** + * Get a PvP tier index. + * @returns The PvP tier index. See {@link PvpTierIndexResponse}. + */ +export function pvpTierIndex(): Resource { + return { + path: `${base}/pvp-tier/index`, + namespace: 'static', + }; +} +/** + * Get PvP tier media by ID. + * @param pvpTierId The PvP tier ID. + * @returns The PvP tier media. See {@link PvpTierMediaResponse}. + */ +export function pvpTierMedia(pvpTierId: number): Resource { + return { + path: `${mediaBase}/pvp-tier/${pvpTierId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/quest/quest.test.ts b/packages/wow/src/quest/quest.test.ts index fd6515d..b437d4d 100644 --- a/packages/wow/src/quest/quest.test.ts +++ b/packages/wow/src/quest/quest.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { questApi } from './quest'; +import * as questApi from './quest'; describe.concurrent('questApi', () => { it('quest should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/quest/quest.ts b/packages/wow/src/quest/quest.ts index 4b084e5..9d4fd0a 100644 --- a/packages/wow/src/quest/quest.ts +++ b/packages/wow/src/quest/quest.ts @@ -11,89 +11,87 @@ import type { QuestTypeResponse, } from './types'; -export const questApi = { - /** - * Get a quest by ID. - * @param questId The quest ID. - * @returns The quest. See {@link QuestResponse}. - */ - quest: (questId: number): Resource => { - return { - path: `${base}/quest/${questId}`, - namespace: 'static', - }; - }, - /** - * Get a quest index. - * @returns The quest index. See {@link QuestIndexResponse}. - */ - questIndex: (): Resource => { - return { - path: `${base}/quest/index`, - namespace: 'static', - }; - }, - /** - * Get a quest area by ID. - * @param questAreaId The quest area ID. - * @returns The quest area. See {@link QuestAreaResponse}. - */ - questArea: (questAreaId: number): Resource => { - return { - path: `${base}/quest/area/${questAreaId}`, - namespace: 'static', - }; - }, - /** - * Get a quest area index. - * @returns The quest area index. See {@link QuestAreaIndexResponse}. - */ - questAreaIndex: (): Resource => { - return { - path: `${base}/quest/area/index`, - namespace: 'static', - }; - }, - /** - * Get a quest category by ID. - * @param questCategoryId The quest category ID. - * @returns The quest category. See {@link QuestCategoryResponse}. - */ - questCategory: (questCategoryId: number): Resource => { - return { - path: `${base}/quest/category/${questCategoryId}`, - namespace: 'static', - }; - }, - /** - * Get a quest category index. - * @returns The quest category index. See {@link QuestCategoryIndexResponse}. - */ - questCategoryIndex: (): Resource => { - return { - path: `${base}/quest/category/index`, - namespace: 'static', - }; - }, - /** - * Get a quest type by ID. - * @param questTypeId The quest type ID. - * @returns The quest type. See {@link QuestTypeResponse}. - */ - questType: (questTypeId: number): Resource => { - return { - path: `${base}/quest/type/${questTypeId}`, - namespace: 'static', - }; - }, - /** - * Get a quest type index. - * @returns The quest type index. See {@link QuestTypeIndexResponse}. - */ - questTypeIndex: (): Resource => { - return { - path: `${base}/quest/type/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a quest by ID. + * @param questId The quest ID. + * @returns The quest. See {@link QuestResponse}. + */ +export function quest(questId: number): Resource { + return { + path: `${base}/quest/${questId}`, + namespace: 'static', + }; +} +/** + * Get a quest index. + * @returns The quest index. See {@link QuestIndexResponse}. + */ +export function questIndex(): Resource { + return { + path: `${base}/quest/index`, + namespace: 'static', + }; +} +/** + * Get a quest area by ID. + * @param questAreaId The quest area ID. + * @returns The quest area. See {@link QuestAreaResponse}. + */ +export function questArea(questAreaId: number): Resource { + return { + path: `${base}/quest/area/${questAreaId}`, + namespace: 'static', + }; +} +/** + * Get a quest area index. + * @returns The quest area index. See {@link QuestAreaIndexResponse}. + */ +export function questAreaIndex(): Resource { + return { + path: `${base}/quest/area/index`, + namespace: 'static', + }; +} +/** + * Get a quest category by ID. + * @param questCategoryId The quest category ID. + * @returns The quest category. See {@link QuestCategoryResponse}. + */ +export function questCategory(questCategoryId: number): Resource { + return { + path: `${base}/quest/category/${questCategoryId}`, + namespace: 'static', + }; +} +/** + * Get a quest category index. + * @returns The quest category index. See {@link QuestCategoryIndexResponse}. + */ +export function questCategoryIndex(): Resource { + return { + path: `${base}/quest/category/index`, + namespace: 'static', + }; +} +/** + * Get a quest type by ID. + * @param questTypeId The quest type ID. + * @returns The quest type. See {@link QuestTypeResponse}. + */ +export function questType(questTypeId: number): Resource { + return { + path: `${base}/quest/type/${questTypeId}`, + namespace: 'static', + }; +} +/** + * Get a quest type index. + * @returns The quest type index. See {@link QuestTypeIndexResponse}. + */ +export function questTypeIndex(): Resource { + return { + path: `${base}/quest/type/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/realm/realm.test.ts b/packages/wow/src/realm/realm.test.ts index 9c80b5d..d77cfca 100644 --- a/packages/wow/src/realm/realm.test.ts +++ b/packages/wow/src/realm/realm.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, searchBase } from '../base'; -import { realmApi } from './realm'; +import * as realmApi from './realm'; describe.concurrent('realmApi', () => { it('realm should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/realm/realm.ts b/packages/wow/src/realm/realm.ts index 56f48ae..8cef9e9 100644 --- a/packages/wow/src/realm/realm.ts +++ b/packages/wow/src/realm/realm.ts @@ -2,44 +2,42 @@ import type { Resource, SearchResponse } from '@blizzard-api/core'; import { base, searchBase } from '../base'; import type { RealmIndexResponse, RealmResponse, RealmSearchParameters, RealmSearchResponseItem } from './types'; -export const realmApi = { - /** - * Get a realm by slug. - * @param realmSlug The realm slug. - * @returns The realm. See {@link RealmResponse}. - */ - realm: (realmSlug: string): Resource => { - return { - path: `${base}/realm/${realmSlug}`, - namespace: 'dynamic', - }; - }, - /** - * Get a realm index. - * @returns The realm index. See {@link RealmIndexResponse}. - */ - realmIndex: (): Resource => { - return { - path: `${base}/realm/index`, - namespace: 'dynamic', - }; - }, - /** - * Search for realms. - * @param options The search parameters. See {@link RealmSearchParameters}. - * @returns The search results. See {@link SearchResponse}. - */ - realmSearch: ( - options: RealmSearchParameters, - ): Resource, RealmSearchParameters> => { - return { - namespace: 'dynamic', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - timezone: options.timezone, - }, - path: `${searchBase}/realm`, - }; - }, -}; +/** + * Get a realm by slug. + * @param realmSlug The realm slug. + * @returns The realm. See {@link RealmResponse}. + */ +export function realm(realmSlug: string): Resource { + return { + path: `${base}/realm/${realmSlug}`, + namespace: 'dynamic', + }; +} +/** + * Get a realm index. + * @returns The realm index. See {@link RealmIndexResponse}. + */ +export function realmIndex(): Resource { + return { + path: `${base}/realm/index`, + namespace: 'dynamic', + }; +} +/** + * Search for realms. + * @param options The search parameters. See {@link RealmSearchParameters}. + * @returns The search results. See {@link SearchResponse}. + */ +export function realmSearch( + options: RealmSearchParameters, +): Resource, RealmSearchParameters> { + return { + namespace: 'dynamic', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + timezone: options.timezone, + }, + path: `${searchBase}/realm`, + }; +} diff --git a/packages/wow/src/region/region.test.ts b/packages/wow/src/region/region.test.ts index ea23c22..e8d1977 100644 --- a/packages/wow/src/region/region.test.ts +++ b/packages/wow/src/region/region.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { regionApi } from './region'; +import * as regionApi from './region'; describe.concurrent('regionApi', () => { it('region should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/region/region.ts b/packages/wow/src/region/region.ts index ce63225..331266c 100644 --- a/packages/wow/src/region/region.ts +++ b/packages/wow/src/region/region.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { RegionIndexResponse, RegionResponse } from './types'; -export const regionApi = { - /** - * Get a region by ID. - * @param regionId The region ID. - * @returns The region. See {@link RegionResponse}. - */ - region: (regionId: number): Resource => { - return { - path: `${base}/region/${regionId}`, - namespace: 'dynamic', - }; - }, - /** - * Get a region index. - * @returns The region index. See {@link RegionIndexResponse}. - */ - regionIndex: (): Resource => { - return { - path: `${base}/region/index`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get a region by ID. + * @param regionId The region ID. + * @returns The region. See {@link RegionResponse}. + */ +export function region(regionId: number): Resource { + return { + path: `${base}/region/${regionId}`, + namespace: 'dynamic', + }; +} +/** + * Get a region index. + * @returns The region index. See {@link RegionIndexResponse}. + */ +export function regionIndex(): Resource { + return { + path: `${base}/region/index`, + namespace: 'dynamic', + }; +} diff --git a/packages/wow/src/reputations/reputations.test.ts b/packages/wow/src/reputations/reputations.test.ts index 607ba7a..c10d98b 100644 --- a/packages/wow/src/reputations/reputations.test.ts +++ b/packages/wow/src/reputations/reputations.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { reputationApi } from './reputations'; +import * as reputationApi from './reputations'; describe.concurrent('reputationApi', () => { it('reputationFaction should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/reputations/reputations.ts b/packages/wow/src/reputations/reputations.ts index 3978d28..abbe219 100644 --- a/packages/wow/src/reputations/reputations.ts +++ b/packages/wow/src/reputations/reputations.ts @@ -7,47 +7,45 @@ import type { ReputationTiersResponse, } from './types'; -export const reputationApi = { - /** - * Get a reputation faction by ID. - * @param reputationFactionId The reputation faction ID. - * @returns The reputation faction. See {@link ReputationFactionResponse}. - */ - reputationFaction: (reputationFactionId: number): Resource => { - return { - path: `${base}/reputation-faction/${reputationFactionId}`, - namespace: 'static', - }; - }, - /** - * Get a reputation faction index. - * @returns The reputation faction index. See {@link ReputationFactionIndexResponse}. - */ - reputationFactionIndex: (): Resource => { - return { - path: `${base}/reputation-faction/index`, - namespace: 'static', - }; - }, - /** - * Get a reputation tier by ID. - * @param reputationTiersId The reputation tier ID. - * @returns The reputation tier. See {@link ReputationTiersResponse}. - */ - reputationTiers: (reputationTiersId: number): Resource => { - return { - path: `${base}/reputation-tiers/${reputationTiersId}`, - namespace: 'static', - }; - }, - /** - * Get a reputation tier index. - * @returns The reputation tier index. See {@link ReputationTiersIndexResponse}. - */ - reputationTiersIndex: (): Resource => { - return { - path: `${base}/reputation-tiers/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a reputation faction by ID. + * @param reputationFactionId The reputation faction ID. + * @returns The reputation faction. See {@link ReputationFactionResponse}. + */ +export function reputationFaction(reputationFactionId: number): Resource { + return { + path: `${base}/reputation-faction/${reputationFactionId}`, + namespace: 'static', + }; +} +/** + * Get a reputation faction index. + * @returns The reputation faction index. See {@link ReputationFactionIndexResponse}. + */ +export function reputationFactionIndex(): Resource { + return { + path: `${base}/reputation-faction/index`, + namespace: 'static', + }; +} +/** + * Get a reputation tier by ID. + * @param reputationTiersId The reputation tier ID. + * @returns The reputation tier. See {@link ReputationTiersResponse}. + */ +export function reputationTiers(reputationTiersId: number): Resource { + return { + path: `${base}/reputation-tiers/${reputationTiersId}`, + namespace: 'static', + }; +} +/** + * Get a reputation tier index. + * @returns The reputation tier index. See {@link ReputationTiersIndexResponse}. + */ +export function reputationTiersIndex(): Resource { + return { + path: `${base}/reputation-tiers/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/spell/spell.test.ts b/packages/wow/src/spell/spell.test.ts index 7777d20..adb5ff8 100644 --- a/packages/wow/src/spell/spell.test.ts +++ b/packages/wow/src/spell/spell.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase, searchBase } from '../base'; -import { spellApi } from './spell'; +import * as spellApi from './spell'; describe.concurrent('spellApi', () => { it('spell should return a resource object with the correct path and namespace', ({ expect }) => { diff --git a/packages/wow/src/spell/spell.ts b/packages/wow/src/spell/spell.ts index 3c0dc67..9332d8f 100644 --- a/packages/wow/src/spell/spell.ts +++ b/packages/wow/src/spell/spell.ts @@ -2,45 +2,43 @@ import type { Resource, SearchResponse } from '@blizzard-api/core'; import { base, mediaBase, searchBase } from '../base'; import type { SpellMediaResponse, SpellResponse, SpellSearchParameters, SpellSearchResponseItem } from './types'; -export const spellApi = { - /** - * Get a spell by ID. - * @param spellId The spell ID. - * @returns The spell. See {@link SpellResponse}. - */ - spell: (spellId: number): Resource => { - return { - path: `${base}/spell/${spellId}`, - namespace: 'static', - }; - }, - /** - * Get spell media by ID. - * @param spellId The spell ID. - * @returns The spell media. See {@link SpellMediaResponse}. - */ - spellMedia: (spellId: number): Resource => { - return { - path: `${mediaBase}/spell/${spellId}`, - namespace: 'static', - }; - }, - /** - * Get a spell search. - * @param options The spell search options. See {@link SpellSearchParameters}. - * @returns The spell search. See {@link SearchResponse}. - */ - spellSearch: ( - options: SpellSearchParameters, - ): Resource, Omit> => { - return { - namespace: 'static', - parameters: { - _page: options._page, - orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, - [`name.${options.locale}`]: options.name, - }, - path: `${searchBase}/spell`, - }; - }, -}; +/** + * Get a spell by ID. + * @param spellId The spell ID. + * @returns The spell. See {@link SpellResponse}. + */ +export function spell(spellId: number): Resource { + return { + path: `${base}/spell/${spellId}`, + namespace: 'static', + }; +} +/** + * Get spell media by ID. + * @param spellId The spell ID. + * @returns The spell media. See {@link SpellMediaResponse}. + */ +export function spellMedia(spellId: number): Resource { + return { + path: `${mediaBase}/spell/${spellId}`, + namespace: 'static', + }; +} +/** + * Get a spell search. + * @param options The spell search options. See {@link SpellSearchParameters}. + * @returns The spell search. See {@link SearchResponse}. + */ +export function spellSearch( + options: SpellSearchParameters, +): Resource, Omit> { + return { + namespace: 'static', + parameters: { + _page: options._page, + orderby: Array.isArray(options.orderby) ? options.orderby.join(',') : options.orderby, + [`name.${options.locale}`]: options.name, + }, + path: `${searchBase}/spell`, + }; +} diff --git a/packages/wow/src/talent/talent.test.ts b/packages/wow/src/talent/talent.test.ts index fc35c01..491d01a 100644 --- a/packages/wow/src/talent/talent.test.ts +++ b/packages/wow/src/talent/talent.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { talentApi } from './talent'; +import * as talentApi from './talent'; describe.concurrent('talentApi', () => { it('should return the correct path for pvpTalent', ({ expect }) => { diff --git a/packages/wow/src/talent/talent.ts b/packages/wow/src/talent/talent.ts index 51b310e..3970be5 100644 --- a/packages/wow/src/talent/talent.ts +++ b/packages/wow/src/talent/talent.ts @@ -10,80 +10,78 @@ import type { TalentTreeResponse, } from './types'; -export const talentApi = { - /** - * Get a PvP talent by ID. - * @param pvpTalentId The PvP talent ID. - * @returns The PvP talent. See {@link PvpTalentResponse}. - */ - pvpTalent: (pvpTalentId: number): Resource => { - return { - path: `${base}/pvp-talent/${pvpTalentId}`, - namespace: 'static', - }; - }, - /** - * Get a PvP talent index. - * @returns The PvP talent index. See {@link PvpTalentIndexResponse}. - */ - pvpTalentIndex: (): Resource => { - return { - path: `${base}/pvp-talent/index`, - namespace: 'static', - }; - }, - /** - * Get a talent by ID. - * @param talentId The talent ID. - * @returns The talent. See {@link TalentResponse}. - */ - talent: (talentId: number): Resource => { - return { - path: `${base}/talent/${talentId}`, - namespace: 'static', - }; - }, - /** - * Get a talent index. - * @returns The talent index. See {@link TalentIndexResponse}. - */ - talentIndex: (): Resource => { - return { - path: `${base}/talent/index`, - namespace: 'static', - }; - }, - /** - * Get a talent tree by ID. - * @param talentTreeId The talent tree ID. - * @param specId The playable specialization ID. - * @returns The talent tree. See {@link TalentTreeResponse}. - */ - talentTree: (talentTreeId: number, specId: number): Resource => { - return { - path: `${base}/talent-tree/${talentTreeId}/playable-specialization/${specId}`, - namespace: 'static', - }; - }, - /** - * Get a talent tree index. - * @returns The talent tree index. See {@link TalentTreeIndexResponse}. - */ - talentTreeIndex: (): Resource => { - return { - path: `${base}/talent-tree/index`, - namespace: 'static', - }; - }, - /** - * Get talent tree nodes by talent tree ID. - * @param talentTreeId The talent tree ID. - * @returns The talent tree nodes. See {@link TalentTreeNodesResponse}. - */ - talentTreeNodes: (talentTreeId: number): Resource => { - return { - path: `${base}/talent-tree/${talentTreeId}`, - namespace: 'static', - }; - }, -}; +/** + * Get a PvP talent by ID. + * @param pvpTalentId The PvP talent ID. + * @returns The PvP talent. See {@link PvpTalentResponse}. + */ +export function pvpTalent(pvpTalentId: number): Resource { + return { + path: `${base}/pvp-talent/${pvpTalentId}`, + namespace: 'static', + }; +} +/** + * Get a PvP talent index. + * @returns The PvP talent index. See {@link PvpTalentIndexResponse}. + */ +export function pvpTalentIndex(): Resource { + return { + path: `${base}/pvp-talent/index`, + namespace: 'static', + }; +} +/** + * Get a talent by ID. + * @param talentId The talent ID. + * @returns The talent. See {@link TalentResponse}. + */ +export function talent(talentId: number): Resource { + return { + path: `${base}/talent/${talentId}`, + namespace: 'static', + }; +} +/** + * Get a talent index. + * @returns The talent index. See {@link TalentIndexResponse}. + */ +export function talentIndex(): Resource { + return { + path: `${base}/talent/index`, + namespace: 'static', + }; +} +/** + * Get a talent tree by ID. + * @param talentTreeId The talent tree ID. + * @param specId The playable specialization ID. + * @returns The talent tree. See {@link TalentTreeResponse}. + */ +export function talentTree(talentTreeId: number, specId: number): Resource { + return { + path: `${base}/talent-tree/${talentTreeId}/playable-specialization/${specId}`, + namespace: 'static', + }; +} +/** + * Get a talent tree index. + * @returns The talent tree index. See {@link TalentTreeIndexResponse}. + */ +export function talentTreeIndex(): Resource { + return { + path: `${base}/talent-tree/index`, + namespace: 'static', + }; +} +/** + * Get talent tree nodes by talent tree ID. + * @param talentTreeId The talent tree ID. + * @returns The talent tree nodes. See {@link TalentTreeNodesResponse}. + */ +export function talentTreeNodes(talentTreeId: number): Resource { + return { + path: `${base}/talent-tree/${talentTreeId}`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/tech-talent/tech-talent.test.ts b/packages/wow/src/tech-talent/tech-talent.test.ts index a62e5e5..a89fe91 100644 --- a/packages/wow/src/tech-talent/tech-talent.test.ts +++ b/packages/wow/src/tech-talent/tech-talent.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base, mediaBase } from '../base'; -import { techTalentApi } from './tech-talent'; +import * as techTalentApi from './tech-talent'; describe.concurrent('techTalentApi', () => { it('should return the correct path for techTalent', ({ expect }) => { diff --git a/packages/wow/src/tech-talent/tech-talent.ts b/packages/wow/src/tech-talent/tech-talent.ts index 4e1af4a..479d783 100644 --- a/packages/wow/src/tech-talent/tech-talent.ts +++ b/packages/wow/src/tech-talent/tech-talent.ts @@ -8,58 +8,56 @@ import type { TechTalentTreeResponse, } from './types'; -export const techTalentApi = { - /** - * Get a tech talent by ID. - * @param techTalentId The tech talent ID. - * @returns The tech talent. See {@link TechTalentResponse}. - */ - techTalent: (techTalentId: number): Resource => { - return { - path: `${base}/tech-talent/${techTalentId}`, - namespace: 'static', - }; - }, - /** - * Get a tech talent index. - * @returns The tech talent index. See {@link TechTalentIndexResponse}. - */ - techTalentIndex: (): Resource => { - return { - path: `${base}/tech-talent/index`, - namespace: 'static', - }; - }, - /** - * Get tech talent media by ID. - * @param techTalentId The tech talent ID. - * @returns The tech talent media. See {@link TechTalentMediaResponse}. - */ - techTalentMedia: (techTalentId: number): Resource => { - return { - path: `${mediaBase}/tech-talent/${techTalentId}`, - namespace: 'static', - }; - }, - /** - * Get a tech talent tree by ID. - * @param techTalentTreeId The tech talent tree ID. - * @returns The tech talent tree. See {@link TechTalentTreeResponse}. - */ - techTalentTree: (techTalentTreeId: number): Resource => { - return { - path: `${base}/tech-talent-tree/${techTalentTreeId}`, - namespace: 'static', - }; - }, - /** - * Get a tech talent tree index. - * @returns The tech talent tree index. See {@link TechTalentTreeIndexResponse}. - */ - techTalentTreeIndex: (): Resource => { - return { - path: `${base}/tech-talent-tree/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a tech talent by ID. + * @param techTalentId The tech talent ID. + * @returns The tech talent. See {@link TechTalentResponse}. + */ +export function techTalent(techTalentId: number): Resource { + return { + path: `${base}/tech-talent/${techTalentId}`, + namespace: 'static', + }; +} +/** + * Get a tech talent index. + * @returns The tech talent index. See {@link TechTalentIndexResponse}. + */ +export function techTalentIndex(): Resource { + return { + path: `${base}/tech-talent/index`, + namespace: 'static', + }; +} +/** + * Get tech talent media by ID. + * @param techTalentId The tech talent ID. + * @returns The tech talent media. See {@link TechTalentMediaResponse}. + */ +export function techTalentMedia(techTalentId: number): Resource { + return { + path: `${mediaBase}/tech-talent/${techTalentId}`, + namespace: 'static', + }; +} +/** + * Get a tech talent tree by ID. + * @param techTalentTreeId The tech talent tree ID. + * @returns The tech talent tree. See {@link TechTalentTreeResponse}. + */ +export function techTalentTree(techTalentTreeId: number): Resource { + return { + path: `${base}/tech-talent-tree/${techTalentTreeId}`, + namespace: 'static', + }; +} +/** + * Get a tech talent tree index. + * @returns The tech talent tree index. See {@link TechTalentTreeIndexResponse}. + */ +export function techTalentTreeIndex(): Resource { + return { + path: `${base}/tech-talent-tree/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/title/title.test.ts b/packages/wow/src/title/title.test.ts index 0c2fe13..ec4fb84 100644 --- a/packages/wow/src/title/title.test.ts +++ b/packages/wow/src/title/title.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { titleApi } from './title'; +import * as titleApi from './title'; describe.concurrent('titleApi', () => { it('should return the correct path for title', ({ expect }) => { diff --git a/packages/wow/src/title/title.ts b/packages/wow/src/title/title.ts index 7e17809..a6c77c1 100644 --- a/packages/wow/src/title/title.ts +++ b/packages/wow/src/title/title.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { TitleIndexResponse, TitleResponse } from './types'; -export const titleApi = { - /** - * Get a title by ID. - * @param titleId The title ID. - * @returns The title. See {@link TitleResponse}. - */ - title: (titleId: number): Resource => { - return { - path: `${base}/title/${titleId}`, - namespace: 'static', - }; - }, - /** - * Get a title index. - * @returns The title index. See {@link TitleIndexResponse}. - */ - titleIndex: (): Resource => { - return { - path: `${base}/title/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a title by ID. + * @param titleId The title ID. + * @returns The title. See {@link TitleResponse}. + */ +export function title(titleId: number): Resource { + return { + path: `${base}/title/${titleId}`, + namespace: 'static', + }; +} +/** + * Get a title index. + * @returns The title index. See {@link TitleIndexResponse}. + */ +export function titleIndex(): Resource { + return { + path: `${base}/title/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/toy/toy.test.ts b/packages/wow/src/toy/toy.test.ts index 886db57..b7e9e8f 100644 --- a/packages/wow/src/toy/toy.test.ts +++ b/packages/wow/src/toy/toy.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { toyApi } from './toy'; +import * as toyApi from './toy'; describe.concurrent('toyApi', () => { it('should return the correct path for toy', ({ expect }) => { diff --git a/packages/wow/src/toy/toy.ts b/packages/wow/src/toy/toy.ts index c27b12b..28f1f1f 100644 --- a/packages/wow/src/toy/toy.ts +++ b/packages/wow/src/toy/toy.ts @@ -2,26 +2,24 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { ToyIndexResponse, ToyResponse } from './types'; -export const toyApi = { - /** - * Get a toy by ID. - * @param toyId The toy ID. - * @returns The toy. See {@link ToyResponse}. - */ - toy: (toyId: number): Resource => { - return { - path: `${base}/toy/${toyId}`, - namespace: 'static', - }; - }, - /** - * Get a toy index. - * @returns The toy index. See {@link ToyIndexResponse}. - */ - toyIndex: (): Resource => { - return { - path: `${base}/toy/index`, - namespace: 'static', - }; - }, -}; +/** + * Get a toy by ID. + * @param toyId The toy ID. + * @returns The toy. See {@link ToyResponse}. + */ +export function toy(toyId: number): Resource { + return { + path: `${base}/toy/${toyId}`, + namespace: 'static', + }; +} +/** + * Get a toy index. + * @returns The toy index. See {@link ToyIndexResponse}. + */ +export function toyIndex(): Resource { + return { + path: `${base}/toy/index`, + namespace: 'static', + }; +} diff --git a/packages/wow/src/wow-token/wow-token.test.ts b/packages/wow/src/wow-token/wow-token.test.ts index 93107d0..231702a 100644 --- a/packages/wow/src/wow-token/wow-token.test.ts +++ b/packages/wow/src/wow-token/wow-token.test.ts @@ -1,6 +1,6 @@ import { describe, it } from 'vitest'; import { base } from '../base'; -import { wowTokenApi } from './wow-token'; +import * as wowTokenApi from './wow-token'; describe.concurrent('wowTokenApi', () => { it('should return the wow token resource', ({ expect }) => { diff --git a/packages/wow/src/wow-token/wow-token.ts b/packages/wow/src/wow-token/wow-token.ts index 78b85cc..9e2ecc5 100644 --- a/packages/wow/src/wow-token/wow-token.ts +++ b/packages/wow/src/wow-token/wow-token.ts @@ -2,15 +2,13 @@ import type { Resource } from '@blizzard-api/core'; import { base } from '../base'; import type { WowTokenResponse } from './types'; -export const wowTokenApi = { - /** - * Get the current WoW token price. - * @returns The WoW token price. See {@link WowTokenResponse}. - */ - wowToken: (): Resource => { - return { - path: `${base}/token/index`, - namespace: 'dynamic', - }; - }, -}; +/** + * Get the current WoW token price. + * @returns The WoW token price. See {@link WowTokenResponse}. + */ +export function wowToken(): Resource { + return { + path: `${base}/token/index`, + namespace: 'dynamic', + }; +}