npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

weaselpromise.js

v1.0.0

Published

Javascript node.js promise based wrapper for the Warcraft Logs API.

Downloads

4

Readme

Weaselpromise.js

Weasel is a promise based wrapper for the Warcraft Logs API. The name Weasel comes from the sites abbreviation WCL that could be pronounced 'Weasel'... I guess. :)

Installing with NPM

npm install weaselpromise.js

Usage

const api = require('weaselpromise.js');

//Set the public WCL api-key that you get from https://www.warcraftlogs.com/accounts/changeuser
api.setApiKey('abc123abcd123');

//Optional parameters for the api call, not used this time.
let params = {};

//Very crudely prints the number of fights on the latest guild report.. :)
async function numberOfFights() {
    try {
        let reports         = await api.getReportsGuild('carpe cerevisi', 'moonglade', 'eu', params);
        let latestReport    = await api.getReportFights(reports[0].id, params);
        
        console.log('Number of fights:', latestReport.fights.length);
    }
    catch (err) {
        console.log('We caught an error: ' + err.message);
    }
}

numberOfFights();

Wrapper functions and details

getZones

/**
 * Gets a list of available zones used throughout the API. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Zones/zones_get| this} section of the API for full coverage of what is returned.
 *
 * @returns {Promise} Promise object
 * @public
 */

getClasses

/**
 * Gets a list of available classes used throughout the API. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Classes/classes_get| this} section of the API for full coverage of what is returned.
 *
 * @returns {Promise} Promise object
 * @public
 */

getRankingsEncounter

/**
 * Gets data concerning rankings of a specific encounter. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Rankings/rankings_encounter_encounterID_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {int} encounterID - an integer representing an encounter
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getRankingsCharacter

/**
 * Gets ranked fights for a specific character. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Rankings/rankings_character_characterName_serverName_serverRegion_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} characterName - the character name
 * @param {string} serverName - the server name
 * @param {string} serverRegion - the server region
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getParsesCharacter

/**
 * Gets parses for a specific character. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Parses/parses_character_characterName_serverName_serverRegion_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} characterName - the character name
 * @param {string} serverName - the server name
 * @param {string} serverRegion - the server region
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getReportsGuild

/**
 * Gets reports for a specific guild. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Reports/reports_guild_guildName_serverName_serverRegion_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} guildName - the guild name
 * @param {string} guildServer - the server name
 * @param {string} guildRegion - the guilds region
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getReportsUser

/**
 * Gets reports for a specific user. 
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Reports/reports_guild_guildName_serverName_serverRegion_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} userName - the username
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getReportFights

/**
 * Gets fights and the participants for a specific report.
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Report/report_fights_code_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} code - the report code
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getReportEvents

/**
 * Gets events such as damage, healing, cast, buff and debuff events for a specific report.
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Report/report_events_code_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} code - the report code
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */

getReportTables

/**
 * Gets a table of entries for a specific report. More risk of being changed than the other calls because it follows the changes on the table panes over at the site. Read the API docs.
 * Check out {@link https://www.warcraftlogs.com/v1/docs#!/Report/report_tables_view_code_get| this} section of the API for full coverage of what is returned and what parameters are available.
 *
 * @param {string} view - The type of data requested.
 * @param {string} code - the report code
 * @param {object} params - optional parameters
 * @returns {Promise} Promise object
 * @public
 */