mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-12-23 05:07:12 +00:00
commit
8c8a02054d
57
CHANGELOG.md
57
CHANGELOG.md
@ -1,5 +1,22 @@
|
|||||||
# SauceNaoAPI Changelog
|
# SauceNaoAPI Changelog
|
||||||
|
|
||||||
|
## 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`
|
||||||
|
* `Ktor`: `1.4.1` -> `1.4.3`
|
||||||
|
|
||||||
|
## 0.6.1
|
||||||
|
|
||||||
|
* Versions updates:
|
||||||
|
* `Kotlin`: `1.4.0` -> `1.4.10`
|
||||||
|
* `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2`
|
||||||
|
* `Klock`: `1.12.0` -> `1.12.1`
|
||||||
|
* `Ktor`: `1.4.0` -> `1.4.1`
|
||||||
|
|
||||||
## 0.6.0
|
## 0.6.0
|
||||||
|
|
||||||
**MAIN PACKAGE WAS CHANGED: `com.github.insanusmokrassar` -> `com.insanusmokrassar`**
|
**MAIN PACKAGE WAS CHANGED: `com.github.insanusmokrassar` -> `com.insanusmokrassar`**
|
||||||
@ -12,31 +29,11 @@
|
|||||||
* `Klock`: `1.11.14` -> `1.12.0`
|
* `Klock`: `1.11.14` -> `1.12.0`
|
||||||
* `Ktor`: `1.3.2` -> `1.4.0`
|
* `Ktor`: `1.3.2` -> `1.4.0`
|
||||||
|
|
||||||
### 0.6.1
|
|
||||||
|
|
||||||
* Versions updates:
|
|
||||||
* `Kotlin`: `1.4.0` -> `1.4.10`
|
|
||||||
* `Kotlin Serialisation`: `1.0.0-RC` -> `1.0.0-RC2`
|
|
||||||
* `Klock`: `1.12.0` -> `1.12.1`
|
|
||||||
* `Ktor`: `1.4.0` -> `1.4.1`
|
|
||||||
|
|
||||||
## 0.5.0
|
## 0.5.0
|
||||||
|
|
||||||
* Versions updates
|
* Versions updates
|
||||||
|
|
||||||
## 0.4.0
|
## 0.4.4
|
||||||
|
|
||||||
* Update libraries versions
|
|
||||||
* Kotlin `1.3.31` -> `1.3.50`
|
|
||||||
* Coroutines `1.2.1` -> `1.3.2`
|
|
||||||
* Serialization `0.11.0` -> `0.13.0`
|
|
||||||
* Joda Time `2.10.1` -> `2.10.4`
|
|
||||||
* Ktor `1.1.4` -> `1.2.5`
|
|
||||||
* Now `SauceNaoAPI` is `Closeable`
|
|
||||||
* Now `SauceNaoAPI` working with synchronous queue
|
|
||||||
* `SauceNaoAPI` now will wait for some time when one of limits will be achieved
|
|
||||||
|
|
||||||
### 0.4.4
|
|
||||||
|
|
||||||
* Uploading of file
|
* Uploading of file
|
||||||
* Updates of versions
|
* Updates of versions
|
||||||
@ -44,15 +41,15 @@
|
|||||||
* `SauceNaoAPI` instances now can return `limitsState` object, which will contains `LimitsState` with currently known
|
* `SauceNaoAPI` instances now can return `limitsState` object, which will contains `LimitsState` with currently known
|
||||||
state of limits
|
state of limits
|
||||||
|
|
||||||
### 0.4.3
|
## 0.4.3
|
||||||
|
|
||||||
Hotfix for serializer of `SauceNaoAnswer`
|
Hotfix for serializer of `SauceNaoAnswer`
|
||||||
|
|
||||||
### 0.4.2
|
## 0.4.2
|
||||||
|
|
||||||
Hotfix for autostop for some time when there is no remaining quotas for requests
|
Hotfix for autostop for some time when there is no remaining quotas for requests
|
||||||
|
|
||||||
### 0.4.1 Managers experiments and row format in answer
|
## 0.4.1 Managers experiments and row format in answer
|
||||||
|
|
||||||
* Add `TimeManager` - it will manage work with requests times
|
* Add `TimeManager` - it will manage work with requests times
|
||||||
* Add `RequestQuotaMagager` - it will manage quota for requests and call suspend
|
* Add `RequestQuotaMagager` - it will manage quota for requests and call suspend
|
||||||
@ -61,6 +58,18 @@ if they will be over
|
|||||||
* Now `SauceNaoAnswer` have field `row` which contains `JsonObject` with
|
* Now `SauceNaoAnswer` have field `row` which contains `JsonObject` with
|
||||||
all original answer fields
|
all original answer fields
|
||||||
|
|
||||||
|
## 0.4.0
|
||||||
|
|
||||||
|
* Update libraries versions
|
||||||
|
* Kotlin `1.3.31` -> `1.3.50`
|
||||||
|
* Coroutines `1.2.1` -> `1.3.2`
|
||||||
|
* Serialization `0.11.0` -> `0.13.0`
|
||||||
|
* Joda Time `2.10.1` -> `2.10.4`
|
||||||
|
* Ktor `1.1.4` -> `1.2.5`
|
||||||
|
* Now `SauceNaoAPI` is `Closeable`
|
||||||
|
* Now `SauceNaoAPI` working with synchronous queue
|
||||||
|
* `SauceNaoAPI` now will wait for some time when one of limits will be achieved
|
||||||
|
|
||||||
## 0.3.0
|
## 0.3.0
|
||||||
|
|
||||||
* Now `results` field of `SauceNaoAnswer` is optional and is empty list by default
|
* Now `results` field of `SauceNaoAnswer` is optional and is empty list by default
|
||||||
|
10
build.gradle
10
build.gradle
@ -8,7 +8,6 @@ buildscript {
|
|||||||
dependencies {
|
dependencies {
|
||||||
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
classpath "org.jetbrains.kotlin:kotlin-serialization:$kotlin_version"
|
||||||
classpath "com.jfrog.bintray.gradle:gradle-bintray-plugin:$gradle_bintray_plugin_version"
|
|
||||||
classpath "com.github.breadmoirai:github-release:$gradle_github_release_plugin_version"
|
classpath "com.github.breadmoirai:github-release:$gradle_github_release_plugin_version"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -45,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"
|
||||||
}
|
}
|
||||||
@ -56,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,11 +1,10 @@
|
|||||||
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.3
|
||||||
|
|
||||||
gradle_github_release_plugin_version=2.2.12
|
gradle_github_release_plugin_version=2.2.12
|
||||||
gradle_bintray_plugin_version=1.8.5
|
|
||||||
|
|
||||||
library_version=0.6.1
|
library_version=0.6.2
|
||||||
|
2
gradle/wrapper/gradle-wrapper.properties
vendored
2
gradle/wrapper/gradle-wrapper.properties
vendored
@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
|
|||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip
|
||||||
|
@ -1,53 +0,0 @@
|
|||||||
apply plugin: 'maven-publish'
|
|
||||||
|
|
||||||
task javadocsJar(type: Jar) {
|
|
||||||
classifier = 'javadoc'
|
|
||||||
}
|
|
||||||
|
|
||||||
afterEvaluate {
|
|
||||||
project.publishing.publications.all {
|
|
||||||
// rename artifacts
|
|
||||||
groupId "${project.group}"
|
|
||||||
if (it.name.contains('kotlinMultiplatform')) {
|
|
||||||
artifactId = "${project.name}"
|
|
||||||
} else {
|
|
||||||
artifactId = "${project.name}-$name"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
publishing {
|
|
||||||
publications.all {
|
|
||||||
artifact javadocsJar
|
|
||||||
|
|
||||||
pom {
|
|
||||||
description = "SauceNao API library"
|
|
||||||
name = "SauceNao API"
|
|
||||||
url = "https://insanusmokrassar.github.io/${project.name}"
|
|
||||||
|
|
||||||
scm {
|
|
||||||
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git"
|
|
||||||
url = "https://github.com/insanusmokrassar/${project.name}.git"
|
|
||||||
}
|
|
||||||
|
|
||||||
developers {
|
|
||||||
|
|
||||||
developer {
|
|
||||||
id = "InsanusMokrassar"
|
|
||||||
name = "Ovsyannikov Alexey"
|
|
||||||
email = "ovsyannikov.alexey95@gmail.com"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
licenses {
|
|
||||||
|
|
||||||
license {
|
|
||||||
name = "Apache Software License 2.0"
|
|
||||||
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
@ -1 +1 @@
|
|||||||
{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}-mpp","packageVcs":"https://github.com/InsanusMokrassar/${project.name}","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}]},"type":"Multiplatform"}
|
{"bintrayConfig":{"repo":"InsanusMokrassar","packageName":"${project.name}-mpp","packageVcs":"https://github.com/InsanusMokrassar/${project.name}","autoPublish":true,"overridePublish":true},"licenses":[{"id":"Apache-2.0","title":"Apache Software License 2.0","url":"https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"}],"mavenConfig":{"name":"SauceNao API","description":"SauceNao API library","url":"https://insanusmokrassar.github.io/${project.name}","vcsUrl":"https://github.com/insanusmokrassar/${project.name}.git","developers":[{"id":"InsanusMokrassar","name":"Ovsyannikov Alexey","eMail":"ovsyannikov.alexey95@gmail.com"}]}}
|
112
publish.gradle
112
publish.gradle
@ -1,59 +1,69 @@
|
|||||||
apply plugin: 'com.jfrog.bintray'
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
apply from: "maven.publish.gradle"
|
task javadocsJar(type: Jar) {
|
||||||
|
classifier = 'javadoc'
|
||||||
bintray {
|
}
|
||||||
user = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
|
task sourceJar (type : Jar) {
|
||||||
key = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
|
classifier = 'sources'
|
||||||
filesSpec {
|
|
||||||
from "${buildDir}/publications/"
|
|
||||||
eachFile {
|
|
||||||
String directorySubname = it.getFile().parentFile.name
|
|
||||||
if (it.getName() == "module.json") {
|
|
||||||
if (directorySubname == "kotlinMultiplatform") {
|
|
||||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.module")
|
|
||||||
} else {
|
|
||||||
it.setPath("${project.name}-${directorySubname}/${project.version}/${project.name}-${directorySubname}-${project.version}.module")
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (directorySubname == "kotlinMultiplatform" && it.getName() == "pom-default.xml") {
|
|
||||||
it.setPath("${project.name}/${project.version}/${project.name}-${project.version}.pom")
|
|
||||||
} else {
|
|
||||||
it.exclude()
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
into "${project.group}".replace(".", "/")
|
|
||||||
}
|
|
||||||
|
|
||||||
publish = true
|
|
||||||
override = true
|
|
||||||
|
|
||||||
pkg {
|
|
||||||
repo = "InsanusMokrassar"
|
|
||||||
name = "${project.name}-mpp"
|
|
||||||
vcsUrl = "https://github.com/InsanusMokrassar/${project.name}"
|
|
||||||
licenses = ["Apache-2.0"]
|
|
||||||
version {
|
|
||||||
name = "${project.version}"
|
|
||||||
released = new Date()
|
|
||||||
vcsTag = "${project.version}"
|
|
||||||
gpg {
|
|
||||||
sign = true
|
|
||||||
passphrase = project.hasProperty('signing.gnupg.passphrase') ? project.property('signing.gnupg.passphrase') : System.getenv('signing.gnupg.passphrase')
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bintrayUpload.doFirst {
|
afterEvaluate {
|
||||||
publications = publishing.publications.collect {
|
project.publishing.publications.all {
|
||||||
|
// rename artifacts
|
||||||
|
groupId "${project.group}"
|
||||||
if (it.name.contains('kotlinMultiplatform')) {
|
if (it.name.contains('kotlinMultiplatform')) {
|
||||||
null
|
artifactId = "${project.name}"
|
||||||
|
artifact sourceJar
|
||||||
} else {
|
} else {
|
||||||
it.name
|
artifactId = "${project.name}-$name"
|
||||||
}
|
}
|
||||||
} - null
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bintrayUpload.dependsOn publishToMavenLocal
|
publishing {
|
||||||
|
publications.all {
|
||||||
|
artifact javadocsJar
|
||||||
|
|
||||||
|
pom {
|
||||||
|
description = "SauceNao API library"
|
||||||
|
name = "SauceNao API"
|
||||||
|
url = "https://insanusmokrassar.github.io/${project.name}"
|
||||||
|
|
||||||
|
scm {
|
||||||
|
developerConnection = "scm:git:[fetch=]https://github.com/insanusmokrassar/${project.name}.git[push=]https://github.com/insanusmokrassar/${project.name}.git"
|
||||||
|
url = "https://github.com/insanusmokrassar/${project.name}.git"
|
||||||
|
}
|
||||||
|
|
||||||
|
developers {
|
||||||
|
|
||||||
|
developer {
|
||||||
|
id = "InsanusMokrassar"
|
||||||
|
name = "Ovsyannikov Alexey"
|
||||||
|
email = "ovsyannikov.alexey95@gmail.com"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
licenses {
|
||||||
|
|
||||||
|
license {
|
||||||
|
name = "Apache Software License 2.0"
|
||||||
|
url = "https://github.com/InsanusMokrassar/TelegramBotAPI/blob/master/LICENSE"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
maven {
|
||||||
|
name = "bintray"
|
||||||
|
url = uri("https://api.bintray.com/maven/${project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')}/InsanusMokrassar/${project.name}-mpp/;publish=1;override=1")
|
||||||
|
credentials {
|
||||||
|
username = project.hasProperty('BINTRAY_USER') ? project.property('BINTRAY_USER') : System.getenv('BINTRAY_USER')
|
||||||
|
password = project.hasProperty('BINTRAY_KEY') ? project.property('BINTRAY_KEY') : System.getenv('BINTRAY_KEY')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
@ -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