@zikeji/hypixel
Advanced tools
Comparing version 1.9.1 to 1.10.0
@@ -6,2 +6,27 @@ # Changelog | ||
## [1.10.0](https://github.com/zikeji/node-hypixel/compare/v1.9.1...v1.10.0) (2020-10-20) | ||
### Features | ||
* **meta:** add new unenumerable meta field to results for meta information ([4357a7a](https://github.com/zikeji/node-hypixel/commit/4357a7a984de1fa7260a10946d283a4cac409ba9)) | ||
* **meta:** add ratelimit to meta ([3de2b7f](https://github.com/zikeji/node-hypixel/commit/3de2b7f61a9eb80e32184158e5f025f2d63cdb8e)) | ||
### Bug Fixes | ||
* **type:** resultarray returns appropriate array type ([d8ae79e](https://github.com/zikeji/node-hypixel/commit/d8ae79e69bb4dd1f214ab01952ec79da9ece1736)) | ||
### Tests | ||
* improve coverage, test new meta ([2933f04](https://github.com/zikeji/node-hypixel/commit/2933f04abf453712cf3db67b6e360ad311122bcd)) | ||
* **skyblock news:** add more assertions for news test ([791b02e](https://github.com/zikeji/node-hypixel/commit/791b02e6419c0c832b6c23e10005006b4e1ecdb7)) | ||
### Documentation | ||
* **guide:** begin fleshing out guide ([be6ac06](https://github.com/zikeji/node-hypixel/commit/be6ac064572a3c6554bebca9a24534fdd7bd167a)) | ||
* **vuepress:** extract additionalpages to new plugin and adjust changelog sidebar headers ([41728e6](https://github.com/zikeji/node-hypixel/commit/41728e602fa766ba38104e15ced260783ca1b4b3)) | ||
### [1.9.1](https://github.com/zikeji/node-hypixel/compare/v1.9.0...v1.9.1) (2020-10-19) | ||
@@ -8,0 +33,0 @@ |
@@ -10,2 +10,8 @@ /// <reference types="node" /> | ||
import type { Components, Paths } from "./types/api"; | ||
import { ResultObject } from "./util/ResultObject"; | ||
export interface RateLimitData { | ||
remaining: number; | ||
reset: number; | ||
limit: number; | ||
} | ||
interface Parameters { | ||
@@ -30,18 +36,10 @@ [parameter: string]: string; | ||
constructor(key: string, options?: ClientOptions); | ||
boosters(): Promise<boolean>; | ||
findGuild: FindGuild; | ||
friends(uuid: string): Promise<boolean>; | ||
gameCounts(): Promise<boolean>; | ||
guild: Guild; | ||
key(): Promise<boolean>; | ||
leaderboards(): Promise<boolean>; | ||
player(uuid: string): Promise<boolean>; | ||
playerCount(): Promise<boolean>; | ||
recentGames(uuid: string): Promise<boolean>; | ||
resources: Resources; | ||
skyblock: SkyBlock; | ||
status: Status; | ||
watchdogstats(): Promise<Paths.Watchdogstats.Get.Responses.$200>; | ||
watchdogstats(): Promise<ResultObject<Paths.Watchdogstats.Get.Responses.$200, "success">>; | ||
call<T extends Components.Schemas.ApiSuccess>(path: string, parameters?: Parameters): Promise<T>; | ||
} | ||
export default Client; |
@@ -24,3 +24,3 @@ "use strict"; | ||
const Queue_1 = require("./util/Queue"); | ||
const ReturnResponseObject_1 = require("./util/ReturnResponseObject"); | ||
const ResultObject_1 = require("./util/ResultObject"); | ||
class Client extends events_1.EventEmitter { | ||
@@ -42,3 +42,3 @@ constructor(key, options) { | ||
if (!key || typeof key !== "string") { | ||
throw new Error("Invalid API key"); | ||
throw new InvalidKeyError_1.InvalidKeyError("Invalid API key"); | ||
} | ||
@@ -51,45 +51,7 @@ this.apiKey = key; | ||
} | ||
boosters() { | ||
watchdogstats() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("boosters"), "success"); | ||
return ResultObject_1.getResultObject(yield this.call("watchdogstats"), "success"); | ||
}); | ||
} | ||
friends(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("friends", { uuid }), "success"); | ||
}); | ||
} | ||
gameCounts() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("gameCounts"), "success"); | ||
}); | ||
} | ||
key() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("key"), "success"); | ||
}); | ||
} | ||
leaderboards() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("leaderboards"), "success"); | ||
}); | ||
} | ||
player(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("player", { uuid }), "success"); | ||
}); | ||
} | ||
playerCount() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("playerCount"), "success"); | ||
}); | ||
} | ||
recentGames(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.call("recentGames", { uuid }), "success"); | ||
}); | ||
} | ||
watchdogstats() { | ||
return this.call("watchdogstats"); | ||
} | ||
call(path, parameters = {}) { | ||
@@ -123,2 +85,8 @@ return this.executeActionableCall(this.createActionableCall(path, parameters)); | ||
} | ||
if (typeof response === "object") { | ||
Object.defineProperty(response, "ratelimit", { | ||
enumerable: false, | ||
value: JSON.parse(JSON.stringify(this.rateLimit)), | ||
}); | ||
} | ||
return response; | ||
@@ -125,0 +93,0 @@ }); |
import { Method } from "../util/Method"; | ||
export declare class FindGuild extends Method { | ||
byName(name: string): Promise<boolean>; | ||
byUuid(uuid: string): Promise<boolean>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.FindGuild = void 0; | ||
const Method_1 = require("../util/Method"); | ||
const ReturnResponseObject_1 = require("../util/ReturnResponseObject"); | ||
class FindGuild extends Method_1.Method { | ||
byName(name) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("findGuild", { | ||
byName: name, | ||
}), "success"); | ||
}); | ||
} | ||
byUuid(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("findGuild", { | ||
byUuid: uuid, | ||
}), "success"); | ||
}); | ||
} | ||
} | ||
exports.FindGuild = FindGuild; | ||
//# sourceMappingURL=findGuild.js.map |
import { Method } from "../util/Method"; | ||
export declare class Guild extends Method { | ||
id(id: string): Promise<boolean>; | ||
player(player: string): Promise<boolean>; | ||
name(name: string): Promise<boolean>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Guild = void 0; | ||
const Method_1 = require("../util/Method"); | ||
const ReturnResponseObject_1 = require("../util/ReturnResponseObject"); | ||
class Guild extends Method_1.Method { | ||
id(id) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("guild", { id }), "success"); | ||
}); | ||
} | ||
player(player) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("guild", { | ||
player, | ||
}), "success"); | ||
}); | ||
} | ||
name(name) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("guild", { name }), "success"); | ||
}); | ||
} | ||
} | ||
exports.Guild = Guild; | ||
//# sourceMappingURL=guild.js.map |
import { Method } from "../../util/Method"; | ||
export declare class GuildsResources extends Method { | ||
achievements(): Promise<boolean>; | ||
permissions(): Promise<boolean>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.GuildsResources = void 0; | ||
const Method_1 = require("../../util/Method"); | ||
const ReturnResponseObject_1 = require("../../util/ReturnResponseObject"); | ||
class GuildsResources extends Method_1.Method { | ||
achievements() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/guilds/achievements"), "success"); | ||
}); | ||
} | ||
permissions() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/guilds/permissions"), "success"); | ||
}); | ||
} | ||
} | ||
exports.GuildsResources = GuildsResources; | ||
//# sourceMappingURL=guilds.js.map |
@@ -5,7 +5,4 @@ import { Method } from "../../util/Method"; | ||
export declare class Resources extends Method { | ||
achievements(): Promise<boolean>; | ||
challenges(): Promise<boolean>; | ||
guilds: GuildsResources; | ||
skyblock: SkyBlockResources; | ||
quests(): Promise<boolean>; | ||
} |
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.Resources = void 0; | ||
const Method_1 = require("../../util/Method"); | ||
const ReturnResponseObject_1 = require("../../util/ReturnResponseObject"); | ||
const guilds_1 = require("./guilds"); | ||
@@ -23,19 +13,4 @@ const skyblock_1 = require("./skyblock"); | ||
} | ||
achievements() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/achievements"), "success"); | ||
}); | ||
} | ||
challenges() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/challenges"), "success"); | ||
}); | ||
} | ||
quests() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/quests"), "success"); | ||
}); | ||
} | ||
} | ||
exports.Resources = Resources; | ||
//# sourceMappingURL=index.js.map |
@@ -1,6 +0,7 @@ | ||
import type { Components } from "../../types/api"; | ||
import type { Paths } from "../../types/api"; | ||
import { Method } from "../../util/Method"; | ||
import { ResultObject } from "../../util/ResultObject"; | ||
export declare class SkyBlockResources extends Method { | ||
collections(): Promise<Components.Schemas.SkyBlockResourcesParentCollections>; | ||
skills(): Promise<Components.Schemas.SkyBlockResourcesSkills>; | ||
collections(): Promise<ResultObject<Paths.ResourcesSkyblockCollections.Get.Responses.$200, "collections">>; | ||
skills(): Promise<ResultObject<Paths.ResourcesSkyblockSkills.Get.Responses.$200, "collections">>; | ||
} |
@@ -14,7 +14,7 @@ "use strict"; | ||
const Method_1 = require("../../util/Method"); | ||
const ReturnResponseObject_1 = require("../../util/ReturnResponseObject"); | ||
const ResultObject_1 = require("../../util/ResultObject"); | ||
class SkyBlockResources extends Method_1.Method { | ||
collections() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/skyblock/collections"), "collections"); | ||
return ResultObject_1.getResultObject(yield this.client.call("resources/skyblock/collections"), "collections"); | ||
}); | ||
@@ -24,3 +24,3 @@ } | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("resources/skyblock/skills"), "collections"); | ||
return ResultObject_1.getResultObject(yield this.client.call("resources/skyblock/skills"), "collections"); | ||
}); | ||
@@ -27,0 +27,0 @@ } |
@@ -1,11 +0,6 @@ | ||
import type { Components } from "../../types/api"; | ||
import type { Profile, ProfileWithCuteName } from "../../types/Profile"; | ||
import type { Paths } from "../../types/api"; | ||
import { Method } from "../../util/Method"; | ||
import { ResultArray } from "../../util/ResultArray"; | ||
export declare class SkyBlock extends Method { | ||
auction(): Promise<boolean>; | ||
auctions(): Promise<boolean>; | ||
bazaar(): Promise<boolean>; | ||
news(): Promise<Components.Schemas.NewsEntries>; | ||
profile(profile: string): Promise<Profile>; | ||
profiles(uuid: string): Promise<ProfileWithCuteName[]>; | ||
news(): Promise<ResultArray<Paths.SkyblockNews.Get.Responses.$200, "items">>; | ||
} |
@@ -14,38 +14,11 @@ "use strict"; | ||
const Method_1 = require("../../util/Method"); | ||
const ReturnResponseObject_1 = require("../../util/ReturnResponseObject"); | ||
const ResultArray_1 = require("../../util/ResultArray"); | ||
class SkyBlock extends Method_1.Method { | ||
auction() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/auction"), "success"); | ||
}); | ||
} | ||
auctions() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/auctions"), "success"); | ||
}); | ||
} | ||
bazaar() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/bazaar"), "success"); | ||
}); | ||
} | ||
news() { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/news"), "items"); | ||
return ResultArray_1.getResultArray(yield this.client.call("skyblock/news"), "items"); | ||
}); | ||
} | ||
profile(profile) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/profile", { | ||
profile, | ||
}), "profile"); | ||
}); | ||
} | ||
profiles(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("skyblock/profiles", { uuid }), "profiles"); | ||
}); | ||
} | ||
} | ||
exports.SkyBlock = SkyBlock; | ||
//# sourceMappingURL=index.js.map |
@@ -1,5 +0,6 @@ | ||
import type { Components } from "../types/api"; | ||
import type { Components, Paths } from "../types/api"; | ||
import { Method } from "../util/Method"; | ||
import { ResultObject } from "../util/ResultObject"; | ||
export declare class Status extends Method { | ||
uuid(uuid: Components.Parameters.PlayerUuid.Uuid): Promise<Components.Schemas.Session>; | ||
uuid(uuid: Components.Parameters.PlayerUuid.Uuid): Promise<ResultObject<Paths.Status.Get.Responses.$200, "session">>; | ||
} |
@@ -14,7 +14,7 @@ "use strict"; | ||
const Method_1 = require("../util/Method"); | ||
const ReturnResponseObject_1 = require("../util/ReturnResponseObject"); | ||
const ResultObject_1 = require("../util/ResultObject"); | ||
class Status extends Method_1.Method { | ||
uuid(uuid) { | ||
return __awaiter(this, void 0, void 0, function* () { | ||
return ReturnResponseObject_1.returnResponseObject(yield this.client.call("status", { | ||
return ResultObject_1.getResultObject(yield this.client.call("status", { | ||
uuid, | ||
@@ -21,0 +21,0 @@ }), "session"); |
{ | ||
"name": "@zikeji/hypixel", | ||
"version": "1.9.1", | ||
"version": "1.10.0", | ||
"description": "An unopinionated async/await API wrapper for Hypixel's Public API developed in TypeScript complete with documentation, OpenAPI 3.0 spec, intellisense, typed interfaces for all API responses, rate-limit handling, a few helpers, and support for undocumented endpoints.", | ||
@@ -215,2 +215,3 @@ "main": "dist/index.js", | ||
"@mdi/svg": "^5.7.55", | ||
"@mr-hope/vuepress-types": "^1.2.0", | ||
"@semantic-release/changelog": "^5.0.1", | ||
@@ -217,0 +218,0 @@ "@semantic-release/git": "^9.0.0", |
@@ -44,6 +44,6 @@ # @zikeji/hypixel | ||
console.log(status); | ||
// { "online": false } | ||
// {"online": false} | ||
const stats = await client.watchdogstats(); | ||
console.log(stats); | ||
// {success: true, watchdog_lastMinute: 1, staff_rollingDaily: 2609, watchdog_total: 5591714, watchdog_rollingDaily: 4213, …} | ||
// {watchdog_lastMinute: 1, staff_rollingDaily: 2609, watchdog_total: 5591714, watchdog_rollingDaily: 4213, …} | ||
})(); | ||
@@ -50,0 +50,0 @@ ``` |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59
115369
44
793