diff --git a/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApi.kt b/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApi.kt index 6291213..0346bfb 100644 --- a/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApi.kt +++ b/nise-backend/src/main/kotlin/com/nisemoe/nise/osu/OsuApi.kt @@ -214,6 +214,20 @@ class OsuApi( } } + fun getUserBeatmapScores(userId: Long, beatmapId: Int): OsuApiModels.BeatmapScores? { + val response = doRequest("https://osu.ppy.sh/api/v2/beatmaps/$beatmapId/scores/users/$userId/all", mapOf()) + + if(response == null) { + this.logger.info("Error getting scores on beatmap $beatmapId for user $userId") + return null + } + + return when (response.statusCode()) { + 200 -> serializer.decodeFromString(response.body()) + else -> null + } + } + fun searchBeatmapsets(cursor: OsuApiModels.BeatmapsetSearchResultCursor?): OsuApiModels.BeatmapsetSearchResult? { val queryParams = mutableMapOf( "s" to "ranked", // Status [only ranked] @@ -294,7 +308,7 @@ class OsuApi( } } - fun getUserMostPlayed(userId: Int, limit: Int? = null, offset: Int? = null): List? { + fun getUserMostPlayed(userId: Long, limit: Int? = null, offset: Int? = null): List? { val queryParams = mapOf( "limit" to limit, "offset" to offset,