Skip to content
This repository has been archived by the owner on Dec 11, 2024. It is now read-only.

Commit

Permalink
Package Changes
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Sep 2, 2024
1 parent 0996286 commit d018fe3
Show file tree
Hide file tree
Showing 7 changed files with 124 additions and 105 deletions.
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
"name": "hypixel-api-reborn",
"version": "12.0.0",
"description": "Feature-rich Hypixel API wrapper for Node.js",
"main": "./src/index.ts",
"types": "./src/typings/index.d.ts",
"main": "dist/index.js",
"types": "dist/src/typings/index.d.ts",
"keywords": [
"minecraft",
"client",
Expand Down
3 changes: 1 addition & 2 deletions src/Client.test.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
import CacheHandler from './Private/CacheHandler';
import Client from './Client';
import Client, { ClientOptions } from './Client';
import Errors from './Errors';
import Requests from './Private/Requests';
import Updater from './Private/Updater';
import { ClientOptions } from './typings/Client';
import { expect, expectTypeOf, test } from 'vitest';
const errors = new Errors();

Expand Down
12 changes: 11 additions & 1 deletion src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,17 @@ import Errors from './Errors';
import RateLimit from './Private/RateLimit';
import Requests from './Private/Requests';
import Updater from './Private/Updater';
import { ClientOptions } from './typings/Client';

export interface ClientOptions {
cache?: boolean;
cacheTime?: number;
cacheMaxKeys?: number;
cacheCheckPeriod?: number;
rateLimit?: 'AUTO' | 'NONE';
silent?: boolean;
checkForUpdates?: boolean;
checkForUpdatesInterval?: number;
}

const clients: Client[] = [];

Check warning on line 19 in src/Client.ts

View workflow job for this annotation

GitHub Actions / check linting (eslint)

'Client' was used before it was defined

Expand Down
98 changes: 92 additions & 6 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,3 @@
export * from './Client';
export * from './Errors';
export * from './Private/CacheHandler';
export * from './Private/Updater';
export * from './Private/Endpoint';
export * from './Private/Requests';
export * from './API/getAchievements';
export * from './API/getActiveHouses';
export * from './API/getBoosters';
Expand Down Expand Up @@ -31,3 +25,95 @@ export * from './API/getSkyblockNews';
export * from './API/getSkyblockProfiles';
export * from './API/getStatus';
export * from './API/getWatchdogStats';

export * from './Private/CacheHandler';
export * from './Private/Endpoint';
export * from './Private/RateLimit';
export * from './Private/Requests';
export * from './Private/Updater';

export * from './structures/Boosters/Booster';
export * from './structures/Color';
export * from './structures/Game';
export * from './structures/GameCounts';
export * from './structures/Guild/Guild';
export * from './structures/Guild/GuildMember';
export * from './structures/Guild/GuildRank';
export * from './structures/House';
export * from './structures/ItemBytes';
export * from './structures/Leaderboard';
export * from './structures/MiniGames/Arcade';
export * from './structures/MiniGames/ArenaBrawl';
export * from './structures/MiniGames/BedWars';
export * from './structures/MiniGames/BlitzSurvivalGames';
export * from './structures/MiniGames/BuildBattle';
export * from './structures/MiniGames/CopsAndCrims';
export * from './structures/MiniGames/Duels';
export * from './structures/MiniGames/MegaWalls';
export * from './structures/MiniGames/MurderMystery';
export * from './structures/MiniGames/Paintball';
export * from './structures/MiniGames/Pit';
export * from './structures/MiniGames/PitInventoryItem';
export * from './structures/MiniGames/Quakecraft';
export * from './structures/MiniGames/SkyWars';
export * from './structures/MiniGames/SmashHeroes';
export * from './structures/MiniGames/SpeedUHC';
export * from './structures/MiniGames/TNTGames';
export * from './structures/MiniGames/TurboKartRacers';
export * from './structures/MiniGames/UHC';
export * from './structures/MiniGames/VampireZ';
export * from './structures/MiniGames/Walls';
export * from './structures/MiniGames/Warlords';
export * from './structures/MiniGames/WoolWars';
export * from './structures/Pet';
export * from './structures/Pets';
export * from './structures/Player';
export * from './structures/PlayerCosmetics';
export * from './structures/RecentGame';
export * from './structures/ServerInfo';
export * from './structures/SkyBlock/Auctions/Auction';
export * from './structures/SkyBlock/Auctions/AuctionInfo';
export * from './structures/SkyBlock/Auctions/BaseAuction';
export * from './structures/SkyBlock/Auctions/Bid';
export * from './structures/SkyBlock/Bazzar/Order';
export * from './structures/SkyBlock/Bazzar/Product';
export * from './structures/SkyBlock/News/SkyblockNews';
export * from './structures/SkyBlock/SkyblockGarden';
export * from './structures/SkyBlock/SkyblockInventoryItem';
export * from './structures/SkyBlock/SkyblockMember';
export * from './structures/SkyBlock/SkyblockMuseum';
export * from './structures/SkyBlock/SkyblockMuseumItem';
export * from './structures/SkyBlock/SkyblockPet';
export * from './structures/SkyBlock/SkyblockProfile';
export * from './structures/SkyBlock/Static/Bingo';
export * from './structures/SkyBlock/Static/BingoData';
export * from './structures/SkyBlock/Static/Candidate';
export * from './structures/SkyBlock/Static/FireSale';
export * from './structures/SkyBlock/Static/Government';
export * from './structures/SkyBlock/Static/Perk';
export * from './structures/Static/Achievement';
export * from './structures/Static/AchievementTier';
export * from './structures/Static/Achievements';
export * from './structures/Static/Challenges';
export * from './structures/Static/GameAchievements';
export * from './structures/Static/GameChallenges';
export * from './structures/Static/GameQuests';
export * from './structures/Static/GuildAchievements';
export * from './structures/Static/Quest';
export * from './structures/Static/Quests';
export * from './structures/Status';
export * from './structures/Watchdog/Stats';

export * from './utils/Constants';
export * from './utils/Guild';
export * from './utils/Player';
export * from './utils/SkyblockUtils';
export * from './utils/divide';
export * from './utils/isGuildID';
export * from './utils/isUUID';
export * from './utils/oscillation';
export * from './utils/removeSnakeCase';
export * from './utils/romanize';

export * from './Client';
export * from './Errors';
10 changes: 0 additions & 10 deletions src/typings/Client.d.ts

This file was deleted.

77 changes: 0 additions & 77 deletions src/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,34 +1,3 @@
import Achievements from '../structures/Static/Achievements';
import Auction from '../structures/SkyBlock/Auctions/Auction';
import AuctionInfo from '../structures/SkyBlock/Auctions/AuctionInfo';
import BingoData from '../structures/SkyBlock/Static/BingoData';
import Booster from '../structures/Boosters/Booster';
import CacheHandler from '../Private/CacheHandler';
import Challenges from '../structures/Static/Challenges';
import Errors from '../Errors';
import FireSale from '../structures/SkyBlock/Static/FireSale';
import GameCounts from '../structures/GameCounts';
import GovernmentData from '../structures/SkyBlock/Static/Government';
import Guild from '../structures/Guild/Guild';
import GuildAchievements from '../structures/Static/GuildAchievements';
import House from '../structures/House';
import Player from '../structures/Player';
import Product from '../structures/SkyBlock/Bazzar/Product';
import Quests from '../structures/Static/Quests';
import RecentGame from '../structures/RecentGame';
import Requests, { RequestOptions } from '../Private/Requests';
import SkyblockGarden from '../structures/SkyBlock/SkyblockGarden';
import SkyblockMember from '../structures/SkyBlock/SkyblockMember';
import SkyblockMuseum from '../structures/SkyBlock/SkyblockMuseum';
import SkyblockNews from '../structures/SkyBlock/News/SkyblockNews';
import SkyblockProfile from '../structures/SkyBlock/SkyblockProfile';
import Status from '../structures/Status';
import Updater from '../Private/Updater';
import WatchdogStats from '../structures/Watchdog/Stats';
import { AuctionRequestOptions, SkyblockRequestOptions } from '../API/API';
import { ClientOptions } from '../Client';
import { getSkyblockAuctionsOptions } from '../API/getSkyblockAuctions';

export type StaticGameNames =
| 'arcade'
| 'arena'
Expand All @@ -53,49 +22,3 @@ export type StaticGameNames =
| 'walls'
| 'battleground'
| 'woolgames';

declare module 'hypixel-api-reborn' {
class Client {
readonly key: string;
declare requests: Requests;
declare cacheHandler: CacheHandler;
declare updater: Updater;
declare errors: Errors;
declare options: ClientOptions;
constructor(key: string, options?: ClientOptions);
getAchievements(options?: RequestOptions): Promise<Achievements>;
getActiveHouses(options?: RequestOptions): Promise<House[]>;
getBoosters(options?: RequestOptions): Promise<Booster[]>;
getChallenges(options?: RequestOptions): Promise<Challenges>;
getGameCounts(options?: RequestOptions): Promise<GameCounts>;
getGuild(searchParameter: 'id' | 'name' | 'player', query: string, options?: RequestOptions): Promise<Guild | null>;
getGuildAchievements(options?: RequestOptions): Promise<GuildAchievements>;
getHouse(query: string, options?: RequestOptions): Promise<House>;
getLeaderboards(options?: RequestOptions): Promise<any>;
getPlayer(query: string, options?: PlayerRequestOptions): Promise<Player>;
getPlayerHouses(query: string, options?: RequestOptions): Promise<House[]>;
getQuests(options?: RequestOptions): Promise<Quests>;
getRecentGames(query: string, options?: RequestOptions): Promise<RecentGame[]>;
getSkyblockAuction(
query: string,
type: 'profile' | 'player' | 'auction',
options?: AuctionRequestOptions
): Promise<Auction[]>;
getSkyblockAuctions(
range: any,
options?: getSkyblockAuctionsOptions
): Promise<{ info: AuctionInfo | null; auctions: Auction[] }>;
getSkyblockAuctionsByPlayer(query: string, options?: AuctionRequestOptions): Promise<Auction[]>;
getSkyblockBazaar(options?: RequestOptions): Promise<Product[]>;
getSkyblockBingo(options?: RequestOptions): Promise<BingoData>;
getSkyblockFireSales(options?: RequestOptions): Promise<FireSale[]>;
getSkyblockGarden(profileId: string, options?: RequestOptions): Promise<SkyblockGarden>;
getSkyblockGovernment(options?: RequestOptions): Promise<GovernmentData>;
getSkyblockMember(query: string, options?: SkyblockRequestOptions): Promise<Map<string, SkyblockMember>>;
getSkyblockMuseum(query: string, profileId: string, options?: RequestOptions): Promise<SkyblockMuseum>;
getSkyblockNews(options?: RequestOptions): Promise<SkyblockNews[]>;
getSkyblockProfiles(query: string, options?: SkyblockRequestOptions): Promise<SkyblockProfile[]>;
getStatus(query: string, options?: RequestOptions): Promise<Status>;
getWatchdogStats(options?: RequestOptions): Promise<WatchdogStats>;
}
}
25 changes: 18 additions & 7 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,14 +1,25 @@
{
"compilerOptions": {
"esModuleInterop": true,
"allowJs": false,

"target": "ESNext",
"moduleDetection": "force",
"moduleResolution": "Node",
"module": "CommonJS",

"rootDir": "./src",
"outDir": "./dist",
"declaration": true,
"sourceMap": true,
"forceConsistentCasingInFileNames": true,
"moduleResolution": "node",
"resolveJsonModule": true,
"esModuleInterop": true,
"skipLibCheck": true,
"outDir": "./dist",
"module": "ES2022",
"target": "ES2022",
"strict": true

"strict": true,
"noImplicitAny": true,
"lib": ["ES2022"]
},
"include": ["src", "API"]
"include": ["src"],
"exclude": ["node_modules", "src/**/*.test.ts"]
}

0 comments on commit d018fe3

Please sign in to comment.