mirror of
				https://github.com/InsanusMokrassar/TelegramBotAPI.git
				synced 2025-10-25 09:10:07 +00:00 
			
		
		
		
	update up to kotlin 1.9.20-Beta2
This commit is contained in:
		| @@ -1,6 +1,6 @@ | ||||
| [versions] | ||||
|  | ||||
| kotlin = "1.9.10" | ||||
| kotlin = "1.9.20-Beta2" | ||||
| kotlin-serialization = "1.6.0" | ||||
| kotlin-coroutines = "1.7.3" | ||||
|  | ||||
|   | ||||
| @@ -14,7 +14,18 @@ import kotlinx.serialization.json.Json | ||||
|  * * On JS, JVM and MingwX64 platforms it is [dev.inmo.tgbotapi.bot.ktor.base.DefaultKtorRequestsExecutor] | ||||
|  * * On LinuxX64 it is [dev.inmo.tgbotapi.bot.ktor.base.MultipleClientKtorRequestsExecutor] | ||||
|  */ | ||||
| expect class KtorRequestsExecutor ( | ||||
| expect class KtorRequestsExecutor internal constructor( | ||||
|     telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, | ||||
|     client: HttpClient, | ||||
|     callsFactories: List<KtorCallFactory>, | ||||
|     excludeDefaultFactories: Boolean, | ||||
|     requestsLimiter: RequestLimiter, | ||||
|     jsonFormatter: Json, | ||||
|     pipelineStepsHolder: KtorPipelineStepsHolder, | ||||
|     diff: Unit // just a diff property to know where constructor and where calling function with defaults | ||||
| ) : BaseRequestsExecutor | ||||
|  | ||||
| fun KtorRequestsExecutor( | ||||
|     telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, | ||||
|     client: HttpClient = HttpClient(), | ||||
|     callsFactories: List<KtorCallFactory> = emptyList(), | ||||
| @@ -22,4 +33,13 @@ expect class KtorRequestsExecutor ( | ||||
|     requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter, | ||||
|     jsonFormatter: Json = nonstrictJsonFormat, | ||||
|     pipelineStepsHolder: KtorPipelineStepsHolder = KtorPipelineStepsHolder | ||||
| ) : BaseRequestsExecutor | ||||
| ) = KtorRequestsExecutor( | ||||
|     telegramAPIUrlsKeeper = telegramAPIUrlsKeeper, | ||||
|     client = client, | ||||
|     callsFactories = callsFactories, | ||||
|     excludeDefaultFactories = excludeDefaultFactories, | ||||
|     requestsLimiter = requestsLimiter, | ||||
|     jsonFormatter = jsonFormatter, | ||||
|     pipelineStepsHolder = pipelineStepsHolder, | ||||
|     diff = kotlin.Unit | ||||
| ) | ||||
|   | ||||
| @@ -7,6 +7,7 @@ import dev.inmo.tgbotapi.bot.exceptions.CommonBotException | ||||
| import dev.inmo.tgbotapi.bot.exceptions.newRequestException | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorPipelineStepsHolder | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorRequestsExecutor | ||||
| import dev.inmo.tgbotapi.bot.ktor.createTelegramBotDefaultKtorCallRequestsFactories | ||||
| import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter | ||||
| import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter | ||||
| @@ -19,14 +20,15 @@ import io.ktor.client.plugins.* | ||||
| import io.ktor.client.statement.* | ||||
| import kotlinx.serialization.json.Json | ||||
|  | ||||
| class DefaultKtorRequestsExecutor( | ||||
| class DefaultKtorRequestsExecutor internal constructor( | ||||
|     telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, | ||||
|     client: HttpClient = HttpClient(), | ||||
|     callsFactories: List<KtorCallFactory> = emptyList(), | ||||
|     excludeDefaultFactories: Boolean = false, | ||||
|     private val requestsLimiter: RequestLimiter = ExceptionsOnlyLimiter, | ||||
|     private val jsonFormatter: Json = nonstrictJsonFormat, | ||||
|     private val pipelineStepsHolder: KtorPipelineStepsHolder = KtorPipelineStepsHolder | ||||
|     client: HttpClient, | ||||
|     callsFactories: List<KtorCallFactory>, | ||||
|     excludeDefaultFactories: Boolean, | ||||
|     private val requestsLimiter: RequestLimiter, | ||||
|     private val jsonFormatter: Json, | ||||
|     private val pipelineStepsHolder: KtorPipelineStepsHolder, | ||||
|     diff: Unit | ||||
| ) : BaseRequestsExecutor(telegramAPIUrlsKeeper) { | ||||
|     private val callsFactories: List<KtorCallFactory> = callsFactories.run { | ||||
|         if (!excludeDefaultFactories) { | ||||
|   | ||||
| @@ -4,9 +4,12 @@ import dev.inmo.micro_utils.coroutines.runCatchingSafely | ||||
| import dev.inmo.tgbotapi.bot.BaseRequestsExecutor | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorCallFactory | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorPipelineStepsHolder | ||||
| import dev.inmo.tgbotapi.bot.ktor.KtorRequestsExecutor | ||||
| import dev.inmo.tgbotapi.bot.settings.limiters.ExceptionsOnlyLimiter | ||||
| import dev.inmo.tgbotapi.bot.settings.limiters.RequestLimiter | ||||
| import dev.inmo.tgbotapi.requests.abstracts.Request | ||||
| import dev.inmo.tgbotapi.utils.TelegramAPIUrlsKeeper | ||||
| import dev.inmo.tgbotapi.utils.nonstrictJsonFormat | ||||
| import io.ktor.client.* | ||||
| import kotlinx.coroutines.flow.MutableStateFlow | ||||
| import kotlinx.coroutines.flow.first | ||||
| @@ -55,7 +58,8 @@ class MultipleClientKtorRequestsExecutor ( | ||||
|             excludeDefaultFactories, | ||||
|             requestsLimiter, | ||||
|             jsonFormatter, | ||||
|             pipelineStepsHolder | ||||
|             pipelineStepsHolder, | ||||
|             Unit | ||||
|         ) | ||||
|     }.toSet() | ||||
|     private val freeClients = MutableStateFlow<Set<DefaultKtorRequestsExecutor>>(requestExecutors) | ||||
| @@ -68,14 +72,15 @@ class MultipleClientKtorRequestsExecutor ( | ||||
|         } | ||||
|     } | ||||
|  | ||||
|     constructor( | ||||
|     internal constructor( | ||||
|         telegramAPIUrlsKeeper: TelegramAPIUrlsKeeper, | ||||
|         client: HttpClient, | ||||
|         callsFactories: List<KtorCallFactory>, | ||||
|         excludeDefaultFactories: Boolean, | ||||
|         requestsLimiter: RequestLimiter, | ||||
|         jsonFormatter: Json, | ||||
|         pipelineStepsHolder: KtorPipelineStepsHolder | ||||
|         pipelineStepsHolder: KtorPipelineStepsHolder, | ||||
|         diff: Unit | ||||
|     ) : this( | ||||
|         telegramAPIUrlsKeeper, | ||||
|         callsFactories, | ||||
|   | ||||
		Reference in New Issue
	
	Block a user