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

Skyblock #45

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/API/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,18 +11,6 @@ import getPlayer from './getPlayer';
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 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';
import getWatchdogStats from './getWatchdogStats';
export default {
Expand All @@ -39,18 +27,6 @@ export default {
getPlayerHouses,
getQuests,
getRecentGames,
getSkyblockAuction,
getSkyblockAuctions,
getSkyblockAuctionsByPlayer,
getSkyblockBazaar,
getSkyblockBingo,
getSkyblockFireSales,
getSkyblockGarden,
getSkyblockGovernment,
getSkyblockMember,
getSkyblockMuseum,
getSkyblockNews,
getSkyblockProfiles,
getStatus,
getWatchdogStats
};
Original file line number Diff line number Diff line change
@@ -1,54 +1,42 @@
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../utils/SkyblockUtils';
import Bid from '../structures/SkyBlock/Auctions/Bid';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../../utils/SkyblockUtils';
import Bid from '../../structures/SkyBlock/Auctions/Bid';
import { expect, expectTypeOf, test } from 'vitest';
import ItemBytes from '../structures/ItemBytes';
import Client from '../Client';
import ItemBytes from '../../structures/ItemBytes';
import Client from '../../Client';

test('getSkyblockAuction (raw)', async () => {
test('Client#skyblock.Auction (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const auctions = await client.getSkyblockAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuction('player', auctions.auctions[0].auctioneerUuid, { raw: true });
const auctions = await client.skyblock.getAuctions(1);
const data = await client.skyblock.getAuction('player', auctions.auctions[0].auctioneerUuid, { raw: true });
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();

Check failure on line 13 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'object' does not satisfy the constraint 'never'.
client.destroy();
});

test('getSkyblockAuction (No Query)', () => {
test('Client#skyblock.Auction (No Query)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuction('player')).rejects.toThrowError(client.errors.NO_NICKNAME_UUID);
expect(() => client.skyblock.getAuction('player')).rejects.toThrowError(client.errors.NO_NICKNAME_UUID);
client.destroy();
});

test('getSkyblockAuction (Bad Filter)', () => {
test('Client#skyblock.Auction (Bad Filter)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuction('meow')).rejects.toThrowError(client.errors.BAD_AUCTION_FILTER);
expect(() => client.skyblock.getAuction('meow')).rejects.toThrowError(client.errors.BAD_AUCTION_FILTER);
client.destroy();
});

test('getSkyblockAuction (Auction)', async () => {
test('Client#skyblock.Auction (Auction)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const auctions = await client.getSkyblockAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuction('auction', auctions.auctions[0].auctioneerUuid);
const auctions = await client.skyblock.getAuctions(1);
const data = await client.skyblock.getAuction('auction', auctions.auctions[0].auctioneerUuid);
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();

Check failure on line 34 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'object' does not satisfy the constraint 'never'.

expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<Auction[]>();

Check failure on line 37 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'Auction[]' does not satisfy the constraint 'never'.
expect(data.length).greaterThanOrEqual(0);
expectTypeOf(data.length).toEqualTypeOf<number>();

Check failure on line 39 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'number' does not satisfy the constraint 'never'.
data.forEach((auction: Auction) => {
expect(auction).toBeDefined();
expect(auction).toBeInstanceOf(Auction);
Expand Down Expand Up @@ -120,21 +108,21 @@
client.destroy();
});

test('getSkyblockAuction (Player)', async () => {
test('Client#skyblock.Auction (Player)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error

Check failure on line 114 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Unused '@ts-expect-error' directive.
const auctions = await client.getSkyblockAuctions(1);
const auctions = await client.skyblock.getAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error

Check failure on line 117 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Unused '@ts-expect-error' directive.
const data = await client.getSkyblockAuction('player', auctions.auctions[0].auctioneerUuid);
const data = await client.skyblock.getAuction('player', auctions.auctions[0].auctioneerUuid);
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();

Check failure on line 120 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'object' does not satisfy the constraint 'never'.

expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<Auction[]>();

Check failure on line 123 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'Auction[]' does not satisfy the constraint 'never'.
expect(data.length).greaterThanOrEqual(0);
expectTypeOf(data.length).toEqualTypeOf<number>();

Check failure on line 125 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Type 'number' does not satisfy the constraint 'never'.
data.forEach((auction: Auction) => {
expect(auction).toBeDefined();
expect(auction).toBeInstanceOf(Auction);
Expand Down Expand Up @@ -206,14 +194,14 @@
client.destroy();
});

test('getSkyblockAuction (Profile)', async () => {
test('Client#skyblock.Auction (Profile)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error

Check failure on line 200 in src/API/skyblock/getAuction.test.ts

View workflow job for this annotation

GitHub Actions / build

Unused '@ts-expect-error' directive.
const auctions = await client.getSkyblockAuctions(1);
const auctions = await client.skyblock.getAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuction('profile', auctions.auctions[0].auctioneerProfile);
const data = await client.skyblock.getAuction('profile', auctions.auctions[0].auctioneerProfile);
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();

Expand Down
12 changes: 6 additions & 6 deletions src/API/getSkyblockAuction.ts → src/API/skyblock/getAuction.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from '../API';
import Endpoint from '../../Private/Endpoint';
import Client from '../../Client';

class getSkyblockAction extends Endpoint {
class getAuction extends Endpoint {
readonly client: Client;
constructor(client: Client) {
super(client);
Expand Down Expand Up @@ -33,4 +33,4 @@ class getSkyblockAction extends Endpoint {
}
}

export default getSkyblockAction;
export default getAuction;
Original file line number Diff line number Diff line change
@@ -1,58 +1,58 @@
import AuctionInfo from '../structures/SkyBlock/Auctions/AuctionInfo';
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../utils/SkyblockUtils';
import Bid from '../structures/SkyBlock/Auctions/Bid';
import AuctionInfo from '../../structures/SkyBlock/Auctions/AuctionInfo';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../../utils/SkyblockUtils';
import Bid from '../../structures/SkyBlock/Auctions/Bid';
import { expect, expectTypeOf, test } from 'vitest';
import ItemBytes from '../structures/ItemBytes';
import Client from '../Client';
import ItemBytes from '../../structures/ItemBytes';
import Client from '../../Client';

test('getSkyblockAuctions (raw)', async () => {
test('Client#skyblock.Auctions (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctions(1, { raw: true });
const data = await client.skyblock.getAuctions(1, { raw: true });
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();
client.destroy();
});

test('getSkyblockAuctions (No input)', () => {
test('Client#skyblock.Auctions (No input)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuctions()).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
expect(() => client.skyblock.getAuctions()).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
client.destroy();
});

test('getSkyblockAuctions (Negative Input)', () => {
test('Client#skyblock.Auctions (Negative Input)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuctions(-1)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
expect(() => client.skyblock.getAuctions(-1)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
client.destroy();
});

test('getSkyblockAuctions (Page 0)', () => {
test('Client#skyblock.Auctions (Page 0)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuctions(0)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
expect(() => client.skyblock.getAuctions(0)).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
client.destroy();
});

test('getSkyblockAuctions (String Input)', () => {
test('Client#skyblock.Auctions (String Input)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuctions('hi')).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
expect(() => client.skyblock.getAuctions('hi')).rejects.toThrowError(client.errors.INVALID_OPTION_VALUE);
client.destroy();
});

test('getSkyblockAuctions (One Page)', async () => {
test('Client#skyblock.Auctions (One Page)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctions(1);
const data = await client.skyblock.getAuctions(1);
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<{ info: AuctionInfo; auctions: Auction[] }>();
expect(data.info).toBeDefined();
Expand Down Expand Up @@ -147,11 +147,11 @@ test('getSkyblockAuctions (One Page)', async () => {
client.destroy();
});

test('getSkyblockAuctions (One Page Include Item Bytes)', async () => {
test('Client#skyblock.Auctions (One Page Include Item Bytes)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctions(1, { includeItemBytes: true });
const data = await client.skyblock.getAuctions(1, { includeItemBytes: true });
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<{ info: AuctionInfo; auctions: Auction[] }>();
expect(data.info).toBeDefined();
Expand Down Expand Up @@ -246,11 +246,11 @@ test('getSkyblockAuctions (One Page Include Item Bytes)', async () => {
client.destroy();
});

test('getSkyblockAuctions (All Pages)', async () => {
test('Client#skyblock.Auctions (All Pages)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctions('*');
const data = await client.skyblock.getAuctions('*');
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<{ info: AuctionInfo; auctions: Auction[] }>();
expect(data.info).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import AuctionInfo from '../structures/SkyBlock/Auctions/AuctionInfo';
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import AuctionInfo from '../../structures/SkyBlock/Auctions/AuctionInfo';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from '../API';
import Endpoint from '../../Private/Endpoint';
import Client from '../../Client';

class getSkyblockAuctions extends Endpoint {
class getAuctions extends Endpoint {
readonly client: Client;
declare options: AuctionRequestOptions;
constructor(client: Client) {
Expand Down Expand Up @@ -56,4 +56,4 @@ class getSkyblockAuctions extends Endpoint {
}
}

export default getSkyblockAuctions;
export default getAuctions;
Original file line number Diff line number Diff line change
@@ -1,39 +1,39 @@
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../utils/SkyblockUtils';
import Bid from '../structures/SkyBlock/Auctions/Bid';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { SkyblockRarity } from '../../utils/SkyblockUtils';
import Bid from '../../structures/SkyBlock/Auctions/Bid';
import { expect, expectTypeOf, test } from 'vitest';
import ItemBytes from '../structures/ItemBytes';
import Client from '../Client';
import ItemBytes from '../../structures/ItemBytes';
import Client from '../../Client';

test('getSkyblockAuctionsByPlayer (raw)', async () => {
test('Client#skyblock.AuctionsByPlayer (raw)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const auctions = await client.getSkyblockAuctions(1);
const auctions = await client.skyblock.getAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctionsByPlayer(auctions.auctions[0].auctioneerUuid, { raw: true });
const data = await client.skyblock.getAuctionsByPlayer(auctions.auctions[0].auctioneerUuid, { raw: true });
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<object>();
client.destroy();
});

test('getSkyblockAuctionsByPlayer (No Input)', () => {
test('Client#skyblock.AuctionsByPlayer (No Input)', () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
expect(() => client.getSkyblockAuctionsByPlayer()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID);
expect(() => client.skyblock.getAuctionsByPlayer()).rejects.toThrowError(client.errors.NO_NICKNAME_UUID);
client.destroy();
});

test('getSkyblockAuctionsByPlayer', async () => {
test('Client#skyblock.AuctionsByPlayer', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const auctions = await client.getSkyblockAuctions(1);
const auctions = await client.skyblock.getAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctionsByPlayer(auctions.auctions[0].auctioneerUuid);
const data = await client.skyblock.getAuctionsByPlayer(auctions.auctions[0].auctioneerUuid);
expect(data).toBeDefined();
expectTypeOf(data).toEqualTypeOf<Auction[]>();

Expand Down Expand Up @@ -136,14 +136,14 @@ test('getSkyblockAuctionsByPlayer', async () => {
client.destroy();
});

test('getSkyblockAuctionsByPlayer (Item Bytes)', async () => {
test('Client#skyblock.AuctionsByPlayer (Item Bytes)', async () => {
const client = new Client(process.env.HYPIXEL_KEY ?? '', { cache: false, checkForUpdates: false });
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const auctions = await client.getSkyblockAuctions(1);
const auctions = await client.skyblock.getAuctions(1);
// eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-expect-error
const data = await client.getSkyblockAuctionsByPlayer(auctions.auctions[0].auctioneerUuid, {
const data = await client.skyblock.getAuctionsByPlayer(auctions.auctions[0].auctioneerUuid, {
includeItemBytes: true
});
expect(data).toBeDefined();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import Auction from '../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from './API';
import Endpoint from '../Private/Endpoint';
import Client from '../Client';
import Auction from '../../structures/SkyBlock/Auctions/Auction';
import { AuctionRequestOptions } from '../API';
import Endpoint from '../../Private/Endpoint';
import Client from '../../Client';

class getSkyblockActionsByPlayer extends Endpoint {
class getAuctionsByPlayer extends Endpoint {
readonly client: Client;
constructor(client: Client) {
super(client);
Expand All @@ -19,4 +19,4 @@ class getSkyblockActionsByPlayer extends Endpoint {
}
}

export default getSkyblockActionsByPlayer;
export default getAuctionsByPlayer;
Loading
Loading