feat: add initial implementation for fetching avatar data from API
- Created a new sync.ts file to handle API requests. - Defined interfaces for AvatarApiResponse, Data, and Avatar. - Implemented a main function to fetch avatar data from the specified endpoint.
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
async function main() {
|
||||
const data: AvatarApiResponse = await fetch("https://gi.yatta.moe/api/v2/en/avatar").then(e => e.json());
|
||||
|
||||
}
|
||||
|
||||
main();
|
||||
|
||||
export interface AvatarApiResponse {
|
||||
response: number;
|
||||
data: Data;
|
||||
}
|
||||
|
||||
export interface Data {
|
||||
props: { [key: string]: string };
|
||||
types: { [key: string]: string };
|
||||
items: { [key: string]: Avatar };
|
||||
}
|
||||
|
||||
export interface Avatar {
|
||||
id: number | string;
|
||||
rank: number;
|
||||
name: string;
|
||||
element: string;
|
||||
weaponType: string;
|
||||
region: string;
|
||||
specialProp: string;
|
||||
bodyType: string;
|
||||
icon: string;
|
||||
birthday: number[];
|
||||
release: number;
|
||||
route: string;
|
||||
}
|
||||
Reference in New Issue
Block a user