Sync sansei branch #1
@ -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<OsuApiModels.BeatmapScores>(response.body())
|
||||||
|
else -> null
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fun searchBeatmapsets(cursor: OsuApiModels.BeatmapsetSearchResultCursor?): OsuApiModels.BeatmapsetSearchResult? {
|
fun searchBeatmapsets(cursor: OsuApiModels.BeatmapsetSearchResultCursor?): OsuApiModels.BeatmapsetSearchResult? {
|
||||||
val queryParams = mutableMapOf(
|
val queryParams = mutableMapOf(
|
||||||
"s" to "ranked", // Status [only ranked]
|
"s" to "ranked", // Status [only ranked]
|
||||||
@ -294,7 +308,7 @@ class OsuApi(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getUserMostPlayed(userId: Int, limit: Int? = null, offset: Int? = null): List<OsuApiModels.BeatmapPlaycount>? {
|
fun getUserMostPlayed(userId: Long, limit: Int? = null, offset: Int? = null): List<OsuApiModels.BeatmapPlaycount>? {
|
||||||
val queryParams = mapOf(
|
val queryParams = mapOf(
|
||||||
"limit" to limit,
|
"limit" to limit,
|
||||||
"offset" to offset,
|
"offset" to offset,
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user