Sync sansei branch #1

Merged
Stedos merged 34 commits from sansei into main 2025-02-24 21:12:28 +00:00
2 changed files with 24 additions and 0 deletions
Showing only changes of commit e06b5f3c7c - Show all commits

View File

@ -294,6 +294,24 @@ class OsuApi(
} }
} }
fun getUserMostPlayed(userId: Int, limit: Int? = null, offset: Int? = null): List<OsuApiModels.BeatmapPlaycount>? {
val queryParams = mapOf(
"limit" to limit,
"offset" to offset,
)
val response = this.doRequest("https://osu.ppy.sh/api/v2/users/$userId/beatmapsets/most_played/?", queryParams)
if (response == null) {
this.logger.info("Error getting user most played ($userId)")
return null
}
return when (response.statusCode()) {
200 -> serializer.decodeFromString<List<OsuApiModels.BeatmapPlaycount>>(response.body())
else -> null
}
}
var rateLimitRemaining: Long = 0L var rateLimitRemaining: Long = 0L
var rateLimitTotal: Long = 0L var rateLimitTotal: Long = 0L

View File

@ -232,4 +232,10 @@ class OsuApiModels {
val content: String val content: String
) )
@Serializable
data class BeatmapPlaycount(
val beatmap_id: Int,
val count: Int,
)
} }