mirror of
https://github.com/revanced/revanced-api.git
synced 2025-04-29 22:24:31 +02:00
fix: Serialize response correctly
This commit is contained in:
parent
e373d26998
commit
1dccfd2def
@ -23,6 +23,8 @@ import app.revanced.api.backend.github.api.Response.GitHubOrganization.GitHubMem
|
||||
import io.ktor.client.plugins.resources.Resources
|
||||
import io.ktor.serialization.kotlinx.json.*
|
||||
import kotlinx.coroutines.*
|
||||
import kotlinx.datetime.TimeZone
|
||||
import kotlinx.datetime.toLocalDateTime
|
||||
import kotlinx.serialization.ExperimentalSerializationApi
|
||||
import kotlinx.serialization.json.Json
|
||||
import kotlinx.serialization.json.JsonNamingStrategy
|
||||
@ -71,11 +73,9 @@ class GitHubBackend(token: String? = null) : Backend({
|
||||
return BackendRelease(
|
||||
tag = release.tagName,
|
||||
releaseNote = release.body,
|
||||
createdAt = release.createdAt,
|
||||
createdAt = release.createdAt.toLocalDateTime(TimeZone.UTC),
|
||||
assets = release.assets.map {
|
||||
BackendAsset(
|
||||
downloadUrl = it.browserDownloadUrl
|
||||
)
|
||||
BackendAsset(downloadUrl = it.browserDownloadUrl)
|
||||
}.toSet()
|
||||
)
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package app.revanced.api.backend.github.api
|
||||
|
||||
import kotlinx.datetime.LocalDateTime
|
||||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.datetime.Instant
|
||||
import kotlinx.serialization.Serializable
|
||||
|
||||
|
||||
@ -41,7 +40,7 @@ class Response {
|
||||
class GitHubRelease(
|
||||
val tagName: String,
|
||||
val assets: Set<GitHubAsset>,
|
||||
val createdAt: LocalDateTime,
|
||||
val createdAt: Instant,
|
||||
val body: String
|
||||
) {
|
||||
@Serializable
|
||||
|
@ -12,8 +12,6 @@ import io.ktor.server.routing.*
|
||||
import io.ktor.util.pipeline.*
|
||||
import kotlinx.coroutines.async
|
||||
import kotlinx.coroutines.awaitAll
|
||||
import kotlinx.datetime.toKotlinLocalDateTime
|
||||
import java.time.LocalDateTime
|
||||
import org.koin.ktor.ext.get as koinGet
|
||||
|
||||
fun Application.configureRouting() {
|
||||
|
Loading…
x
Reference in New Issue
Block a user