Skip to content

Commit

Permalink
more wow apis
Browse files Browse the repository at this point in the history
  • Loading branch information
Pinta365 committed Sep 13, 2023
1 parent ad1b45b commit 8fa272a
Show file tree
Hide file tree
Showing 3 changed files with 197 additions and 0 deletions.
87 changes: 87 additions & 0 deletions src/wow/guild_crest.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
import { KeyId, LinkSelfHref, request } from "../shared/index.ts";

interface Emblem {
id: number;
media: KeyId[];
}

interface Border {
id: number;
media: KeyId[];
}

interface IdRgba {
id: number;
rgba: {
r: number;
g: number;
b: number;
a: number;
};
}

interface GuildCrests extends LinkSelfHref {
emblems: Emblem[];
borders: Border[];
colors: {
emblems: IdRgba[];
borders: IdRgba[];
backgrounds: IdRgba[];
};
}

interface Asset {
key: string;
value: string;
}

interface GuildCrestBorder extends LinkSelfHref {
assets: Asset[];
id: number;
}

interface GuildCrestEmblem extends LinkSelfHref {
assets: Asset[];
id: number;
}

/**
* Returns the Guild Crest Components Index
*
* @returns A promise that resolves to an object representing a list of all Guild Crest Components.
*/
export async function guildCrests(): Promise<GuildCrests> {
return await request({
method: "GET",
url: "/data/wow/guild-crest/index",
namespace: "static",
});
}

/**
* Returns a Guild Crest Border Media
*
* @param borderId - The unique identifier for the Covenant
* @returns A promise that resolves to an object representing details about a Guild Crest Border Media.
*/
export async function guildCrestBorder(borderId: number): Promise<GuildCrestBorder> {
return await request({
method: "GET",
url: `/data/wow/media/guild-crest/border/${borderId}`,
namespace: "static",
});
}

/**
* Returns a Crest Emblem Media
*
* @param emblemId - The unique identifier for the Crest Emblem Media
* @returns A promise that resolves to an object representing details about a Crest Emblem Media.
*/
export async function guildCrestEmblem(emblemId: number): Promise<GuildCrestEmblem> {
return await request({
method: "GET",
url: `/data/wow/media/guild-crest/emblem/${emblemId}`,
namespace: "static",
});
}
106 changes: 106 additions & 0 deletions src/wow/heirloom.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
import { KeyId, KeyNameId, LinkSelfHref, LocalizedString, request } from "../shared/index.ts";

interface Heirlooms extends LinkSelfHref {
heirlooms: KeyNameId[];
}

interface TypeName {
type: string;
name: LocalizedString;
}

interface ValueDisplayString {
value: number;
display_string: LocalizedString;
}

interface UpgradeStats {
type: TypeName;
value: number;
display: {
display_string: LocalizedString;
color: {
r: number;
g: number;
b: number;
a: number;
};
};
}

interface Upgrade {
item: {
item: KeyId;
context: number;
bonus_list: number[];
quality: TypeName;
name: LocalizedString;
media: KeyId;
item_class: KeyNameId;
item_subclass: KeyNameId;
inventory_type: TypeName;
binding: TypeName;
weapon: {
damage: {
min_value: number;
max_value: number;
display_string: LocalizedString;
damage_class: TypeName;
};
attack_speed: ValueDisplayString;
dps: ValueDisplayString;
};
stats: UpgradeStats[];
upgrades: {
value: number;
max_value: number;
display_string: LocalizedString;
};
requirements: {
level: {
display_string: LocalizedString;
};
};
level: ValueDisplayString;
};
level: number;
}

interface Heirloom extends LinkSelfHref {
id: number;
item: KeyNameId;
source: {
type: string;
name: LocalizedString;
};
source_description: LocalizedString;
upgrades: Upgrade[];
media: KeyId;
}

/**
* Returns the Heirloom Index
*
* @returns A promise that resolves to an object representing a list of all Heirlooms.
*/
export async function heirlooms(): Promise<Heirlooms> {
return await request({
method: "GET",
url: "/data/wow/heirloom/index",
namespace: "static",
});
}

/**
* Returns a Heirloom
*
* @param heirloomId - The unique identifier for the Heirloom
* @returns A promise that resolves to an object representing details about a Heirloom.
*/
export async function heirloom(heirloomId: number): Promise<Heirloom> {
return await request({
method: "GET",
url: `/data/wow/heirloom/${heirloomId}`,
namespace: "static",
});
}
4 changes: 4 additions & 0 deletions src/wow/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,8 @@ export {
searchCreature,
} from "./creature.ts";

export { guildCrestBorder, guildCrestEmblem, guildCrests } from "./guild_crest.ts";

export { heirloom, heirlooms } from "./heirloom.ts";

export { token } from "./token.ts";

0 comments on commit 8fa272a

Please sign in to comment.