mirror of
https://github.com/Suwayomi/Suwayomi-Server.git
synced 2026-06-30 17:34:39 -05:00
Use new format
This commit is contained in:
@@ -140,18 +140,20 @@ fun OkHttpClient.newCachelessCallWithProgress(
|
|||||||
return progressClient.newCall(request)
|
return progressClient.newCall(request)
|
||||||
}
|
}
|
||||||
|
|
||||||
context(Json)
|
context(_: Json)
|
||||||
inline fun <reified T> Response.parseAs(): T = decodeFromJsonResponse(serializer(), this)
|
inline fun <reified T> Response.parseAs(): T {
|
||||||
|
return decodeFromJsonResponse(serializer(), this)
|
||||||
|
}
|
||||||
|
|
||||||
@OptIn(ExperimentalSerializationApi::class)
|
context(json: Json)
|
||||||
context(Json)
|
|
||||||
fun <T> decodeFromJsonResponse(
|
fun <T> decodeFromJsonResponse(
|
||||||
deserializer: DeserializationStrategy<T>,
|
deserializer: DeserializationStrategy<T>,
|
||||||
response: Response,
|
response: Response,
|
||||||
): T =
|
): T {
|
||||||
response.body.source().use {
|
return response.body.source().use {
|
||||||
decodeFromBufferedSource(deserializer, it)
|
json.decodeFromBufferedSource(deserializer, it)
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
class HttpException(
|
class HttpException(
|
||||||
val code: Int,
|
val code: Int,
|
||||||
|
|||||||
Reference in New Issue
Block a user