-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
19 changed files
with
773 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,7 @@ | ||
import { authenticate, setup } from "./src/shared/index.ts"; | ||
import * as wow from "./src/wow/index.ts"; | ||
import * as wowClassic from "./src/wow_classic/index.ts"; | ||
import * as hearthstone from "./src/hearthstone/index.ts"; | ||
import * as owl from "./src/overwatch/index.ts"; | ||
import * as sc2 from "./src/starcraft2/index.ts"; | ||
|
||
export { authenticate, setup, wow, wowClassic }; | ||
export { authenticate, hearthstone, owl, sc2, setup, wow }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,169 @@ | ||
import { LinkSelfHref, LocalizedString, request } from "../../shared/index.ts"; | ||
|
||
interface Seasons extends LinkSelfHref { | ||
season: { | ||
href: string; | ||
}[]; | ||
current_season: number; | ||
service_current_season: number; | ||
service_season_state: string; | ||
last_update_time: string; | ||
generated_by: string; | ||
} | ||
|
||
interface Season extends LinkSelfHref { | ||
leaderboard: { | ||
team_size?: number; | ||
ladder: { | ||
href: string; | ||
}; | ||
hardcore?: boolean; | ||
hero_class_string?: LocalizedString; | ||
}[]; | ||
season_id: number; | ||
last_update_time: string; | ||
generated_by: string; | ||
} | ||
|
||
interface LeaderboardData { | ||
id: string; | ||
string?: string; | ||
number?: number; | ||
timestamp?: number; | ||
} | ||
|
||
interface LeaderboardBase extends LinkSelfHref { | ||
row: { | ||
player: { | ||
key: string; | ||
accountId: number; | ||
data: LeaderboardData[]; | ||
}[]; | ||
order: 1; | ||
data: LeaderboardData[]; | ||
}[]; | ||
key: string; | ||
title: LocalizedString; | ||
column: { | ||
id: string; | ||
hidden: boolean; | ||
order: number; | ||
label: LocalizedString; | ||
type: string; | ||
}[]; | ||
last_update_time: string; | ||
generated_by: string; | ||
} | ||
|
||
interface SeasonLeaderboard extends LeaderboardBase { | ||
achievement_points: boolean; | ||
season: number; | ||
} | ||
|
||
interface EraLeaderboard extends LeaderboardBase { | ||
greater_rift: boolean; | ||
greater_rift_solo_class: string; | ||
era: number; | ||
} | ||
|
||
interface Eras extends LinkSelfHref { | ||
era: { | ||
href: string; | ||
}[]; | ||
current_era: number; | ||
last_update_time: string; | ||
generated_by: string; | ||
} | ||
|
||
interface Era extends LinkSelfHref { | ||
leaderboard: { | ||
team_size?: number; | ||
ladder: { | ||
href: string; | ||
}; | ||
hardcore?: boolean; | ||
hero_class_string?: LocalizedString; | ||
}[]; | ||
era_id: number; | ||
era_start_date: number; | ||
last_update_time: string; | ||
generated_by: string; | ||
} | ||
|
||
/** | ||
* Returns an index of available seasons. | ||
* | ||
* @returns A promise that resolves to an object representing an index of available seasons. | ||
*/ | ||
export async function seasons(): Promise<Seasons> { | ||
return await request({ | ||
method: "GET", | ||
url: "/data/d3/season/", | ||
}); | ||
} | ||
|
||
/** | ||
* Returns an index of available seasons. | ||
* | ||
* @param seasonId - The season for the leaderboard list. | ||
* @returns A promise that resolves to an object representing the data for a league. | ||
*/ | ||
export async function season(seasonId: number): Promise<Season> { | ||
return await request({ | ||
method: "GET", | ||
url: `/data/d3/season/${seasonId}`, | ||
}); | ||
} | ||
|
||
/** | ||
* Returns a the specified leaderboard for the specified season. | ||
* | ||
* @param seasonId - The season for the leaderboard. | ||
* @param leaderboard - The leaderboard to retrieve. | ||
* @returns A promise that resolves to an object representing the data for a the specified leaderboard for the specified season. | ||
*/ | ||
export async function seasonLeaderboard(seasonId: number, leaderboard: string): Promise<SeasonLeaderboard> { | ||
return await request({ | ||
method: "GET", | ||
url: `/data/d3/season/${seasonId}/leaderboard/${leaderboard}`, | ||
}); | ||
} | ||
|
||
/** | ||
* Returns an index of available eras. | ||
* | ||
* @returns A promise that resolves to an object representing an index of available eras. | ||
*/ | ||
export async function eras(): Promise<Eras> { | ||
return await request({ | ||
method: "GET", | ||
url: "/data/d3/era/", | ||
}); | ||
} | ||
|
||
/** | ||
* Returns a leaderboard list for a particular era. | ||
* | ||
* @param eraId - The era to retrieve. | ||
* @returns A promise that resolves to an object representing a leaderboard list for a particular era. | ||
*/ | ||
export async function era(eraId: number): Promise<Era> { | ||
return await request({ | ||
method: "GET", | ||
url: `/data/d3/era/${eraId}`, | ||
}); | ||
} | ||
|
||
/** | ||
* Returns the specified leaderboard for the specified era. | ||
* | ||
* @param eraId - The era for the leaderboard. | ||
* @param leaderboard - The leaderboard to retrieve. | ||
* @returns A promise that resolves to an object representing the data for a the specified leaderboard for the specified era. | ||
*/ | ||
export async function eraLeaderboard(eraId: number, leaderboard: string): Promise<EraLeaderboard> { | ||
return await request({ | ||
method: "GET", | ||
url: `/data/d3/era/${eraId}/leaderboard/${leaderboard}`, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { era, eraLeaderboard, eras, season, seasonLeaderboard, seasons } from "./game_data/d3.ts"; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { LocalizedString, request } from "../../shared/index.ts"; | ||
import { Search, search, SearchParameters } from "../search.ts"; | ||
|
||
interface Cardback { | ||
id: number; | ||
sortCategory: number; | ||
text: LocalizedString; | ||
name: LocalizedString; | ||
} | ||
|
||
/** | ||
* Returns an up-to-date list of all card backs matching the search criteria. | ||
* | ||
* @param SearchParameters - Object containing search parameters. | ||
* @returns A promise that resolves to an object representing an up-to-date list of all card backs matching the search criteria. | ||
*/ | ||
export async function searchCardbacks(searchParameters: SearchParameters): Promise<Search> { | ||
return await search("/cardback", searchParameters); | ||
} | ||
|
||
/** | ||
* Returns the card back with an ID or slug that matches the one you specify. | ||
* | ||
* @param idorslug - The unique identifier for the card back by slug. | ||
* @returns A promise that resolves to an object representing details about a card back. | ||
*/ | ||
export async function fetchCardback(idorslug: string): Promise<Cardback> { | ||
return await request({ | ||
method: "GET", | ||
url: `/hearthstone/cardback/${idorslug}`, | ||
}); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
import { LocalizedString, request, RequestOptions } from "../../shared/index.ts"; | ||
import { Search, search, SearchParameters } from "../search.ts"; | ||
|
||
interface Card { | ||
id: number; | ||
collectible: number; | ||
slug: string; | ||
classId: number; | ||
multiClassIds: number[]; | ||
cardTypeId: number; | ||
cardSetId: number; | ||
rarityId: number; | ||
artistName: string; | ||
health: number; | ||
attack: number; | ||
manaCost: number; | ||
name: LocalizedString; | ||
text: LocalizedString; | ||
image: string; | ||
imageGold: string; | ||
flavorText: LocalizedString; | ||
cropImage: string; | ||
keywordIds: number[]; | ||
} | ||
|
||
/** | ||
* Returns an up-to-date list of all cards matching the search criteria. | ||
* | ||
* @param SearchParameters - Object containing search parameters. | ||
* @returns A promise that resolves to an object representing an up-to-date list of all cards matching the search criteria. | ||
*/ | ||
export async function searchCards(searchParameters: SearchParameters): Promise<Search> { | ||
return await search("/cards", searchParameters); | ||
} | ||
|
||
/** | ||
* Returns the card with an ID or slug that matches the one you specify. | ||
* | ||
* @param idorslug - The unique identifier for the card by slug. | ||
* @returns A promise that resolves to an object representing details about a card. | ||
*/ | ||
export async function fetchCard(idorslug: string, gameMode?: string): Promise<Card> { | ||
const reqOptions: RequestOptions = { | ||
method: "GET", | ||
url: `/hearthstone/cards/${idorslug}`, | ||
}; | ||
|
||
if (gameMode) { | ||
reqOptions["qs"] = { gameMode }; | ||
} | ||
|
||
return await request(reqOptions); | ||
} |
Oops, something went wrong.