mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2025-09-03 07:09:23 +00:00
base ktor request call factories became classes to avoid sharing of their cache between bots
This commit is contained in:
@@ -8,6 +8,8 @@
|
|||||||
* `Ktor`: `1.6.1` -> `1.6.2`
|
* `Ktor`: `1.6.1` -> `1.6.2`
|
||||||
* `MicroUtils`: `0.5.16` -> `0.5.18`
|
* `MicroUtils`: `0.5.16` -> `0.5.18`
|
||||||
* `Core`:
|
* `Core`:
|
||||||
|
* **`SimpleRequestCallFactory` and `MultipartRequestCallFactory` became a classes instead of objects to avoid
|
||||||
|
collisions in different bots**
|
||||||
* Support of strongly-typed ietf language codes has been added
|
* Support of strongly-typed ietf language codes has been added
|
||||||
* `API`:
|
* `API`:
|
||||||
* New extension `TelegramBot#downloadFile` for any `MediaContent`
|
* New extension `TelegramBot#downloadFile` for any `MediaContent`
|
||||||
|
@@ -52,7 +52,7 @@ class KtorRequestsExecutor(
|
|||||||
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
|
||||||
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
private val callsFactories: List<KtorCallFactory> = callsFactories.run {
|
||||||
if (!excludeDefaultFactories) {
|
if (!excludeDefaultFactories) {
|
||||||
this + listOf(SimpleRequestCallFactory, MultipartRequestCallFactory, DownloadFileRequestCallFactory)
|
this + listOf(SimpleRequestCallFactory(), MultipartRequestCallFactory(), DownloadFileRequestCallFactory)
|
||||||
} else {
|
} else {
|
||||||
this
|
this
|
||||||
}
|
}
|
||||||
|
@@ -9,7 +9,7 @@ import io.ktor.client.request.forms.formData
|
|||||||
import io.ktor.http.Headers
|
import io.ktor.http.Headers
|
||||||
import io.ktor.http.HttpHeaders
|
import io.ktor.http.HttpHeaders
|
||||||
|
|
||||||
object MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
class MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
@@ -35,4 +35,4 @@ object MultipartRequestCallFactory : AbstractRequestCallFactory() {
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -6,7 +6,7 @@ import io.ktor.client.HttpClient
|
|||||||
import io.ktor.http.ContentType
|
import io.ktor.http.ContentType
|
||||||
import io.ktor.http.content.TextContent
|
import io.ktor.http.content.TextContent
|
||||||
|
|
||||||
object SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
class SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
||||||
override fun <T : Any> prepareCallBody(
|
override fun <T : Any> prepareCallBody(
|
||||||
client: HttpClient,
|
client: HttpClient,
|
||||||
urlsKeeper: TelegramAPIUrlsKeeper,
|
urlsKeeper: TelegramAPIUrlsKeeper,
|
||||||
@@ -19,4 +19,4 @@ object SimpleRequestCallFactory : AbstractRequestCallFactory() {
|
|||||||
ContentType.Application.Json
|
ContentType.Application.Json
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user