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.client.plugins.resources.Resources
|
||||||
import io.ktor.serialization.kotlinx.json.*
|
import io.ktor.serialization.kotlinx.json.*
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
import kotlinx.datetime.TimeZone
|
||||||
|
import kotlinx.datetime.toLocalDateTime
|
||||||
import kotlinx.serialization.ExperimentalSerializationApi
|
import kotlinx.serialization.ExperimentalSerializationApi
|
||||||
import kotlinx.serialization.json.Json
|
import kotlinx.serialization.json.Json
|
||||||
import kotlinx.serialization.json.JsonNamingStrategy
|
import kotlinx.serialization.json.JsonNamingStrategy
|
||||||
@ -71,11 +73,9 @@ class GitHubBackend(token: String? = null) : Backend({
|
|||||||
return BackendRelease(
|
return BackendRelease(
|
||||||
tag = release.tagName,
|
tag = release.tagName,
|
||||||
releaseNote = release.body,
|
releaseNote = release.body,
|
||||||
createdAt = release.createdAt,
|
createdAt = release.createdAt.toLocalDateTime(TimeZone.UTC),
|
||||||
assets = release.assets.map {
|
assets = release.assets.map {
|
||||||
BackendAsset(
|
BackendAsset(downloadUrl = it.browserDownloadUrl)
|
||||||
downloadUrl = it.browserDownloadUrl
|
|
||||||
)
|
|
||||||
}.toSet()
|
}.toSet()
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package app.revanced.api.backend.github.api
|
package app.revanced.api.backend.github.api
|
||||||
|
|
||||||
import kotlinx.datetime.LocalDateTime
|
import kotlinx.datetime.Instant
|
||||||
import kotlinx.serialization.SerialName
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
|
||||||
@ -41,7 +40,7 @@ class Response {
|
|||||||
class GitHubRelease(
|
class GitHubRelease(
|
||||||
val tagName: String,
|
val tagName: String,
|
||||||
val assets: Set<GitHubAsset>,
|
val assets: Set<GitHubAsset>,
|
||||||
val createdAt: LocalDateTime,
|
val createdAt: Instant,
|
||||||
val body: String
|
val body: String
|
||||||
) {
|
) {
|
||||||
@Serializable
|
@Serializable
|
||||||
|
@ -12,8 +12,6 @@ import io.ktor.server.routing.*
|
|||||||
import io.ktor.util.pipeline.*
|
import io.ktor.util.pipeline.*
|
||||||
import kotlinx.coroutines.async
|
import kotlinx.coroutines.async
|
||||||
import kotlinx.coroutines.awaitAll
|
import kotlinx.coroutines.awaitAll
|
||||||
import kotlinx.datetime.toKotlinLocalDateTime
|
|
||||||
import java.time.LocalDateTime
|
|
||||||
import org.koin.ktor.ext.get as koinGet
|
import org.koin.ktor.ext.get as koinGet
|
||||||
|
|
||||||
fun Application.configureRouting() {
|
fun Application.configureRouting() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user