@zikeji/hypixel

npm Deno npm bundle size visit docs Visit our Discord server. Snyk Vulnerabilities for npm package version Libraries.io dependency status for latest release GitHub license GitHub last commit GitHub code size in bytes GitHub issues Coveralls GitHub Workflow Status

With thorough IntelliSense support & 100% test coverage, this is an unopinionated async/await API wrapper for Hypixel's Public API. It is developed in TypeScript complete with documentation, typed interfaces for all API responses (and an OpenAPI.yaml!), built-in rate-limit handling, flexible cache support, helper functions, and support for undocumented endpoints.

This library aims to replicate the API paths in it's method usage. As such, the general scheme would be to change the path of an API call by simply replacing the / with a ., and if the endpoint takes multiple parameters, those are added on the end. For example, api.hypixel.net/skyblock/profiles?uuid=1234 would simply become client.skyblock.profiles.uuid('1234'). Of course, with everything being fully typed if you are using an IDE that supports IntelliSense you should rarely need to reference documentation.

2.0 to 3.0 Migration

This library follows semver. As backwards incompatible changes were introduced while making this Deno compatible. Most likely nothing you use has changed, and you should be able to update without issue. The only breaking change is that the Client class no longer accepts agent as a parameter, as Deno does not support this.

Installation

NodeJS

Use npm to install this library.

npm i --save @zikeji/hypixel

Deno

As Deno does not require installation, you would simply follow their convention for imports.

import { Client as HypixelClient } from "https://deno.land/x/hypixel/v3.1.0/mod.ts";

Usage

const { Client } = require("@zikeji/hypixel");
const client = new Client("API_KEY");
(async () => {
  const status = await client.status.uuid("20934ef9488c465180a78f861586b4cf"); // Minikloon
  console.log(status);
  // {"online": false}
  const stats = await client.watchdogstats();
  console.log(stats);
  // {watchdog_lastMinute: 1, staff_rollingDaily: 2609, watchdog_total: 5591714, watchdog_rollingDaily: 4213, …}
})();

Helpers

This library adds multiple helpers to facilitate using the Hypixel API. You can find documentation on each helper here. If you would like to request a helper that doesn't exist, please open an issue. Otherwise if you would like to contribute one refer to the below section.

Contributing

If some API result isn't documented / typed out fully, please open an issue and I can see about adding it. However some data is too exhaustive to provide typings to in a reasonable manner, as exhibited here, where it isn't reasonable to add 19.5 thousand lines of code to document the entire dataset.

Otherwise, pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change. All changes must ensure they pass eslint, tests, and that testing is updated to meet or exceed the previous coverage.

Licenses

This projected is licensed under the MIT license. For additional details see LICENSE.

This library contains derivative work based on classes from the hypixel-php library. Code that is derivative work of hypixel-php will be marked as such with a header comment. See LICENSE-HYPIXEL-PHP.md for additional details on the original license.