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

feat(hypixel-api): create hypixel api client #409

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from

Conversation

eatmyvenom
Copy link
Collaborator

Todo

  • Allow changing config per request.
  • Add more API response types.
  • Add validation to data prior to requesting.
  • Implement into statsify api hypixel service.

@eatmyvenom eatmyvenom added this to the v0.10.0 milestone Aug 28, 2022
@eatmyvenom eatmyvenom requested a review from jacobk999 August 28, 2022 07:55
@eatmyvenom eatmyvenom self-assigned this Aug 28, 2022
@vercel
Copy link

vercel bot commented Aug 28, 2022

The latest updates on your projects. Learn more about Vercel for Git ↗︎

1 Ignored Deployment
Name Status Preview Updated
statsify ⬜️ Ignored (Inspect) Dec 30, 2022 at 8:51PM (UTC)

@@ -0,0 +1,15 @@
{
"name": "@statsify/hypixel-api-client",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix the lock file

}
}

export type HypixelAPIConfig = {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
export type HypixelAPIConfig = {
export interface HypixelAPIConfig {

return this.get("status", { uuid });
}

public guild(params: { id?: string; player?: string; name?: string }) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Make a type called GuildParams

type GuildParams = { id: string } | { uuid: string } | { name: string }
Suggested change
public guild(params: { id?: string; player?: string; name?: string }) {
public guild(params: GuildParams) {

this.config = config;
}

public player(uuid: string): Promise<HypixelPlayer | undefined> {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about username support?

return response.data;
} catch (error: any) {
switch (error.code) {
case 429: {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This could also be player name searched too recently and it could lead to an endless loop

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants