From f4c4162e4bc387a51a60b2a973d2a68f9e98b7c5 Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Mon, 26 Feb 2024 20:17:06 -0500 Subject: [PATCH] [+] Add game api in sdk --- AquaNet/src/libs/sdk.ts | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/AquaNet/src/libs/sdk.ts b/AquaNet/src/libs/sdk.ts index 29be4d1e..93d76a98 100644 --- a/AquaNet/src/libs/sdk.ts +++ b/AquaNet/src/libs/sdk.ts @@ -1,5 +1,6 @@ -import { AQUA_HOST } from "./config"; -import type { Card, CardSummary, UserMe } from "./generalTypes"; +import { AQUA_HOST, DATA_HOST } from "./config"; +import type { AllMusic, Card, CardSummary, GenericGameSummary, MusicMeta, TrendEntry, UserMe } from "./generalTypes"; +import type { GameName } from "./scoring"; interface RequestInitWithParams extends RequestInit { params?: { [index: string]: string } @@ -98,4 +99,16 @@ export const CARD = { post('/api/v2/card/link', props), unlink: (cardId: string) => post('/api/v2/card/unlink', { cardId }), +} + +export const GAME = { + trend: (username: string, game: GameName): Promise => + post(`/api/v2/game/${game}/trend`, { username }), + userSummary: (username: string, game: GameName): Promise => + post(`/api/v2/game/${game}/user-summary`, { username }), +} + +export const DATA = { + allMusic: (game: GameName): Promise => + fetch(`${DATA_HOST}/d/${game}/00/all-music.json`).then(it => it.json()) } \ No newline at end of file