Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix fetchActiveActions without param page #250

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 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
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<div align="center">

![banner](https://raw.githubusercontent.com/hypixelts/assets/main/svg/full-nobg5232x945.svg)

## Fixed version
## **An easy to use [Hypixel API](https://api.hypixel.net) wrapper.**

<p>
Expand Down
2 changes: 1 addition & 1 deletion src/lib/managers/SkyBlockManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export class SkyBlockManager extends BaseManager {
if (page && typeof page !== 'number')
throw new HypixelTSError('METHOD_INVALID_OPTIONS', 'SkyBlockManager', 'fetchActiveAuctions', 'page', ['number']);

const data = await this.makeGetRequest<FetchActiveAuctionsResponse>('/skyblock/auctions');
const data = await this.makeGetRequest<FetchActiveAuctionsResponse>(`/skyblock/auctions${page ? '?page=' + page : ''}`);

if (resolveAuctions) {
const parsed = [];
Expand Down
1 change: 1 addition & 0 deletions src/lib/typings/classes/APISkyBlockAuction.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ export interface APISkyBlockAuction {
category: string;
tier: string;
starting_bid: number;
bin: boolean;
item_bytes: { type: number; data: string };
claimed: boolean;
claimed_bidders: unknown[];
Expand Down
4 changes: 2 additions & 2 deletions src/lib/typings/managers/SkyBlockManager.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ export interface FetchItemsResponseItem {
*/
export interface FetchElectionAndMayorResponse extends BaseResourceResponse {
mayor: FetchElectionAndMayorResponseMayor;
current: FetchElectionAndMayorResponseCurrent;
current?: FetchElectionAndMayorResponseCurrent;
}

/**
Expand All @@ -78,7 +78,7 @@ export interface FetchElectionAndMayorResponseMayor {
name: string;
perks: FetchElectionAndMayorResponseMayorPerks[];
election: FetchElectionAndMayorResponseElection;
current: FetchElectionAndMayorResponseCurrent;
current?: FetchElectionAndMayorResponseCurrent;
}

/**
Expand Down
9 changes: 7 additions & 2 deletions src/tests/managers/SkyBlockManager.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,15 @@ test('SkyBlockManager.fetchItems returns items', async ({ client }) => {
expect(items).toBeTypeOf('object');
});

// test('SkyBlockManager.fetchElectionAndMayor returns election and mayor', async ({ client }) => {
// const { mayor, current } = await client.skyblock.fetchElectionAndMayor();
// expect(mayor).toBeTypeOf('object');
// expect(current).toBeTypeOf('object');
// });

test('SkyBlockManager.fetchElectionAndMayor returns election and mayor', async ({ client }) => {
const { mayor, current } = await client.skyblock.fetchElectionAndMayor();
const { mayor } = await client.skyblock.fetchElectionAndMayor();
expect(mayor).toBeTypeOf('object');
expect(current).toBeTypeOf('object');
});

test('SkyBlockManager.fetchActiveBingoGoals returns bingo goals', async ({ client }) => {
Expand Down
Loading