@pinta365/blizzard_api 0.3.6 → 0.3.7
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 +1 -0
- package/esm/mod.d.ts +2 -1
- package/esm/mod.js +2 -1
- package/esm/src/shared/request.js +4 -1
- package/package.json +1 -1
- package/script/mod.d.ts +2 -1
- package/script/mod.js +3 -1
- package/script/src/shared/request.js +4 -1
package/README.md
CHANGED
|
@@ -22,6 +22,7 @@ to implement authorization code flow also.
|
|
|
22
22
|
| **World of Warcraft:** Profile APIs | ✅ | |
|
|
23
23
|
| | | |
|
|
24
24
|
| **World of Warcraft Classic:** Game Data APIs | | |
|
|
25
|
+
| **World of Warcraft Classic:** Profile APIs | | |
|
|
25
26
|
| | | |
|
|
26
27
|
| **Diablo III:** Community APIs | ✅ | Missing profile endpoints |
|
|
27
28
|
| **Diablo III:** Game Data APIs | ✅ | |
|
package/esm/mod.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import { authenticate, setup } from "./src/shared/index.js";
|
|
|
2
2
|
import * as wow from "./src/wow/index.js";
|
|
3
3
|
import * as hearthstone from "./src/hearthstone/index.js";
|
|
4
4
|
import * as sc2 from "./src/starcraft2/index.js";
|
|
5
|
-
|
|
5
|
+
import * as errors from "./src/shared/errors.js";
|
|
6
|
+
export { authenticate, errors, hearthstone, sc2, setup, wow };
|
package/esm/mod.js
CHANGED
|
@@ -2,4 +2,5 @@ import { authenticate, setup } from "./src/shared/index.js";
|
|
|
2
2
|
import * as wow from "./src/wow/index.js";
|
|
3
3
|
import * as hearthstone from "./src/hearthstone/index.js";
|
|
4
4
|
import * as sc2 from "./src/starcraft2/index.js";
|
|
5
|
-
|
|
5
|
+
import * as errors from "./src/shared/errors.js";
|
|
6
|
+
export { authenticate, errors, hearthstone, sc2, setup, wow };
|
|
@@ -39,5 +39,8 @@ export async function request(requestOptions) {
|
|
|
39
39
|
if (response.ok) {
|
|
40
40
|
return await response.json();
|
|
41
41
|
}
|
|
42
|
-
|
|
42
|
+
const errorData = await response.json();
|
|
43
|
+
const statusCode = errorData.code || response.status;
|
|
44
|
+
const errorMessage = JSON.stringify(errorData) || "Problem fetching data from API";
|
|
45
|
+
throw new APIError(errorMessage, statusCode, response.statusText);
|
|
43
46
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@pinta365/blizzard_api",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.7",
|
|
4
4
|
"description": "TS library to interact with the Blizzard Battle.net API. World of Warcraft, World of Warcraft Classic, StarCraft 2, Diablo 3, Hearthstone.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"blizzard",
|
package/script/mod.d.ts
CHANGED
|
@@ -2,4 +2,5 @@ import { authenticate, setup } from "./src/shared/index.js";
|
|
|
2
2
|
import * as wow from "./src/wow/index.js";
|
|
3
3
|
import * as hearthstone from "./src/hearthstone/index.js";
|
|
4
4
|
import * as sc2 from "./src/starcraft2/index.js";
|
|
5
|
-
|
|
5
|
+
import * as errors from "./src/shared/errors.js";
|
|
6
|
+
export { authenticate, errors, hearthstone, sc2, setup, wow };
|
package/script/mod.js
CHANGED
|
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.wow = exports.setup = exports.sc2 = exports.hearthstone = exports.authenticate = void 0;
|
|
26
|
+
exports.wow = exports.setup = exports.sc2 = exports.hearthstone = exports.errors = exports.authenticate = void 0;
|
|
27
27
|
const index_js_1 = require("./src/shared/index.js");
|
|
28
28
|
Object.defineProperty(exports, "authenticate", { enumerable: true, get: function () { return index_js_1.authenticate; } });
|
|
29
29
|
Object.defineProperty(exports, "setup", { enumerable: true, get: function () { return index_js_1.setup; } });
|
|
@@ -33,3 +33,5 @@ const hearthstone = __importStar(require("./src/hearthstone/index.js"));
|
|
|
33
33
|
exports.hearthstone = hearthstone;
|
|
34
34
|
const sc2 = __importStar(require("./src/starcraft2/index.js"));
|
|
35
35
|
exports.sc2 = sc2;
|
|
36
|
+
const errors = __importStar(require("./src/shared/errors.js"));
|
|
37
|
+
exports.errors = errors;
|
|
@@ -42,6 +42,9 @@ async function request(requestOptions) {
|
|
|
42
42
|
if (response.ok) {
|
|
43
43
|
return await response.json();
|
|
44
44
|
}
|
|
45
|
-
|
|
45
|
+
const errorData = await response.json();
|
|
46
|
+
const statusCode = errorData.code || response.status;
|
|
47
|
+
const errorMessage = JSON.stringify(errorData) || "Problem fetching data from API";
|
|
48
|
+
throw new errors_js_1.APIError(errorMessage, statusCode, response.statusText);
|
|
46
49
|
}
|
|
47
50
|
exports.request = request;
|