mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-12-23 05:07:12 +00:00
update versions
This commit is contained in:
parent
18cdf4ffbe
commit
4fcdb6f728
@ -2,6 +2,12 @@
|
||||
|
||||
## 0.6.2
|
||||
|
||||
* Versions updates:
|
||||
* `Kotlin`: `1.4.10` -> `1.4.20`
|
||||
* `Kotlin Serialisation`: `1.0.0-RC2` -> `1.0.1`
|
||||
* `Kotlin Coroutines`: `1.3.9` -> `1.4.2`
|
||||
* `Klock`: `1.12.1` -> `2.0.0`
|
||||
|
||||
## 0.6.1
|
||||
|
||||
* Versions updates:
|
||||
|
@ -44,7 +44,7 @@ kotlin {
|
||||
implementation kotlin('stdlib')
|
||||
|
||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_runtime_version"
|
||||
api "org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlin_serialisation_version"
|
||||
api "com.soywiz.korlibs.klock:klock:$klock_version"
|
||||
api "io.ktor:ktor-client-core:$ktor_version"
|
||||
}
|
||||
@ -55,18 +55,13 @@ kotlin {
|
||||
implementation kotlin('test-annotations-common')
|
||||
}
|
||||
}
|
||||
jvmMain {
|
||||
dependencies {
|
||||
implementation kotlin('stdlib')
|
||||
}
|
||||
}
|
||||
jvmTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-junit')
|
||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
||||
}
|
||||
}
|
||||
jsMain {
|
||||
jsTest {
|
||||
dependencies {
|
||||
implementation kotlin('test-js')
|
||||
}
|
||||
|
@ -1,8 +1,8 @@
|
||||
kotlin.code.style=official
|
||||
kotlin_version=1.4.10
|
||||
kotlin_coroutines_version=1.3.9
|
||||
kotlin_serialisation_runtime_version=1.0.0-RC2
|
||||
klock_version=1.12.1
|
||||
kotlin_version=1.4.20
|
||||
kotlin_coroutines_version=1.4.2
|
||||
kotlin_serialisation_version=1.0.1
|
||||
klock_version=2.0.0
|
||||
ktor_version=1.4.1
|
||||
|
||||
gradle_github_release_plugin_version=2.2.12
|
||||
|
@ -9,18 +9,17 @@ import io.ktor.http.HttpStatusCode.Companion.TooManyRequests
|
||||
import io.ktor.utils.io.errors.IOException
|
||||
|
||||
internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception {
|
||||
val response = response ?: return this
|
||||
return when (response.status) {
|
||||
TooManyRequests -> {
|
||||
val answerContent = response.readText()
|
||||
when {
|
||||
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
||||
else -> TooManyRequestsShortException(answerContent)
|
||||
}
|
||||
return when (response.status) {
|
||||
TooManyRequests -> {
|
||||
val answerContent = response.readText()
|
||||
when {
|
||||
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
||||
else -> TooManyRequestsShortException(answerContent)
|
||||
}
|
||||
else -> this
|
||||
}
|
||||
else -> this
|
||||
}
|
||||
}
|
||||
|
||||
sealed class TooManyRequestsException(message: String, cause: Throwable? = null) : IOException(message, cause) {
|
||||
abstract val answerContent: String
|
||||
|
@ -7,11 +7,8 @@ import kotlinx.serialization.builtins.serializer
|
||||
import kotlinx.serialization.encoding.Decoder
|
||||
import kotlinx.serialization.json.*
|
||||
|
||||
|
||||
@Serializer(String::class)
|
||||
object CommonMultivariantStringSerializer : KSerializer<String> by String.serializer() {
|
||||
private val stringArraySerializer = ListSerializer(String.serializer())
|
||||
|
||||
override fun deserialize(decoder: Decoder): String {
|
||||
return when (val parsed = JsonElement.serializer().deserialize(decoder)) {
|
||||
is JsonPrimitive -> parsed.content
|
||||
|
Loading…
Reference in New Issue
Block a user