UNPKG

poe-api-manager

Version:
39 lines (38 loc) 1.43 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.AccessoryModule = void 0; const PoeWatch_1 = __importDefault(require("../../../../AbstractClass/PoeWatch")); const getCategory_1 = __importDefault(require("../../func/getCategory")); /** * Subclass of PoeWatch for accessing accessory data. */ class AccessoryModule extends PoeWatch_1.default { /** * Creates a new instance of AccessoryModule. * @param {string} league - The league from which the data will be fetched. */ constructor(league) { const type = "accessory"; super(league, type); } /** * Retrieves category data for accessories. * @async * @param categoryName - The name of the category to retrieve. * * Possible values: "amulets", "rings", "belts", "quivers". * @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.AccessoryModule = AccessoryModule;