UNPKG

poe-api-manager

Version:
39 lines (38 loc) 1.37 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.BaseModule = void 0; const getCategory_1 = __importDefault(require("../../func/getCategory")); const PoeWatch_1 = __importDefault(require("../../../../AbstractClass/PoeWatch")); /** * Subclass of PoeWatch for accessing base data. */ class BaseModule extends PoeWatch_1.default { /** * Creates a new instance of BaseModule. * @param league - The league from which the data will be fetched. */ constructor(league) { const type = "base"; super(league, type); } /** * Retrieves category data for base. * @async * @param categoryName - The name of the category to retrieve. * * Possible values: "armour", "weapons", "accessories". * @returns - A Promise containing data for the specified category. * @throws - Throws errors encountered while fetching data. */ async getCategory(categoryName) { try { return await (0, getCategory_1.default)(this.league, this.type, categoryName); } catch (error) { throw new Error(`Error fetching Accessory data: ${error.message}`); } } } exports.BaseModule = BaseModule;