mirror of
https://github.com/rebelonion/Dantotsu.git
synced 2026-01-25 15:41:03 +00:00
feat: sort comments in api
This commit is contained in:
@@ -31,12 +31,15 @@ object CommentsAPI {
|
||||
var isMod: Boolean = false
|
||||
var totalVotes: Int = 0
|
||||
|
||||
suspend fun getCommentsForId(id: Int, page: Int = 1, tag: Int?): CommentResponse? {
|
||||
suspend fun getCommentsForId(id: Int, page: Int = 1, tag: Int?, sort: String?): CommentResponse? {
|
||||
var url = "$address/comments/$id/$page"
|
||||
val request = requestBuilder()
|
||||
tag?.let {
|
||||
url += "?tag=$it"
|
||||
}
|
||||
sort?.let {
|
||||
url += if (tag != null) "&sort=$it" else "?sort=$it"
|
||||
}
|
||||
val json = try {
|
||||
request.get(url)
|
||||
} catch (e: IOException) {
|
||||
|
||||
Reference in New Issue
Block a user