-
Notifications
You must be signed in to change notification settings - Fork 20
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
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎ 1 Ignored Deployment
|
@@ -0,0 +1,15 @@ | |||
{ | |||
"name": "@statsify/hypixel-api-client", |
There was a problem hiding this comment.
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 = { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
export type HypixelAPIConfig = { | |
export interface HypixelAPIConfig { |
return this.get("status", { uuid }); | ||
} | ||
|
||
public guild(params: { id?: string; player?: string; name?: string }) { |
There was a problem hiding this comment.
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 }
public guild(params: { id?: string; player?: string; name?: string }) { | |
public guild(params: GuildParams) { |
this.config = config; | ||
} | ||
|
||
public player(uuid: string): Promise<HypixelPlayer | undefined> { |
There was a problem hiding this comment.
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: { |
There was a problem hiding this comment.
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
37129e0
to
01c8702
Compare
Todo