From 71d7fcbe6505ddf2f6afad173cc8ea8cf3155f0b Mon Sep 17 00:00:00 2001 From: Azalea <22280294+hykilpikonna@users.noreply.github.com> Date: Thu, 14 Mar 2024 21:47:14 -0400 Subject: [PATCH] [+] Get user games endpoint --- src/main/java/icu/samnyan/aqua/net/CardController.kt | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/main/java/icu/samnyan/aqua/net/CardController.kt b/src/main/java/icu/samnyan/aqua/net/CardController.kt index 9022a12e..3afffef8 100644 --- a/src/main/java/icu/samnyan/aqua/net/CardController.kt +++ b/src/main/java/icu/samnyan/aqua/net/CardController.kt @@ -38,6 +38,10 @@ class CardController( ) } + @API("/user-games") + @Doc("Get the game summary of the user, including the user's name, rating, and last login date.", "Summary of the user") + suspend fun userGames(@RP username: Str) = us.cardByName(username) { card -> cardGameService.getSummary(card) } + /** * Bind a card to the user. This action will migrate selected data from the card to the user's ghost card. * @@ -100,7 +104,7 @@ class CardController( @API("/default-game") @Doc("Get the default game for the card.", "Game ID") suspend fun defaultGame(@RP username: Str) = us.cardByName(username) { card -> - cardGameService.getSummary(card).filterValues { it != null }.keys.firstOrNull() + mapOf("game" to cardGameService.getSummary(card).filterValues { it != null }.keys.firstOrNull()) } }