@blizzard-api/d3 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +71 -0
- package/dist/index.cjs +223 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +642 -0
- package/dist/index.d.ts +642 -0
- package/dist/index.js +176 -0
- package/dist/index.js.map +1 -0
- package/package.json +51 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,176 @@
|
|
|
1
|
+
// src/base.ts
|
|
2
|
+
var base = "d3/data";
|
|
3
|
+
var profileBase = `d3/profile`;
|
|
4
|
+
var gameDataBase = `data/d3`;
|
|
5
|
+
|
|
6
|
+
// src/act/act.ts
|
|
7
|
+
function act(actId) {
|
|
8
|
+
return {
|
|
9
|
+
path: `${base}/act/${actId}`
|
|
10
|
+
};
|
|
11
|
+
}
|
|
12
|
+
function actIndex() {
|
|
13
|
+
return {
|
|
14
|
+
path: `${base}/act`
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
// src/artisan-and-recipe/artisan-and-recipe.ts
|
|
19
|
+
function artisan(artisanSlug) {
|
|
20
|
+
return {
|
|
21
|
+
path: `${base}/artisan/${artisanSlug}`
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
function recipe(artisanSlug, recipeSlug) {
|
|
25
|
+
return {
|
|
26
|
+
path: `${base}/artisan/${artisanSlug}/recipe/${recipeSlug}`
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
// src/character-class-and-skill/character-class-and-skill.ts
|
|
31
|
+
function characterClass(characterClassSlug) {
|
|
32
|
+
return {
|
|
33
|
+
path: `${base}/character-class/${characterClassSlug}`
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
function skill(characterClassSlug, skillSlug) {
|
|
37
|
+
return {
|
|
38
|
+
path: `${base}/hero/${characterClassSlug}/skill/${skillSlug}`
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
// src/follower/follower.ts
|
|
43
|
+
function follower(followerSlug) {
|
|
44
|
+
return {
|
|
45
|
+
path: `${base}/follower/${followerSlug}`
|
|
46
|
+
};
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// src/game-data/game-data.ts
|
|
50
|
+
function seasonIndex() {
|
|
51
|
+
return {
|
|
52
|
+
path: `${gameDataBase}/season`
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
function season(id) {
|
|
56
|
+
return {
|
|
57
|
+
path: `${gameDataBase}/season/${id}`
|
|
58
|
+
};
|
|
59
|
+
}
|
|
60
|
+
function seasonLeaderboard(id, leaderboard) {
|
|
61
|
+
return {
|
|
62
|
+
path: `${gameDataBase}/season/${id}/leaderboard/${leaderboard}`
|
|
63
|
+
};
|
|
64
|
+
}
|
|
65
|
+
function eraIndex() {
|
|
66
|
+
return {
|
|
67
|
+
path: `${gameDataBase}/era`
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
function era(id) {
|
|
71
|
+
return {
|
|
72
|
+
path: `${gameDataBase}/era/${id}`
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function eraLeaderboard(id, leaderboard) {
|
|
76
|
+
return {
|
|
77
|
+
path: `${gameDataBase}/era/${id}/leaderboard/${leaderboard}`
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
// src/item/item.ts
|
|
82
|
+
function item(itemSlugAndId) {
|
|
83
|
+
return {
|
|
84
|
+
path: `${base}/item/${itemSlugAndId}`
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// src/item-type/item-type.ts
|
|
89
|
+
function itemTypeIndex() {
|
|
90
|
+
return {
|
|
91
|
+
path: `${base}/item-type`
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
function itemType(itemTypeSlug) {
|
|
95
|
+
return {
|
|
96
|
+
path: `${base}/item-type/${itemTypeSlug}`
|
|
97
|
+
};
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
// src/profile/profile.ts
|
|
101
|
+
function account(battleTag) {
|
|
102
|
+
return {
|
|
103
|
+
path: `${profileBase}/${battleTag}`
|
|
104
|
+
};
|
|
105
|
+
}
|
|
106
|
+
function accountHero(battleTag, heroId) {
|
|
107
|
+
return {
|
|
108
|
+
path: `${profileBase}/${battleTag}/hero/${heroId}`
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
function accountHeroItems(battleTag, heroId) {
|
|
112
|
+
return {
|
|
113
|
+
path: `${profileBase}/${battleTag}/hero/${heroId}/items`
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
function accountHeroFollowerItems(battleTag, heroId) {
|
|
117
|
+
return {
|
|
118
|
+
path: `${profileBase}/${battleTag}/hero/${heroId}/follower-items`
|
|
119
|
+
};
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
// src/index.ts
|
|
123
|
+
var d3 = {
|
|
124
|
+
//Act
|
|
125
|
+
act,
|
|
126
|
+
actIndex,
|
|
127
|
+
//Artisan and Recipe
|
|
128
|
+
artisan,
|
|
129
|
+
recipe,
|
|
130
|
+
//Follower
|
|
131
|
+
follower,
|
|
132
|
+
//Character Class and Skill
|
|
133
|
+
characterClass,
|
|
134
|
+
skill,
|
|
135
|
+
//Item Type
|
|
136
|
+
itemType,
|
|
137
|
+
itemTypeIndex,
|
|
138
|
+
//Item
|
|
139
|
+
item,
|
|
140
|
+
//Profile
|
|
141
|
+
account,
|
|
142
|
+
accountHero,
|
|
143
|
+
accountHeroItems,
|
|
144
|
+
accountHeroFollowerItems,
|
|
145
|
+
//Game Data
|
|
146
|
+
seasonIndex,
|
|
147
|
+
season,
|
|
148
|
+
seasonLeaderboard,
|
|
149
|
+
eraIndex,
|
|
150
|
+
era,
|
|
151
|
+
eraLeaderboard
|
|
152
|
+
};
|
|
153
|
+
export {
|
|
154
|
+
account,
|
|
155
|
+
accountHero,
|
|
156
|
+
accountHeroFollowerItems,
|
|
157
|
+
accountHeroItems,
|
|
158
|
+
act,
|
|
159
|
+
actIndex,
|
|
160
|
+
artisan,
|
|
161
|
+
characterClass,
|
|
162
|
+
d3,
|
|
163
|
+
era,
|
|
164
|
+
eraIndex,
|
|
165
|
+
eraLeaderboard,
|
|
166
|
+
follower,
|
|
167
|
+
item,
|
|
168
|
+
itemType,
|
|
169
|
+
itemTypeIndex,
|
|
170
|
+
recipe,
|
|
171
|
+
season,
|
|
172
|
+
seasonIndex,
|
|
173
|
+
seasonLeaderboard,
|
|
174
|
+
skill
|
|
175
|
+
};
|
|
176
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/base.ts","../src/act/act.ts","../src/artisan-and-recipe/artisan-and-recipe.ts","../src/character-class-and-skill/character-class-and-skill.ts","../src/follower/follower.ts","../src/game-data/game-data.ts","../src/item/item.ts","../src/item-type/item-type.ts","../src/profile/profile.ts","../src/index.ts"],"sourcesContent":["export const base = 'd3/data';\r\n\r\nexport const profileBase = `d3/profile`;\r\n\r\n//Why is the game data APIs base root the reverse of the regular base?\r\nexport const gameDataBase = `data/d3`;\r\n\r\n/**\r\n * Base interface for Blizzard API responses.\r\n */\r\nexport interface ResponseBase {\r\n _links: {\r\n self: {\r\n href: string;\r\n };\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ActIndexResponse, ActResponse } from './types';\r\n\r\nexport function act(actId: number): Resource<ActResponse> {\r\n return {\r\n path: `${base}/act/${actId}`,\r\n };\r\n}\r\n\r\nexport function actIndex(): Resource<ActIndexResponse> {\r\n return {\r\n path: `${base}/act`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ArtisanResponse, RecipeResponse } from './types';\r\n\r\nexport function artisan(artisanSlug: string): Resource<ArtisanResponse> {\r\n return {\r\n path: `${base}/artisan/${artisanSlug}`,\r\n };\r\n}\r\n\r\nexport function recipe(artisanSlug: string, recipeSlug: string): Resource<RecipeResponse> {\r\n return {\r\n path: `${base}/artisan/${artisanSlug}/recipe/${recipeSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { CharacterClassResponse, SkillResponse } from './types';\r\n\r\nexport function characterClass(characterClassSlug: string): Resource<CharacterClassResponse> {\r\n return {\r\n path: `${base}/character-class/${characterClassSlug}`,\r\n };\r\n}\r\n\r\nexport function skill(characterClassSlug: string, skillSlug: string): Resource<SkillResponse> {\r\n return {\r\n path: `${base}/hero/${characterClassSlug}/skill/${skillSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { FollowerResponse } from './types';\r\n\r\nexport function follower(followerSlug: string): Resource<FollowerResponse> {\r\n return {\r\n path: `${base}/follower/${followerSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { gameDataBase } from '../base';\r\nimport type {\r\n EraIndexResponse,\r\n EraLeaderboardResponse,\r\n EraResponse,\r\n SeasonIndexResponse,\r\n SeasonLeaderboardResponse,\r\n SeasonResponse,\r\n} from './types';\r\n\r\nexport function seasonIndex(): Resource<SeasonIndexResponse> {\r\n return {\r\n path: `${gameDataBase}/season`,\r\n };\r\n}\r\n\r\nexport function season(id: number): Resource<SeasonResponse> {\r\n return {\r\n path: `${gameDataBase}/season/${id}`,\r\n };\r\n}\r\n\r\nexport function seasonLeaderboard(id: number, leaderboard: string): Resource<SeasonLeaderboardResponse> {\r\n return {\r\n path: `${gameDataBase}/season/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n\r\nexport function eraIndex(): Resource<EraIndexResponse> {\r\n return {\r\n path: `${gameDataBase}/era`,\r\n };\r\n}\r\n\r\nexport function era(id: number): Resource<EraResponse> {\r\n return {\r\n path: `${gameDataBase}/era/${id}`,\r\n };\r\n}\r\n\r\nexport function eraLeaderboard(id: number, leaderboard: string): Resource<EraLeaderboardResponse> {\r\n return {\r\n path: `${gameDataBase}/era/${id}/leaderboard/${leaderboard}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ItemResponse } from './types';\r\n\r\nexport function item(itemSlugAndId: string): Resource<ItemResponse> {\r\n return {\r\n path: `${base}/item/${itemSlugAndId}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { base } from '../base';\r\nimport type { ItemTypeIndexResponse, ItemTypeResponse } from './types';\r\n\r\nexport function itemTypeIndex(): Resource<Array<ItemTypeIndexResponse>> {\r\n return {\r\n path: `${base}/item-type`,\r\n };\r\n}\r\n\r\nexport function itemType(itemTypeSlug: string): Resource<Array<ItemTypeResponse>> {\r\n return {\r\n path: `${base}/item-type/${itemTypeSlug}`,\r\n };\r\n}\r\n","import type { Resource } from '@blizzard-api/core';\r\nimport { profileBase } from '../base';\r\nimport type { AccountHeroFollowerItemsResponse, AccountHeroResponse, AccountResponse } from './types';\r\n\r\nexport function account(battleTag: string): Resource<AccountResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}`,\r\n };\r\n}\r\n\r\nexport function accountHero(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}`,\r\n };\r\n}\r\n\r\nexport function accountHeroItems(battleTag: string, heroId: number): Resource<AccountHeroResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}/items`,\r\n };\r\n}\r\n\r\nexport function accountHeroFollowerItems(\r\n battleTag: string,\r\n heroId: number,\r\n): Resource<AccountHeroFollowerItemsResponse> {\r\n return {\r\n path: `${profileBase}/${battleTag}/hero/${heroId}/follower-items`,\r\n };\r\n}\r\n","import { act, actIndex } from './act/act';\r\nimport { artisan, recipe } from './artisan-and-recipe/artisan-and-recipe';\r\nimport { characterClass, skill } from './character-class-and-skill/character-class-and-skill';\r\nimport { follower } from './follower/follower';\r\nimport { era, eraIndex, eraLeaderboard, season, seasonIndex, seasonLeaderboard } from './game-data/game-data';\r\nimport { item } from './item/item';\r\nimport { itemType, itemTypeIndex } from './item-type/item-type';\r\nimport { account, accountHero, accountHeroFollowerItems, accountHeroItems } from './profile/profile';\r\n\r\nexport const d3 = {\r\n //Act\r\n act,\r\n actIndex,\r\n //Artisan and Recipe\r\n artisan,\r\n recipe,\r\n //Follower\r\n follower,\r\n //Character Class and Skill\r\n characterClass,\r\n skill,\r\n //Item Type\r\n itemType,\r\n itemTypeIndex,\r\n //Item\r\n item,\r\n //Profile\r\n account,\r\n accountHero,\r\n accountHeroItems,\r\n accountHeroFollowerItems,\r\n //Game Data\r\n seasonIndex,\r\n season,\r\n seasonLeaderboard,\r\n eraIndex,\r\n era,\r\n eraLeaderboard,\r\n};\r\n\r\n//Act\r\nexport * from './act/act';\r\nexport type * from './act/types';\r\n//Artisan and Recipe\r\nexport * from './artisan-and-recipe/artisan-and-recipe';\r\nexport type * from './artisan-and-recipe/types';\r\n//Follower\r\nexport * from './follower/follower';\r\nexport type * from './follower/types';\r\n//Character Class and Skill\r\nexport * from './character-class-and-skill/character-class-and-skill';\r\nexport type * from './character-class-and-skill/types';\r\n//Item Type\r\nexport * from './item-type/item-type';\r\nexport type * from './item-type/types';\r\n//Item\r\nexport * from './item/item';\r\nexport type * from './item/types';\r\n//Profile\r\nexport * from './profile/profile';\r\nexport type * from './profile/types';\r\n//Game Data\r\nexport * from './game-data/game-data';\r\nexport type * from './game-data/types';\r\n"],"mappings":";AAAO,IAAM,OAAO;AAEb,IAAM,cAAc;AAGpB,IAAM,eAAe;;;ACDrB,SAAS,IAAI,OAAsC;AACxD,SAAO;AAAA,IACL,MAAM,GAAG,IAAI,QAAQ,KAAK;AAAA,EAC5B;AACF;AAEO,SAAS,WAAuC;AACrD,SAAO;AAAA,IACL,MAAM,GAAG,IAAI;AAAA,EACf;AACF;;;ACVO,SAAS,QAAQ,aAAgD;AACtE,SAAO;AAAA,IACL,M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;AAAA,EACf;AACF;AAEO,SAAS,SAAS,cAAyD;AAChF,SAAO;AAAA,IACL,MAAM,GAAG,IAAI,cAAc,YAAY;AAAA,EACzC;AACF;;;ACVO,SAAS,QAAQ,WAA8C;AACpE,SAAO;AAAA,IACL,MAAM,GAAG,WAAW,IAAI,SAAS;AAAA,EACnC;AACF;AAEO,SAAS,YAAY,WAAmB,QAA+C;AAC5F,SAAO;AAAA,IACL,MAAM,GAAG,WAAW,IAAI,SAAS,SAAS,MAAM;AAAA,EAClD;AACF;AAEO,SAAS,iBAAiB,WAAmB,QAA+C;AACjG,SAAO;AAAA,IACL,MAAM,GAAG,WAAW,IAAI,SAAS,SAAS,MAAM;AAAA,EAClD;AACF;AAEO,SAAS,yBACd,WACA,QAC4C;AAC5C,SAAO;AAAA,IACL,MAAM,GAAG,WAAW,IAAI,SAAS,SAAS,MAAM;AAAA,EAClD;AACF;;;ACpBO,IAAM,KAAK;AAAA;AAAA,EAEhB;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA;AAAA,EAEA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;","names":[]}
|
package/package.json
ADDED
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@blizzard-api/d3",
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"license": "MIT",
|
|
5
|
+
"author": "Putro",
|
|
6
|
+
"description": "A series of helpers to interact with the Diablo 3 Blizzard API",
|
|
7
|
+
"repository": "https://github.com/Pewtro/blizzard/tree/main/packages/d3",
|
|
8
|
+
"type": "module",
|
|
9
|
+
"engines": {
|
|
10
|
+
"node": "^18.18 || ^20.9 || ^21.1 || ^22"
|
|
11
|
+
},
|
|
12
|
+
"main": "./dist/index.js",
|
|
13
|
+
"exports": {
|
|
14
|
+
"import": {
|
|
15
|
+
"types": "./dist/index.d.ts",
|
|
16
|
+
"default": "./dist/index.js"
|
|
17
|
+
},
|
|
18
|
+
"require": {
|
|
19
|
+
"types": "./dist/index.d.cts",
|
|
20
|
+
"default": "./dist/index.cjs"
|
|
21
|
+
}
|
|
22
|
+
},
|
|
23
|
+
"files": [
|
|
24
|
+
"dist"
|
|
25
|
+
],
|
|
26
|
+
"keywords": [
|
|
27
|
+
"blizzard",
|
|
28
|
+
"battlenet",
|
|
29
|
+
"battle.net",
|
|
30
|
+
"bnet",
|
|
31
|
+
"api",
|
|
32
|
+
"diablo",
|
|
33
|
+
"diablo",
|
|
34
|
+
"diablo 3",
|
|
35
|
+
"diablo III"
|
|
36
|
+
],
|
|
37
|
+
"dependencies": {},
|
|
38
|
+
"peerDependencies": {
|
|
39
|
+
"@blizzard-api/core": "1.1.0"
|
|
40
|
+
},
|
|
41
|
+
"devDependencies": {
|
|
42
|
+
"@blizzard-api/core": "1.1.0"
|
|
43
|
+
},
|
|
44
|
+
"scripts": {
|
|
45
|
+
"build": "tsup",
|
|
46
|
+
"dev": "tsup --watch",
|
|
47
|
+
"test": "vitest run",
|
|
48
|
+
"test:coverage": "pnpm test -- --coverage",
|
|
49
|
+
"test:watch": "vitest watch"
|
|
50
|
+
}
|
|
51
|
+
}
|