mirror of
				https://github.com/InsanusMokrassar/TelegramBotAPI.git
				synced 2025-10-31 12:10:11 +00:00 
			
		
		
		
	update version of microutils and add arm platform target
This commit is contained in:
		| @@ -13,7 +13,7 @@ ktor = "2.3.5" | |||||||
| ksp = "1.9.20-RC-1.0.13" | ksp = "1.9.20-RC-1.0.13" | ||||||
| kotlin-poet = "1.14.2" | kotlin-poet = "1.14.2" | ||||||
|  |  | ||||||
| microutils = "0.20.8" | microutils = "0.20.9" | ||||||
|  |  | ||||||
| github-release-plugin = "2.4.1" | github-release-plugin = "2.4.1" | ||||||
| dokka = "1.9.10" | dokka = "1.9.10" | ||||||
|   | |||||||
| @@ -15,6 +15,7 @@ kotlin { | |||||||
|     } |     } | ||||||
|     linuxX64() |     linuxX64() | ||||||
|     mingwX64() |     mingwX64() | ||||||
|  |     linuxArm64() | ||||||
|  |  | ||||||
|     sourceSets { |     sourceSets { | ||||||
|         commonMain { |         commonMain { | ||||||
|   | |||||||
| @@ -0,0 +1,6 @@ | |||||||
|  | package dev.inmo.tgbotapi.extensions.behaviour_builder | ||||||
|  |  | ||||||
|  | import kotlinx.coroutines.CoroutineScope | ||||||
|  | import kotlinx.coroutines.Dispatchers | ||||||
|  |  | ||||||
|  | actual var defaultCoroutineScopeProvider: () -> CoroutineScope = { CoroutineScope(Dispatchers.Default) } | ||||||
| @@ -55,6 +55,12 @@ kotlin { | |||||||
|             } |             } | ||||||
|         } |         } | ||||||
|  |  | ||||||
|  |         linuxArm64Main { | ||||||
|  |             dependencies { | ||||||
|  |                 api libs.ktor.client.cio | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|         mingwX64Main { |         mingwX64Main { | ||||||
|             dependencies { |             dependencies { | ||||||
|                 api libs.ktor.client.winhttp |                 api libs.ktor.client.winhttp | ||||||
|   | |||||||
							
								
								
									
										1
									
								
								tgbotapi.core/src/linuxArm64Main/kotlin/PackageInfo.kt
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										1
									
								
								tgbotapi.core/src/linuxArm64Main/kotlin/PackageInfo.kt
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1 @@ | |||||||
|  | package dev.inmo.tgbotapi | ||||||
| @@ -0,0 +1,5 @@ | |||||||
|  | package dev.inmo.tgbotapi.bot.ktor | ||||||
|  |  | ||||||
|  | import dev.inmo.tgbotapi.bot.ktor.base.MultipleClientKtorRequestsExecutor | ||||||
|  |  | ||||||
|  | actual typealias KtorRequestsExecutor = MultipleClientKtorRequestsExecutor | ||||||
| @@ -0,0 +1,22 @@ | |||||||
|  | package dev.inmo.tgbotapi.bot.ktor.base | ||||||
|  |  | ||||||
|  | import io.ktor.client.* | ||||||
|  | import io.ktor.client.engine.cio.* | ||||||
|  |  | ||||||
|  | /** | ||||||
|  |  * This function is used in default constructor of [MultipleClientKtorRequestsExecutor] and on all non-native | ||||||
|  |  * platforms and MingwX64 should return [client] | ||||||
|  |  * | ||||||
|  |  * On LinuxX64 it will create copy with Curl engine or throw an exception if engine is different with Curl | ||||||
|  |  * | ||||||
|  |  * @throws IllegalArgumentException When pass non Curl-based [HttpClient] on LinuxX64 | ||||||
|  |  */ | ||||||
|  | internal actual inline fun platformClientCopy(client: HttpClient): HttpClient = (client.engineConfig as? CIOEngineConfig) ?.let { | ||||||
|  |     lateinit var config: HttpClientConfig<out CIOEngineConfig> | ||||||
|  |     client.config { | ||||||
|  |         config = this as HttpClientConfig<out CIOEngineConfig> | ||||||
|  |     }.close() | ||||||
|  |     HttpClient(CIO) { | ||||||
|  |         this.plusAssign(config) | ||||||
|  |     } | ||||||
|  | } ?: throw IllegalArgumentException("On LinuxX64 TelegramBotAPI currently support only Curl Ktor HttpClient engine") | ||||||
| @@ -0,0 +1,9 @@ | |||||||
|  | package dev.inmo.tgbotapi.requests.abstracts | ||||||
|  |  | ||||||
|  | import dev.inmo.micro_utils.common.MPPFile | ||||||
|  | import dev.inmo.micro_utils.ktor.common.input | ||||||
|  | import dev.inmo.tgbotapi.requests.abstracts.MultipartFile | ||||||
|  |  | ||||||
|  | actual fun MPPFile.asMultipartFile(): MultipartFile = MultipartFile(this.name) { | ||||||
|  |     input() | ||||||
|  | } | ||||||
| @@ -0,0 +1,7 @@ | |||||||
|  | package dev.inmo.tgbotapi.utils | ||||||
|  |  | ||||||
|  | import io.ktor.utils.io.ByteReadChannel | ||||||
|  | import io.ktor.utils.io.core.Input | ||||||
|  | import io.ktor.utils.io.readRemaining | ||||||
|  |  | ||||||
|  | actual suspend fun ByteReadChannel.asInput(): Input = readRemaining() | ||||||
| @@ -0,0 +1,12 @@ | |||||||
|  | package dev.inmo.tgbotapi.utils | ||||||
|  |  | ||||||
|  | import kotlinx.serialization.Serializable | ||||||
|  |  | ||||||
|  | //actual typealias MimeType = MimeType | ||||||
|  |  | ||||||
|  | @OptIn(RiskFeature::class) | ||||||
|  | @Serializable(MimeTypeSerializer::class) | ||||||
|  | actual data class MimeType( | ||||||
|  |     actual val raw: String | ||||||
|  | ) | ||||||
|  | internal actual fun createMimeType(raw: String): MimeType = MimeType(raw) | ||||||
		Reference in New Issue
	
	Block a user