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
|
## 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
|
## 0.6.1
|
||||||
|
|
||||||
* Versions updates:
|
* Versions updates:
|
||||||
|
@ -44,7 +44,7 @@ kotlin {
|
|||||||
implementation kotlin('stdlib')
|
implementation kotlin('stdlib')
|
||||||
|
|
||||||
api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlin_coroutines_version"
|
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 "com.soywiz.korlibs.klock:klock:$klock_version"
|
||||||
api "io.ktor:ktor-client-core:$ktor_version"
|
api "io.ktor:ktor-client-core:$ktor_version"
|
||||||
}
|
}
|
||||||
@ -55,18 +55,13 @@ kotlin {
|
|||||||
implementation kotlin('test-annotations-common')
|
implementation kotlin('test-annotations-common')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jvmMain {
|
|
||||||
dependencies {
|
|
||||||
implementation kotlin('stdlib')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
jvmTest {
|
jvmTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('test-junit')
|
implementation kotlin('test-junit')
|
||||||
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
implementation "io.ktor:ktor-client-okhttp:$ktor_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
jsMain {
|
jsTest {
|
||||||
dependencies {
|
dependencies {
|
||||||
implementation kotlin('test-js')
|
implementation kotlin('test-js')
|
||||||
}
|
}
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
kotlin.code.style=official
|
kotlin.code.style=official
|
||||||
kotlin_version=1.4.10
|
kotlin_version=1.4.20
|
||||||
kotlin_coroutines_version=1.3.9
|
kotlin_coroutines_version=1.4.2
|
||||||
kotlin_serialisation_runtime_version=1.0.0-RC2
|
kotlin_serialisation_version=1.0.1
|
||||||
klock_version=1.12.1
|
klock_version=2.0.0
|
||||||
ktor_version=1.4.1
|
ktor_version=1.4.1
|
||||||
|
|
||||||
gradle_github_release_plugin_version=2.2.12
|
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
|
import io.ktor.utils.io.errors.IOException
|
||||||
|
|
||||||
internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception {
|
internal suspend fun ClientRequestException.sauceNaoAPIException(): Exception {
|
||||||
val response = response ?: return this
|
return when (response.status) {
|
||||||
return when (response.status) {
|
TooManyRequests -> {
|
||||||
TooManyRequests -> {
|
val answerContent = response.readText()
|
||||||
val answerContent = response.readText()
|
when {
|
||||||
when {
|
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
||||||
answerContent.contains("daily limit") -> TooManyRequestsLongException(answerContent)
|
else -> TooManyRequestsShortException(answerContent)
|
||||||
else -> TooManyRequestsShortException(answerContent)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
else -> this
|
|
||||||
}
|
}
|
||||||
|
else -> this
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
sealed class TooManyRequestsException(message: String, cause: Throwable? = null) : IOException(message, cause) {
|
sealed class TooManyRequestsException(message: String, cause: Throwable? = null) : IOException(message, cause) {
|
||||||
abstract val answerContent: String
|
abstract val answerContent: String
|
||||||
|
@ -7,11 +7,8 @@ import kotlinx.serialization.builtins.serializer
|
|||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
||||||
|
|
||||||
|
|
||||||
@Serializer(String::class)
|
@Serializer(String::class)
|
||||||
object CommonMultivariantStringSerializer : KSerializer<String> by String.serializer() {
|
object CommonMultivariantStringSerializer : KSerializer<String> by String.serializer() {
|
||||||
private val stringArraySerializer = ListSerializer(String.serializer())
|
|
||||||
|
|
||||||
override fun deserialize(decoder: Decoder): String {
|
override fun deserialize(decoder: Decoder): String {
|
||||||
return when (val parsed = JsonElement.serializer().deserialize(decoder)) {
|
return when (val parsed = JsonElement.serializer().deserialize(decoder)) {
|
||||||
is JsonPrimitive -> parsed.content
|
is JsonPrimitive -> parsed.content
|
||||||
|
Loading…
Reference in New Issue
Block a user