Sync sansei branch #1
@ -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
|
||||||
|
|
||||||
|
|||||||
@ -232,4 +232,10 @@ class OsuApiModels {
|
|||||||
val content: String
|
val content: String
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BeatmapPlaycount(
|
||||||
|
val beatmap_id: Int,
|
||||||
|
val count: Int,
|
||||||
|
)
|
||||||
|
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user