mirror of
https://github.com/InsanusMokrassar/SauceNaoAPI.git
synced 2024-12-23 13:17:11 +00:00
upmigration
This commit is contained in:
parent
7bc1e822fc
commit
f27c493771
@ -2,6 +2,14 @@
|
|||||||
|
|
||||||
## 0.7.0
|
## 0.7.0
|
||||||
|
|
||||||
|
**BREAKING CHANGES: PACKAGE HAS BEEN CHANGED FROM `com.insanusmokrassar` to `dev.inmo`**
|
||||||
|
|
||||||
|
Migration:
|
||||||
|
|
||||||
|
* Packages in the whole project were changed `com.insanusmokrassar.SauceNaoAPI` -> `dev.inmo.tgbotapi`
|
||||||
|
* Change implementation in your gradle files: `implementation "com.insanusmokrassar:SauceNaoAPI:*"` ->
|
||||||
|
`implementation "dev.inmo:saucenaoapi:*"`
|
||||||
|
|
||||||
## 0.6.2
|
## 0.6.2
|
||||||
|
|
||||||
* Versions updates:
|
* Versions updates:
|
||||||
|
@ -1 +1 @@
|
|||||||
rootProject.name = 'SauceNaoAPI'
|
rootProject.name = 'saucenaoapi'
|
||||||
|
@ -1,17 +0,0 @@
|
|||||||
package dev.inmo.SauceNaoAPI
|
|
||||||
|
|
||||||
sealed class OutputType {
|
|
||||||
abstract val typeCode: Int
|
|
||||||
}
|
|
||||||
|
|
||||||
object HtmlOutputType : dev.inmo.SauceNaoAPI.OutputType() {
|
|
||||||
override val typeCode: Int = 0
|
|
||||||
}
|
|
||||||
|
|
||||||
object XmlOutputType : dev.inmo.SauceNaoAPI.OutputType() {
|
|
||||||
override val typeCode: Int = 1
|
|
||||||
}
|
|
||||||
|
|
||||||
object JsonOutputType : dev.inmo.SauceNaoAPI.OutputType() {
|
|
||||||
override val typeCode: Int = 2
|
|
||||||
}
|
|
@ -1,9 +0,0 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.results
|
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.IndexInfo
|
|
||||||
|
|
||||||
data class ResultHeader(
|
|
||||||
val similarity: Float,
|
|
||||||
val thumbnail: String,
|
|
||||||
val index: IndexInfo
|
|
||||||
)
|
|
17
src/commonMain/kotlin/dev/inmo/saucenaoapi/OutputType.kt
Normal file
17
src/commonMain/kotlin/dev/inmo/saucenaoapi/OutputType.kt
Normal file
@ -0,0 +1,17 @@
|
|||||||
|
package dev.inmo.saucenaoapi
|
||||||
|
|
||||||
|
sealed class OutputType {
|
||||||
|
abstract val typeCode: Int
|
||||||
|
}
|
||||||
|
|
||||||
|
object HtmlOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||||
|
override val typeCode: Int = 0
|
||||||
|
}
|
||||||
|
|
||||||
|
object XmlOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||||
|
override val typeCode: Int = 1
|
||||||
|
}
|
||||||
|
|
||||||
|
object JsonOutputType : dev.inmo.saucenaoapi.OutputType() {
|
||||||
|
override val typeCode: Int = 2
|
||||||
|
}
|
@ -1,9 +1,9 @@
|
|||||||
package dev.inmo.SauceNaoAPI
|
package dev.inmo.saucenaoapi
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsException
|
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException
|
||||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.sauceNaoAPIException
|
import dev.inmo.saucenaoapi.exceptions.sauceNaoAPIException
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.*
|
import dev.inmo.saucenaoapi.models.*
|
||||||
import com.insanusmokrassar.SauceNaoAPI.utils.*
|
import dev.inmo.saucenaoapi.utils.*
|
||||||
import io.ktor.client.HttpClient
|
import io.ktor.client.HttpClient
|
||||||
import io.ktor.client.features.ClientRequestException
|
import io.ktor.client.features.ClientRequestException
|
||||||
import io.ktor.client.request.*
|
import io.ktor.client.request.*
|
||||||
@ -40,7 +40,7 @@ val defaultSauceNaoParser = Json {
|
|||||||
|
|
||||||
data class SauceNaoAPI(
|
data class SauceNaoAPI(
|
||||||
private val apiToken: String? = null,
|
private val apiToken: String? = null,
|
||||||
private val outputType: dev.inmo.SauceNaoAPI.OutputType = dev.inmo.SauceNaoAPI.JsonOutputType,
|
private val outputType: dev.inmo.saucenaoapi.OutputType = dev.inmo.saucenaoapi.JsonOutputType,
|
||||||
private val client: HttpClient = HttpClient(),
|
private val client: HttpClient = HttpClient(),
|
||||||
private val searchUrl: String = SEARCH_URL,
|
private val searchUrl: String = SEARCH_URL,
|
||||||
private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
private val scope: CoroutineScope = CoroutineScope(Dispatchers.Default),
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI
|
package dev.inmo.saucenaoapi
|
||||||
|
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.utils.io.core.Input
|
import io.ktor.utils.io.core.Input
|
@ -1,10 +1,10 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional
|
package dev.inmo.saucenaoapi.additional
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.ResultMetaInfo
|
import dev.inmo.saucenaoapi.additional.header.ResultMetaInfo
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.adapted
|
import dev.inmo.saucenaoapi.additional.header.adapted
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.results.AdaptedResult
|
import dev.inmo.saucenaoapi.additional.results.AdaptedResult
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.results.adapted
|
import dev.inmo.saucenaoapi.additional.results.adapted
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.SauceNaoAnswer
|
import dev.inmo.saucenaoapi.models.SauceNaoAnswer
|
||||||
|
|
||||||
val SauceNaoAnswer.adapted: AdaptedAnswer
|
val SauceNaoAnswer.adapted: AdaptedAnswer
|
||||||
get() = header.adapted.let { resultMetainfo ->
|
get() = header.adapted.let { resultMetainfo ->
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional
|
package dev.inmo.saucenaoapi.additional
|
||||||
|
|
||||||
import com.soywiz.klock.TimeSpan
|
import com.soywiz.klock.TimeSpan
|
||||||
|
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.header
|
package dev.inmo.saucenaoapi.additional.header
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.*
|
import dev.inmo.saucenaoapi.additional.*
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
|
|
||||||
val Header.shortLimitStatus: LimitStatus
|
val Header.shortLimitStatus: LimitStatus
|
||||||
get() = LimitStatus(
|
get() = LimitStatus(
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.header
|
package dev.inmo.saucenaoapi.additional.header
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
|
|
||||||
data class IndexInfo(
|
data class IndexInfo(
|
||||||
val id: Int,
|
val id: Int,
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.header
|
package dev.inmo.saucenaoapi.additional.header
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
|
|
||||||
val Header.queryPreview
|
val Header.queryPreview
|
||||||
get() = QueryResultPreview(
|
get() = QueryResultPreview(
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.header
|
package dev.inmo.saucenaoapi.additional.header
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
|
|
||||||
data class ResultMetaInfo(
|
data class ResultMetaInfo(
|
||||||
val accountInfo: AccountInfo = AccountInfo(),
|
val accountInfo: AccountInfo = AccountInfo(),
|
@ -1,9 +1,9 @@
|
|||||||
package dev.inmo.SauceNaoAPI.additional.results
|
package dev.inmo.saucenaoapi.additional.results
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.IndexInfo
|
import dev.inmo.saucenaoapi.additional.header.IndexInfo
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.header.ResultMetaInfo
|
import dev.inmo.saucenaoapi.additional.header.ResultMetaInfo
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Result
|
import dev.inmo.saucenaoapi.models.Result
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.ResultData
|
import dev.inmo.saucenaoapi.models.ResultData
|
||||||
|
|
||||||
fun Result.adapted(
|
fun Result.adapted(
|
||||||
resultMetaInfo: ResultMetaInfo
|
resultMetaInfo: ResultMetaInfo
|
@ -0,0 +1,9 @@
|
|||||||
|
package dev.inmo.saucenaoapi.additional.results
|
||||||
|
|
||||||
|
import dev.inmo.saucenaoapi.additional.header.IndexInfo
|
||||||
|
|
||||||
|
data class ResultHeader(
|
||||||
|
val similarity: Float,
|
||||||
|
val thumbnail: String,
|
||||||
|
val index: IndexInfo
|
||||||
|
)
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.SauceNaoAPI.exceptions
|
package dev.inmo.saucenaoapi.exceptions
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||||
import com.soywiz.klock.TimeSpan
|
import com.soywiz.klock.TimeSpan
|
||||||
import io.ktor.client.features.ClientRequestException
|
import io.ktor.client.features.ClientRequestException
|
||||||
import io.ktor.client.statement.readText
|
import io.ktor.client.statement.readText
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.defaultSauceNaoParser
|
import dev.inmo.saucenaoapi.defaultSauceNaoParser
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
import kotlinx.serialization.descriptors.SerialDescriptor
|
import kotlinx.serialization.descriptors.SerialDescriptor
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.utils.CommonMultivariantStringSerializer
|
import dev.inmo.saucenaoapi.utils.CommonMultivariantStringSerializer
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import kotlinx.serialization.SerialName
|
import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
@ -1,6 +1,6 @@
|
|||||||
package dev.inmo.SauceNaoAPI.models
|
package dev.inmo.saucenaoapi.models
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.defaultSauceNaoParser
|
import dev.inmo.saucenaoapi.defaultSauceNaoParser
|
||||||
import kotlinx.serialization.*
|
import kotlinx.serialization.*
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
import kotlinx.serialization.builtins.ListSerializer
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
@ -1,8 +1,7 @@
|
|||||||
package dev.inmo.SauceNaoAPI.utils
|
package dev.inmo.saucenaoapi.utils
|
||||||
|
|
||||||
import kotlinx.serialization.KSerializer
|
import kotlinx.serialization.KSerializer
|
||||||
import kotlinx.serialization.Serializer
|
import kotlinx.serialization.Serializer
|
||||||
import kotlinx.serialization.builtins.ListSerializer
|
|
||||||
import kotlinx.serialization.builtins.serializer
|
import kotlinx.serialization.builtins.serializer
|
||||||
import kotlinx.serialization.encoding.Decoder
|
import kotlinx.serialization.encoding.Decoder
|
||||||
import kotlinx.serialization.json.*
|
import kotlinx.serialization.json.*
|
@ -1,11 +1,11 @@
|
|||||||
package dev.inmo.SauceNaoAPI.utils
|
package dev.inmo.saucenaoapi.utils
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsException
|
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsException
|
||||||
import com.insanusmokrassar.SauceNaoAPI.exceptions.TooManyRequestsLongException
|
import dev.inmo.saucenaoapi.exceptions.TooManyRequestsLongException
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.LimitsState
|
import dev.inmo.saucenaoapi.models.LimitsState
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
@ -1,4 +1,4 @@
|
|||||||
package dev.inmo.SauceNaoAPI.utils
|
package dev.inmo.saucenaoapi.utils
|
||||||
|
|
||||||
import kotlinx.coroutines.supervisorScope
|
import kotlinx.coroutines.supervisorScope
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
package dev.inmo.SauceNaoAPI.utils
|
package dev.inmo.saucenaoapi.utils
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.models.Header
|
import dev.inmo.saucenaoapi.models.Header
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
|
|
||||||
internal suspend fun calculateSleepTime(
|
internal suspend fun calculateSleepTime(
|
@ -1,7 +1,7 @@
|
|||||||
package dev.inmo.SauceNaoAPI.utils
|
package dev.inmo.saucenaoapi.utils
|
||||||
|
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.LONG_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.LONG_TIME_RECALCULATING_MILLIS
|
||||||
import com.insanusmokrassar.SauceNaoAPI.additional.SHORT_TIME_RECALCULATING_MILLIS
|
import dev.inmo.saucenaoapi.additional.SHORT_TIME_RECALCULATING_MILLIS
|
||||||
import com.soywiz.klock.DateTime
|
import com.soywiz.klock.DateTime
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.channels.Channel
|
import kotlinx.coroutines.channels.Channel
|
@ -1,5 +1,5 @@
|
|||||||
import com.insanusmokrassar.SauceNaoAPI.SauceNaoAPI
|
import dev.inmo.saucenaoapi.SauceNaoAPI
|
||||||
import com.insanusmokrassar.SauceNaoAPI.utils.useSafe
|
import dev.inmo.saucenaoapi.utils.useSafe
|
||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.utils.io.streams.asInput
|
import io.ktor.utils.io.streams.asInput
|
||||||
import kotlinx.coroutines.*
|
import kotlinx.coroutines.*
|
||||||
|
Loading…
Reference in New Issue
Block a user