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

Commit

Permalink
Importing
Browse files Browse the repository at this point in the history
  • Loading branch information
Kathund committed Aug 14, 2024
1 parent 997e754 commit e3f7e79
Show file tree
Hide file tree
Showing 12 changed files with 96 additions and 55 deletions.
4 changes: 2 additions & 2 deletions src/API/API.d.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
import { RequestOptions } from '../Private/Requests';

export interface getPlayerRequestOptions extends RequestOptions {
export interface PlayerRequestOptions extends RequestOptions {
getGuild?: boolean;
}

export interface AuctionRequestOptions extends RequestOptions {
includeItemBytes?: boolean;
}

export interface SkyblockRequestyOptions extends RequestOptions {
export interface SkyblockRequestOptions extends RequestOptions {
garden?: boolean;
museum?: boolean;
}
4 changes: 2 additions & 2 deletions src/API/getPlayer.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { getPlayerRequestOptions } from './API';
import { PlayerRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Player from '../structures/Player';
import Client from '../Client';
Expand All @@ -10,7 +10,7 @@ export default class getPlayer extends Endpoint {
this.client = client;
}

async execute(query: string, options?: getPlayerRequestOptions): Promise<Player> {
async execute(query: string, options?: PlayerRequestOptions): Promise<Player> {
if (!query) throw new Error(this.client.errors.NO_NICKNAME_UUID);
query = await this.client.requests.toUUID(query);
const res = await this.client.requests.request(`/player?uuid=${query}`, options);
Expand Down
8 changes: 4 additions & 4 deletions src/API/getSkyblockAuctions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,10 @@ export default class getSkyblockAuctions extends Endpoint {
this.client = client;
}

async execute(range: any, options?: getSkyblockAuctionsOptions) {
async execute(
range: any,
options?: getSkyblockAuctionsOptions
): Promise<{ info: AuctionInfo | null; auctions: Auction[] }> {
options = this.parasOptions(options);
options.retries ||= 3;
options.cooldown ||= 100;
Expand All @@ -36,9 +39,6 @@ export default class getSkyblockAuctions extends Endpoint {
const result: any = { auctions: [] };
const fetches = [];
const failedPages = [];
if (options.noAuctions) {
return { info: options.noInfo ? null : (await this.getPage(range[1], { noAuctions: true })).info };
}
for (let i = range[0]; i <= range[1]; i++) {
if (options.race) {
fetches.push(this.noReject(this.getPage, [i, options], options.retries, options.cooldown));
Expand Down
24 changes: 0 additions & 24 deletions src/API/getSkyblockEndedAuctions.ts

This file was deleted.

6 changes: 4 additions & 2 deletions src/API/getSkyblockMember.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SkyblockMember from '../structures/SkyBlock/SkyblockMember';
import { SkyblockRequestyOptions } from './API';
import { SkyblockRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';

Expand All @@ -10,7 +10,7 @@ export default class getSkyblockMember extends Endpoint {
this.client = client;
}

async execute(query: string, options?: SkyblockRequestyOptions): Promise<Map<string, SkyblockMember>> {
async execute(query: string, options?: SkyblockRequestOptions): Promise<Map<string, SkyblockMember>> {
if (!query) throw new Error(this.client.errors.NO_NICKNAME_UUID);
query = await this.client.requests.toUUID(query);
const res = await this.client.requests.request(`/skyblock/profiles?uuid=${query}`, options);
Expand All @@ -23,6 +23,8 @@ export default class getSkyblockMember extends Endpoint {
new SkyblockMember({
uuid: query,
profileId: profile.profile_id,
garden: options?.garden ? await this.client.getSkyblockGarden(profile.profile_id) : null,

Check failure on line 26 in src/API/getSkyblockMember.ts

View workflow job for this annotation

GitHub Actions / build

Property 'getSkyblockGarden' does not exist on type 'Client'.
museum: options?.garden ? await this.client.getSkyblockMuseum(query, profile.profile_id) : null,

Check failure on line 27 in src/API/getSkyblockMember.ts

View workflow job for this annotation

GitHub Actions / build

Property 'getSkyblockMuseum' does not exist on type 'Client'.
profileName: profile.cute_name,
gameMode: profile.game_mode || null,
m: profile.members[query],
Expand Down
4 changes: 2 additions & 2 deletions src/API/getSkyblockProfiles.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import SkyblockProfile from '../structures/SkyBlock/SkyblockProfile';
import { SkyblockRequestyOptions } from './API';
import { SkyblockRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
export default class getSkyblockProfiles extends Endpoint {
Expand All @@ -9,7 +9,7 @@ export default class getSkyblockProfiles extends Endpoint {
this.client = client;
}

async execute(query: string, options?: SkyblockRequestyOptions): Promise<SkyblockProfile[]> {
async execute(query: string, options?: SkyblockRequestOptions): Promise<SkyblockProfile[]> {
if (!query) throw new Error(this.client.errors.NO_NICKNAME_UUID);
query = await this.client.requests.toUUID(query);
const res = await this.client.requests.request(`/skyblock/profiles?uuid=${query}`, options);
Expand Down
2 changes: 1 addition & 1 deletion src/API/getWatchdogStats.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import { RequestOptions } from '../Private/Requests';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';

export default class getWatchdogStatsEndpoint extends Endpoint {
export default class getWatchdogStats extends Endpoint {
readonly client: Client;
constructor(client: Client) {
super(client);
Expand Down
6 changes: 4 additions & 2 deletions src/API/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,16 @@ import getPlayerHouses from './getPlayerHouses';
import getQuests from './getQuests';
import getRecentGames from './getRecentGames';
import getSkyblockAuction from './getSkyblockAuction';
import getSkyblockAuctions from './getSkyblockAuctions';
import getSkyblockAuctionsByPlayer from './getSkyblockAuctionsByPlayer';
import getSkyblockBazaar from './getSkyblockBazaar';
import getSkyblockBingo from './getSkyblockBingo';
import getSkyblockBingoByPlayer from './getSkyblockBingoByPlayer';
import getSkyblockEndedAuctions from './getSkyblockEndedAuctions';
import getSkyblockFireSales from './getSkyblockFireSales';
import getSkyblockGarden from './getSkyblockGarden';
import getSkyblockGovernment from './getSkyblockGovernment';
import getSkyblockMember from './getSkyblockMember';
import getSkyblockMuseum from './getSkyblockMuseum';
import getSkyblockNews from './getSkyblockNews';
import getSkyblockProfiles from './getSkyblockProfiles';
import getStatus from './getStatus';
Expand All @@ -41,15 +42,16 @@ export default {
getQuests,
getRecentGames,
getSkyblockAuction,
getSkyblockAuctions,
getSkyblockAuctionsByPlayer,
getSkyblockBazaar,
getSkyblockBingo,
getSkyblockBingoByPlayer,
getSkyblockEndedAuctions,
getSkyblockFireSales,
getSkyblockGarden,
getSkyblockGovernment,
getSkyblockMember,
getSkyblockMuseum,
getSkyblockNews,
getSkyblockProfiles,
getStatus,
Expand Down
3 changes: 0 additions & 3 deletions src/Client.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@ import API from './API';
const clients: Client[] = [];

Check warning on line 8 in src/Client.ts

View workflow job for this annotation

GitHub Actions / check linting (eslint)

'Client' was used before it was defined

class Client {
getGuild(...args: any[]): Promise<any> | any {
throw new Error('Method not implemented.');
}
readonly key: string;

declare requests: Requests;
Expand Down
3 changes: 2 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,16 @@ export * from './API/getPlayerHouses';
export * from './API/getQuests';
export * from './API/getRecentGames';
export * from './API/getSkyblockAuction';
export * from './API/getSkyblockAuctions';
export * from './API/getSkyblockAuctionsByPlayer';
export * from './API/getSkyblockBazaar';
export * from './API/getSkyblockBingo';
export * from './API/getSkyblockBingoByPlayer';
export * from './API/getSkyblockEndedAuctions';
export * from './API/getSkyblockFireSales';
export * from './API/getSkyblockGarden';
export * from './API/getSkyblockGovernment';
export * from './API/getSkyblockMember';
export * from './API/getSkyblockMuseum';
export * from './API/getSkyblockNews';
export * from './API/getSkyblockProfiles';
export * from './API/getStatus';
Expand Down
6 changes: 6 additions & 0 deletions src/structures/SkyBlock/SkyblockMember.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import { getNetworth, NetworthResult } from 'skyhelper-networth';
import SkyblockInventoryItem from './SkyblockInventoryItem';
import Constants from '../../utils/Constants';
import SkyblockPet from './SkyblockPet';
import SkyblockGarden from './SkyblockGarden';
import SkyblockMuseum from './SkyblockMuseum';

export interface SkyblockMemberEquipment {
gauntlet: SkyblockInventoryItem | null;
Expand All @@ -45,6 +47,8 @@ class SkyblockMember {
uuid: string;
gameMode: string | null;
selected: boolean;
garden: SkyblockGarden | null;
museum: SkyblockMuseum | null;
profileName: string;
profileId: string;
firstJoinTimestamp: number;
Expand Down Expand Up @@ -79,6 +83,8 @@ class SkyblockMember {
this.uuid = data.uuid;
this.gameMode = data.gameMode;
this.selected = data.selected;
this.garden = data.garden;
this.museum = data.museum;
this.profileName = data.profileName;
this.profileId = data.profileId;
this.firstJoinTimestamp = data.m.profile?.first_join;
Expand Down
81 changes: 69 additions & 12 deletions src/typings/index.d.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,34 @@
import Requests, { RequestOptions } from '../Private/Requests';
import CacheHandler from '../Private/CacheHandler';
import Requests from '../Private/Requests';
import { ClientOptions } from '../Client';
import Updater from '../Private/Updater';
import Errors from '../Errors';
import Achievements from '../structures/Static/Achievements';
import House from '../structures/House';
import Booster from '../structures/Boosters/Booster';
import Challenges from '../structures/Static/Challenges';
import GameCounts from '../structures/GameCounts';
import Guild from '../structures/Guild/Guild';
import GuildAchievements from '../structures/Static/GuildAchievements';
import Player from '../structures/Player';
import Quests from '../structures/Static/Quests';
import RecentGame from '../structures/RecentGame';
import { AuctionRequestOptions, SkyblockRequestOptions } from '../API/API';
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { getSkyblockAuctionsOptions } from '../API/getSkyblockAuctions';
import AuctionInfo from '../structures/SkyBlock/Auctions/AuctionInfo';
import Product from '../structures/SkyBlock/Bazzar/Product';
import BingoData from '../structures/SkyBlock/Static/BingoData';
import PlayerBingo from '../structures/SkyBlock/PlayerBingo';
import FireSale from '../structures/SkyBlock/Static/FireSale';
import SkyblockGarden from '../structures/SkyBlock/SkyblockGarden';
import GovernmentData from '../structures/SkyBlock/Static/Government';
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 WatchdogStats from '../structures/Watchdog/Stats';

export type StaticGameNames =
| 'arcade'
Expand All @@ -27,24 +55,53 @@ export type StaticGameNames =
| 'battleground'
| 'woolgames';

declare module 'reborn-ts' {
const version: string;

declare module 'hypixel-api-reborn' {
class Client {
readonly key: string;

declare requests: Requests;
declare cacheHandler: CacheHandler;
declare updater: Updater;
declare errors: Errors;

declare cache: boolean;
declare cacheTime: number;
declare cacheMaxKeys: number;
declare cacheCheckPeriod: number;
declare rateLimit?: 'AUTO' | 'HARD' | 'NONE';
declare silent: boolean;
declare checkForUpdates: boolean;
declare endpoints: any;
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>;
getSkyblockBingoByPlayer(query: string, options?: RequestOptions): Promise<PlayerBingo>;
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>;
}
}

0 comments on commit e3f7e79

Please sign in to comment.