1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-22 16:23:48 +00:00

Merge pull request #69 from InsanusMokrassar/0.25.0

0.25.0
This commit is contained in:
InsanusMokrassar 2020-03-22 16:50:50 +06:00 committed by GitHub
commit d4c409107a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
144 changed files with 387 additions and 2121 deletions

View File

@ -1,5 +1,28 @@
# TelegramBotAPI changelog # TelegramBotAPI changelog
## 0.25.0
* Common:
* Versions updates:
* `Kotlin`: `1.3.61` -> `1.3.70`
* `Kotlin coroutines`: `1.3.3` -> `1.3.5`
* `Kotlin serialization`: `0.14.0` -> `0.20.0`
* `Ktor`: `1.3.1` -> `1.3.2`
* `Klock`: `1.8.7` -> `1.10.0`
* `UUID`: `0.0.7` -> `0.1.0`
* `TelegramBotAPI`:
* `Bot` implementations (as and `Bot` itself) now have not nullable `username`
* `File#toInputFile` extension now will throw error when file does not exists
* `InlineKeyboardMarkup` will check that `PayInlineKeyboardButton` is the first in case if it is exists in
`keyboard`
* `makeLinkToMessage` now is not `PreviewFeature`
* All deprecations was removed
* `RequestException` now extends `io.ktor.utils.io.errors.IOException` instead of `kotlinx.io.IOException`
* `Any#toJson` now is NOT `inline`
* `FlowsUpdatesFilter` now as marked my annotation `FlowPreview`
* `PathedFile#fullUrl` now is not `inline` function
* `SimpleRequest#json` now is not `inline` and `internal` function
## 0.24.0 ## 0.24.0
* `TelegramBotAPI`: * `TelegramBotAPI`:

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAnimation
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
suspend fun RequestsExecutor.sendAnimation( suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendAudio
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
suspend fun RequestsExecutor.sendAudio( suspend fun RequestsExecutor.sendAudio(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendDocument
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
suspend fun RequestsExecutor.sendDocument( suspend fun RequestsExecutor.sendDocument(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -1,14 +1,12 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendPhoto
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
suspend fun RequestsExecutor.sendPhoto( suspend fun RequestsExecutor.sendPhoto(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendSticker
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
suspend fun RequestsExecutor.sendSticker( suspend fun RequestsExecutor.sendSticker(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -1,13 +1,12 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideo
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
suspend fun RequestsExecutor.sendVideo( suspend fun RequestsExecutor.sendVideo(

View File

@ -1,13 +1,12 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVideoNote
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
suspend fun RequestsExecutor.sendVideoNote( suspend fun RequestsExecutor.sendVideoNote(

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media package com.github.insanusmokrassar.TelegramBotAPI.extensions.api.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.InputFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.SendVoice
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.MessageIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
suspend fun RequestsExecutor.sendVoice( suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier, chatId: ChatIdentifier,

View File

@ -39,6 +39,7 @@ kotlin {
implementation kotlin('stdlib') implementation kotlin('stdlib')
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core-common:$kotlin_coroutines_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-common:$kotlin_serialisation_runtime_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-properties-common:$kotlin_serialisation_runtime_version"
api "com.soywiz.korlibs.klock:klock:$klock_version" api "com.soywiz.korlibs.klock:klock:$klock_version"
api "com.benasher44:uuid:$uuid_version" api "com.benasher44:uuid:$uuid_version"
@ -56,6 +57,7 @@ kotlin {
jvmMain { jvmMain {
dependencies { dependencies {
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime:$kotlin_serialisation_runtime_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-properties:$kotlin_serialisation_runtime_version"
api "io.ktor:ktor-client:$ktor_version" api "io.ktor:ktor-client:$ktor_version"
api "io.ktor:ktor-server:$ktor_version" api "io.ktor:ktor-server:$ktor_version"
@ -73,9 +75,19 @@ kotlin {
jsMain { jsMain {
dependencies { dependencies {
api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$kotlin_serialisation_runtime_version" api "org.jetbrains.kotlinx:kotlinx-serialization-runtime-js:$kotlin_serialisation_runtime_version"
api "org.jetbrains.kotlinx:kotlinx-serialization-properties-js:$kotlin_serialisation_runtime_version"
api "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version" api "org.jetbrains.kotlinx:kotlinx-coroutines-core-js:$kotlin_coroutines_version"
api "io.ktor:ktor-client-js:$ktor_version" api "io.ktor:ktor-client-js:$ktor_version"
} }
} }
} }
targets.all {
compilations.all {
kotlinOptions {
freeCompilerArgs += ["-Xuse-experimental=kotlinx.coroutines.ExperimentalCoroutinesApi", "-Xopt-in=kotlin.RequiresOptIn"]
}
}
}
} }

View File

@ -10,6 +10,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.types.Response import com.github.insanusmokrassar.TelegramBotAPI.types.Response
import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError import com.github.insanusmokrassar.TelegramBotAPI.types.RetryAfterError
import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper import com.github.insanusmokrassar.TelegramBotAPI.utils.TelegramAPIUrlsKeeper
import com.github.insanusmokrassar.TelegramBotAPI.utils.nonstrictJsonFormat
import io.ktor.client.HttpClient import io.ktor.client.HttpClient
import io.ktor.client.call.receive import io.ktor.client.call.receive
import io.ktor.client.features.* import io.ktor.client.features.*
@ -25,7 +26,7 @@ class KtorRequestsExecutor(
callsFactories: List<KtorCallFactory> = emptyList(), callsFactories: List<KtorCallFactory> = emptyList(),
excludeDefaultFactories: Boolean = false, excludeDefaultFactories: Boolean = false,
private val requestsLimiter: RequestLimiter = EmptyLimiter, private val requestsLimiter: RequestLimiter = EmptyLimiter,
private val jsonFormatter: Json = Json.nonstrict private val jsonFormatter: Json = nonstrictJsonFormat
) : BaseRequestsExecutor(telegramAPIUrlsKeeper) { ) : BaseRequestsExecutor(telegramAPIUrlsKeeper) {
private val callsFactories: List<KtorCallFactory> = callsFactories.run { private val callsFactories: List<KtorCallFactory> = callsFactories.run {
if (!excludeDefaultFactories) { if (!excludeDefaultFactories) {

View File

@ -1,10 +0,0 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot
import io.ktor.utils.io.core.Closeable
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
@Deprecated("Deprecated due to more simple way to get updates using TelegramBotAPI-extensions-api")
interface UpdatesPoller : Closeable {
fun start(scope: CoroutineScope = CoroutineScope(Dispatchers.Default))
}

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions package com.github.insanusmokrassar.TelegramBotAPI.bot.exceptions
import com.github.insanusmokrassar.TelegramBotAPI.types.Response import com.github.insanusmokrassar.TelegramBotAPI.types.Response
import kotlinx.io.IOException import io.ktor.utils.io.errors.IOException
fun newRequestException( fun newRequestException(
response: Response, response: Response,

View File

@ -1,13 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class DeleteMessage( data class DeleteMessage(
@ -19,7 +16,7 @@ data class DeleteMessage(
override fun method(): String = "deleteMessage" override fun method(): String = "deleteMessage"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,11 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.PossiblyForwardedMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import kotlinx.serialization.* import kotlinx.serialization.*
private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<PossiblyForwardedMessage>() private val AbleToBeForwardedMessageDeserializer = TelegramBotAPIMessageDeserializationStrategyClass<PossiblyForwardedMessage>()

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot import com.github.insanusmokrassar.TelegramBotAPI.types.ExtendedBot
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -5,9 +5,9 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.Update
import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutDeserialization import com.github.insanusmokrassar.TelegramBotAPI.types.update.abstracts.UpdateSerializerWithoutDeserialization
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
private val updatesListSerializer = ArrayListSerializer( private val updatesListSerializer = ListSerializer(
UpdateSerializerWithoutDeserialization UpdateSerializerWithoutDeserialization
) )

View File

@ -2,12 +2,9 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll import com.github.insanusmokrassar.TelegramBotAPI.types.polls.Poll
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -2,7 +2,6 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializable(InputFileSerializer::class) @Serializable(InputFileSerializer::class)
sealed class InputFile { sealed class InputFile {
@ -22,8 +21,8 @@ fun String.toInputFile() = FileId(this)
@Serializer(InputFile::class) @Serializer(InputFile::class)
internal object InputFileSerializer : KSerializer<InputFile> { internal object InputFileSerializer : KSerializer<InputFile> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(FileId::class.toString()) override val descriptor: SerialDescriptor = PrimitiveDescriptor(FileId::class.toString(), PrimitiveKind.STRING)
override fun serialize(encoder: Encoder, obj: InputFile) = encoder.encodeString(obj.fileId) override fun serialize(encoder: Encoder, value: InputFile) = encoder.encodeString(value.fileId)
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString()) override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
} }

View File

@ -9,4 +9,4 @@ interface SimpleRequest<T: Any> : Request<T> {
} }
@Suppress("UNCHECKED_CAST") @Suppress("UNCHECKED_CAST")
inline fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>) internal fun <T: Any, K: SimpleRequest<T>> K.json(): JsonObject = toJsonWithoutNulls(requestSerializer as SerializationStrategy<K>)

View File

@ -1,11 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery import com.github.insanusmokrassar.TelegramBotAPI.types.CallbackQuery.CallbackQuery
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class AnswerCallbackQuery( data class AnswerCallbackQuery(
@ -22,7 +21,7 @@ data class AnswerCallbackQuery(
) : SimpleRequest<Boolean> { ) : SimpleRequest<Boolean> {
override fun method(): String = "answerCallbackQuery" override fun method(): String = "answerCallbackQuery"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers package com.github.insanusmokrassar.TelegramBotAPI.requests.answers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.serializers.InlineQueryResultSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InlineQuery
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class AnswerInlineQuery( data class AnswerInlineQuery(
@ -30,7 +29,7 @@ data class AnswerInlineQuery(
): SimpleRequest<Boolean> { ): SimpleRequest<Boolean> {
override fun method(): String = "answerInlineQuery" override fun method(): String = "answerInlineQuery"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@ -52,6 +51,6 @@ fun InlineQuery.createAnswer(
switchPmParameter switchPmParameter
) )
internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ArrayListSerializer( internal object InlineQueryAnswersResultsSerializer: KSerializer<List<InlineQueryResult>> by ListSerializer(
InlineQueryResultSerializer InlineQueryResultSerializer
) )

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerPreCheckoutQuery
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery import com.github.insanusmokrassar.TelegramBotAPI.types.payments.PreCheckoutQuery

View File

@ -1,12 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery import com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abstracts.AnswerShippingQuery
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingOption
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery import com.github.insanusmokrassar.TelegramBotAPI.types.payments.ShippingQuery
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
@Serializable @Serializable
data class AnswerShippingQueryOk( data class AnswerShippingQueryOk(
@ -22,7 +21,7 @@ data class AnswerShippingQueryOk(
get() = serializer() get() = serializer()
} }
internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ArrayListSerializer( internal object ShippingOptionsSerializer : KSerializer<List<ShippingOption>> by ListSerializer(
ShippingOption.serializer() ShippingOption.serializer()
) )

View File

@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId import com.github.insanusmokrassar.TelegramBotAPI.types.PreCheckoutQueryId
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
interface AnswerPreCheckoutQuery : SimpleRequest<Boolean> { interface AnswerPreCheckoutQuery : SimpleRequest<Boolean> {
override fun method(): String = "answerPreCheckoutQuery" override fun method(): String = "answerPreCheckoutQuery"
override val resultDeserializer: KSerializer<Boolean> override val resultDeserializer: KSerializer<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
val preCheckoutQueryId: PreCheckoutQueryId val preCheckoutQueryId: PreCheckoutQueryId
val isOk: Boolean val isOk: Boolean

View File

@ -3,12 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.answers.payments.abs
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ShippingQueryIdentifier
import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
interface AnswerShippingQuery : SimpleRequest<Boolean> { interface AnswerShippingQuery : SimpleRequest<Boolean> {
override fun method(): String = "answerShippingQuery" override fun method(): String = "answerShippingQuery"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
val shippingQueryId: ShippingQueryIdentifier val shippingQueryId: ShippingQueryIdentifier
val isOk: Boolean val isOk: Boolean

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class ExportChatInviteLink( data class ExportChatInviteLink(
@ -16,7 +14,7 @@ data class ExportChatInviteLink(
): ChatRequest, SimpleRequest<String> { ): ChatRequest, SimpleRequest<String> {
override fun method(): String = "exportChatInviteLink" override fun method(): String = "exportChatInviteLink"
override val resultDeserializer: DeserializationStrategy<String> override val resultDeserializer: DeserializationStrategy<String>
get() = StringSerializer get() = String.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat package com.github.insanusmokrassar.TelegramBotAPI.requests.chat
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class LeaveChat( data class LeaveChat(
@ -16,7 +14,7 @@ data class LeaveChat(
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "leaveChat" override fun method(): String = "leaveChat"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ExtendedChatSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.extended.ExtendedChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
@ -21,13 +19,3 @@ data class GetChat(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChat(
chatId: ChatIdentifier
) = execute(GetChat(chatId))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChat(
chat: Chat
) = getChat(chat.id)

View File

@ -1,17 +1,15 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMember
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.AdministratorChatMemberSerializerWithoutDeserialization
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
private val chatMembersListSerializer = ArrayListSerializer( private val chatMembersListSerializer = ListSerializer(
AdministratorChatMemberSerializerWithoutDeserialization AdministratorChatMemberSerializerWithoutDeserialization
) )
@ -26,13 +24,3 @@ data class GetChatAdministrators(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatAdministrators(
chatId: ChatIdentifier
) = execute(GetChatAdministrators(chatId))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatAdministrators(
chat: PublicChat
) = getChatAdministrators(chat.id)

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.get
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.IntSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class GetChatMembersCount( data class GetChatMembersCount(
@ -16,17 +14,7 @@ data class GetChatMembersCount(
): ChatRequest, SimpleRequest<Int> { ): ChatRequest, SimpleRequest<Int> {
override fun method(): String = "getChatMembersCount" override fun method(): String = "getChatMembersCount"
override val resultDeserializer: DeserializationStrategy<Int> override val resultDeserializer: DeserializationStrategy<Int>
get() = IntSerializer get() = Int.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMembersCount(
chatId: ChatIdentifier
) = execute(GetChatMembersCount(chatId))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMembersCount(
chat: PublicChat
) = getChatMembersCount(chat.id)

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMember
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts.ChatMemberDeserializationStrategy
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable
@ -21,27 +19,3 @@ data class GetChatMember(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMember(
chatId: ChatIdentifier,
userId: UserId
) = execute(GetChatMember(chatId, userId))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMember(
chat: PublicChat,
userId: UserId
) = getChatMember(chat.id, userId)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMember(
chatId: ChatId,
user: User
) = getChatMember(chatId, user.id)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getChatMember(
chat: PublicChat,
user: User
) = getChatMember(chat.id, user.id)

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class KickChatMember( data class KickChatMember(
@ -19,7 +17,7 @@ data class KickChatMember(
) : ChatMemberRequest<Boolean>, UntilDate { ) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "kickChatMember" override fun method(): String = "kickChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class PromoteChatMember( data class PromoteChatMember(
@ -35,7 +33,7 @@ data class PromoteChatMember(
) : ChatMemberRequest<Boolean>, UntilDate { ) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember" override fun method(): String = "promoteChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.UntilDate
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class RestrictChatMember( data class RestrictChatMember(
@ -22,40 +20,7 @@ data class RestrictChatMember(
) : ChatMemberRequest<Boolean>, UntilDate { ) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "restrictChatMember" override fun method(): String = "restrictChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.restrictChatMember(
chatId: ChatIdentifier,
userId: UserId,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()
) = execute(RestrictChatMember(chatId, userId, untilDate, permissions))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.restrictChatMember(
chat: PublicChat,
userId: UserId,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()
) = restrictChatMember(chat.id, userId, untilDate, permissions)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.restrictChatMember(
chatId: ChatId,
user: User,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()
) = restrictChatMember(chatId, user.id, untilDate, permissions)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.restrictChatMember(
chat: PublicChat,
user: User,
untilDate: TelegramDate? = null,
permissions: ChatPermissions = ChatPermissions()
) = restrictChatMember(chat.id, user.id, untilDate, permissions)

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
/** /**
* Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle * Representation of https://core.telegram.org/bots/api#setchatadministratorcustomtitle
@ -23,7 +21,7 @@ data class SetChatAdministratorCustomTitle(
) : ChatMemberRequest<Boolean> { ) : ChatMemberRequest<Boolean> {
override fun method(): String = "setChatAdministratorCustomTitle" override fun method(): String = "setChatAdministratorCustomTitle"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = RestrictChatMember.serializer() get() = RestrictChatMember.serializer()
@ -33,31 +31,3 @@ data class SetChatAdministratorCustomTitle(
} }
} }
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chatId: ChatId,
userId: UserId,
customTitle: String
) = execute(SetChatAdministratorCustomTitle(chatId, userId, customTitle))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chat: PublicChat,
userId: UserId,
customTitle: String
) = setChatAdministratorCustomTitle(chat.id, userId, customTitle)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chatId: ChatId,
user: User,
customTitle: String
) = setChatAdministratorCustomTitle(chatId, user.id, customTitle)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatAdministratorCustomTitle(
chat: PublicChat,
user: User,
customTitle: String
) = setChatAdministratorCustomTitle(chat.id, user.id, customTitle)

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.members
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.chat.abstracts.ChatMemberRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class UnbanChatMember( data class UnbanChatMember(
@ -16,7 +14,7 @@ data class UnbanChatMember(
) : ChatMemberRequest<Boolean> { ) : ChatMemberRequest<Boolean> {
override fun method(): String = "unbanChatMember" override fun method(): String = "unbanChatMember"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class DeleteChatPhoto( data class DeleteChatPhoto(
@ -16,7 +14,7 @@ data class DeleteChatPhoto(
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "deleteChatPhoto" override fun method(): String = "deleteChatPhoto"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.* import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.Message
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class PinChatMessage ( data class PinChatMessage (
@ -20,7 +17,7 @@ data class PinChatMessage (
): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification { ): ChatRequest, SimpleRequest<Boolean>, MessageAction, DisableNotification {
override fun method(): String = "pinChatMessage" override fun method(): String = "pinChatMessage"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class SetChatDescription ( data class SetChatDescription (
@ -23,19 +21,7 @@ data class SetChatDescription (
override fun method(): String = "setChatDescription" override fun method(): String = "setChatDescription"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatDescription(
chatId: ChatIdentifier,
description: String
) = execute(SetChatDescription(chatId, description))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatDescription(
chat: PublicChat,
description: String
) = setChatDescription(chat.id, description)

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions import com.github.insanusmokrassar.TelegramBotAPI.types.chat.ChatPermissions
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class SetChatPermissions ( data class SetChatPermissions (
@ -18,19 +16,7 @@ data class SetChatPermissions (
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "setChatPermissions" override fun method(): String = "setChatPermissions"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
chatId: ChatIdentifier,
permissions: ChatPermissions
) = execute(SetChatPermissions(chatId, permissions))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setDefaultChatMembersPermissions(
chat: PublicChat,
permissions: ChatPermissions
) = setDefaultChatMembersPermissions(chat.id, permissions)

View File

@ -1,14 +1,12 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson import com.github.insanusmokrassar.TelegramBotAPI.utils.toJson
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
import kotlinx.serialization.json.JsonObject import kotlinx.serialization.json.JsonObject
@Serializable @Serializable
@ -19,19 +17,7 @@ data class SetChatPhoto (
): ChatRequest, MultipartRequest<Boolean> { ): ChatRequest, MultipartRequest<Boolean> {
override fun method(): String = "setChatPhoto" override fun method(): String = "setChatPhoto"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo) override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
override val paramsJson: JsonObject = toJson(serializer()) override val paramsJson: JsonObject = toJson(serializer())
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatPhoto(
chatId: ChatIdentifier,
photo: MultipartFile
) = execute(SetChatPhoto(chatId, photo))
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.setChatPhoto(
chat: PublicChat,
photo: MultipartFile
) = setChatPhoto(chat.id, photo)

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class SetChatTitle ( data class SetChatTitle (
@ -23,7 +21,7 @@ data class SetChatTitle (
override fun method(): String = "setChatTitle" override fun method(): String = "setChatTitle"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.modify
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.PublicChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class UnpinChatMessage( data class UnpinChatMessage(
@ -16,7 +14,7 @@ data class UnpinChatMessage(
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "unpinChatMessage" override fun method(): String = "unpinChatMessage"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.ChatIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField import com.github.insanusmokrassar.TelegramBotAPI.types.chatIdField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class DeleteChatStickerSet( data class DeleteChatStickerSet(
@ -16,7 +14,7 @@ data class DeleteChatStickerSet(
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "deleteChatStickerSet" override fun method(): String = "deleteChatStickerSet"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.chat.stickers
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ChatRequest
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.SupergroupChat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class SetChatStickerSet( data class SetChatStickerSet(
@ -17,7 +15,7 @@ data class SetChatStickerSet(
): ChatRequest, SimpleRequest<Boolean> { ): ChatRequest, SimpleRequest<Boolean> {
override fun method(): String = "setChatStickerSet" override fun method(): String = "setChatStickerSet"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,10 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*

View File

@ -1,12 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditChatMessage
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MessageContent
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.ReplyMarkup
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditInlineMessage
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*

View File

@ -3,10 +3,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier import com.github.insanusmokrassar.TelegramBotAPI.types.InlineMessageIdentifier
import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
interface EditInlineMessage : SimpleRequest<Boolean> { interface EditInlineMessage : SimpleRequest<Boolean> {
val inlineMessageId: InlineMessageIdentifier val inlineMessageId: InlineMessageIdentifier
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
} }

View File

@ -1,14 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CaptionedInput
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.MediaContentMessageResultDeserializer
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
import kotlinx.serialization.* import kotlinx.serialization.*
@ -35,33 +32,3 @@ data class EditChatMessageCaption(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageCaption(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageCaption(chatId, messageId, text, parseMode, replyMarkup)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageCaption(
chat: Chat,
messageId: MessageIdentifier,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageCaption(chat.id, messageId, text, parseMode, replyMarkup)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun <T> RequestsExecutor.editMessageCaption(
message: ContentMessage<T>,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
): ContentMessage<MediaContent> where T : CaptionedInput, T : MediaContent {
return editMessageCaption(message.chat.id, message.messageId, text, parseMode, replyMarkup)
}

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.caption
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
@ -23,11 +22,3 @@ data class EditInlineMessageCaption(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
text: String,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageCaption(inlineMessageId, text, parseMode, replyMarkup))

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.abstracts.MediaContent
@ -40,28 +38,3 @@ data class EditChatMessageMedia(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageMedia(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
media: InputMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageMedia(chatId, messageId, media, replyMarkup)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageMedia(
chat: Chat,
messageId: MessageIdentifier,
media: InputMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageMedia(chat.id, messageId, media, replyMarkup)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageMedia(
message: ContentMessage<out MediaContent>,
media: InputMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageMedia(message.chat.id, message.messageId, media, replyMarkup)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
@ -28,10 +27,3 @@ data class EditInlineMessageMedia(
override fun method(): String = editMessageMediaMethod override fun method(): String = editMessageMediaMethod
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageCaption(
inlineMessageId: InlineMessageIdentifier,
media: InputMedia,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(EditInlineMessageMedia(inlineMessageId, media, replyMarkup))

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.TextContentMessageResultDeserializer import com.github.insanusmokrassar.TelegramBotAPI.requests.send.TextContentMessageResultDeserializer
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent
import kotlinx.serialization.* import kotlinx.serialization.*
@ -36,34 +34,3 @@ data class EditChatMessageText(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageText(
chatId: ChatIdentifier,
messageId: MessageIdentifier,
text: String,
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
EditChatMessageText(chatId, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageText(
chat: Chat,
messageId: MessageIdentifier,
text: String,
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(chat.id, messageId, text, parseMode, disableWebPagePreview, replyMarkup)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.editMessageText(
message: ContentMessage<TextContent>,
text: String,
parseMode: ParseMode? = null,
disableWebPagePreview: Boolean? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = editMessageText(message.chat.id, message.messageId, text, parseMode, disableWebPagePreview, replyMarkup)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.text
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.editMessageMediaMethod import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.media.editMessageMediaMethod
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*

View File

@ -1,12 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.games package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable

View File

@ -1,7 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.games package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.GetGameHighScores
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -1,12 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.games package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.MessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent
import kotlinx.serialization.* import kotlinx.serialization.*
@Serializable @Serializable

View File

@ -1,7 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.games package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.InlineMessageAction
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.* import kotlinx.serialization.*

View File

@ -5,7 +5,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
import com.github.insanusmokrassar.TelegramBotAPI.types.games.GameHighScore import com.github.insanusmokrassar.TelegramBotAPI.types.games.GameHighScore
import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
interface GetGameHighScores : SimpleRequest<List<GameHighScore>> { interface GetGameHighScores : SimpleRequest<List<GameHighScore>> {
val userId: UserId val userId: UserId
@ -15,4 +15,4 @@ interface GetGameHighScores : SimpleRequest<List<GameHighScore>> {
get() = GameHighScoresSerializer get() = GameHighScoresSerializer
} }
internal object GameHighScoresSerializer : KSerializer<List<GameHighScore>> by ArrayListSerializer(GameHighScore.serializer()) internal object GameHighScoresSerializer : KSerializer<List<GameHighScore>> by ListSerializer(GameHighScore.serializer())

View File

@ -3,7 +3,7 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.DeserializationStrategy
import kotlinx.serialization.serializer import kotlinx.serialization.builtins.serializer
interface SetGameScore : SimpleRequest<Boolean> { interface SetGameScore : SimpleRequest<Boolean> {
val userId: UserId val userId: UserId

View File

@ -1,10 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.get package com.github.insanusmokrassar.TelegramBotAPI.requests.get
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PathedFile import com.github.insanusmokrassar.TelegramBotAPI.types.files.PathedFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.TelegramMediaFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.fileIdField import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.fileIdField
import kotlinx.serialization.* import kotlinx.serialization.*
@ -19,15 +17,3 @@ data class GetFile(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getFileAdditionalInfo(
fileId: FileId
) = execute(
GetFile(fileId)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getFileAdditionalInfo(
file: TelegramMediaFile
) = getFileAdditionalInfo(file.fileId)

View File

@ -1,8 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.get package com.github.insanusmokrassar.TelegramBotAPI.requests.get
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerSetNameField
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
import kotlinx.serialization.* import kotlinx.serialization.*
@ -18,17 +16,3 @@ data class GetStickerSet(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getStickerSet(
name: String
) = execute(
GetStickerSet(name)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getStickerSet(
sticker: Sticker
) = getStickerSet(
sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method")
)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.get package com.github.insanusmokrassar.TelegramBotAPI.requests.get
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.* import kotlinx.serialization.*
@ -29,21 +28,3 @@ data class GetUserProfilePhotos(
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getUserProfilePhotos(
userId: UserId,
offset: Int? = null,
limit: Int? = null
) = execute(
GetUserProfilePhotos(
userId, offset, limit
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getUserProfilePhotos(
user: CommonUser,
offset: Int? = null,
limit: Int? = null
) = getUserProfilePhotos(user.id, offset, limit)

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send package com.github.insanusmokrassar.TelegramBotAPI.requests.send
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendChatMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.actions.* import com.github.insanusmokrassar.TelegramBotAPI.types.actions.BotAction
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
/** /**
* Send notification to user which will be shown for 5 seconds or while user have no messages from bot * Send notification to user which will be shown for 5 seconds or while user have no messages from bot
@ -20,7 +18,7 @@ data class SendAction(
): SendChatMessageRequest<Boolean> { ): SendChatMessageRequest<Boolean> {
override fun method(): String = "sendChatAction" override fun method(): String = "sendChatAction"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send package com.github.insanusmokrassar.TelegramBotAPI.requests.send
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.ContactContent

View File

@ -1,22 +1,17 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send package com.github.insanusmokrassar.TelegramBotAPI.requests.send
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.LocationContent
import com.soywiz.klock.DateTime
import com.soywiz.klock.TimeSpan
import kotlinx.serialization.* import kotlinx.serialization.*
private val commonResultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>> private val commonResultDeserializer: DeserializationStrategy<ContentMessage<LocationContent>>
= TelegramBotAPIMessageDeserializationStrategyClass() = TelegramBotAPIMessageDeserializationStrategyClass()
// TODO:: Add location tracker for tracking location
@Serializable @Serializable
data class SendLocation( data class SendLocation(
@SerialName(chatIdField) @SerialName(chatIdField)

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send package com.github.insanusmokrassar.TelegramBotAPI.requests.send
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableWebPagePreview import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.DisableWebPagePreview
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.TextContent

View File

@ -1,10 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send package com.github.insanusmokrassar.TelegramBotAPI.requests.send
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.VenueContent
@ -75,59 +73,3 @@ fun Venue.toRequest(
replyToMessageId, replyToMessageId,
replyMarkup replyMarkup
) )
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVenue(
chatId: ChatIdentifier,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: String? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
chatId, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVenue(
chat: Chat,
latitude: Double,
longitude: Double,
title: String,
address: String,
foursquareId: String? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chat.id, latitude, longitude, title, address, foursquareId, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVenue(
chatId: ChatIdentifier,
venue: Venue,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVenue(
chatId, venue, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVenue(
chat: Chat,
venue: Venue,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVenue(
chat.id, venue, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,12 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.games package com.github.insanusmokrassar.TelegramBotAPI.requests.send.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ReplyMarkup
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.games.Game
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.GameContent

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AnimationFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AnimationContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AnimationContent
@ -115,144 +112,3 @@ data class SendAnimationFiles internal constructor(
animationField to animation, animationField to animation,
thumbField to thumb thumbField to thumb
) )
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: FileId,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendAnimationData(
chatId,
animation.fileId,
thumb ?.fileId,
text,
parseMode,
duration,
width,
height,
disableNotification,
replyToMessageId,
replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
thumb: PhotoSize? = animation.thumb,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, thumb ?.fileId, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: MultipartFile,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendAnimationData(
chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
),
SendAnimationFiles(animation)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: MultipartFile,
thumb: MultipartFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendAnimationData(
chatId, null, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
),
SendAnimationFiles(animation, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: FileId,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendAnimationData(
chatId, animation.fileId, null, text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
),
SendAnimationFiles(null, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: MultipartFile,
thumb: PhotoSize? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation, thumb ?.fileId , text, parseMode, duration, width, height, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendAnimation(
chatId: ChatIdentifier,
animation: AnimationFile,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendAnimation(
chatId, animation.fileId, thumb, text, parseMode, animation.duration, animation.width, animation.height, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,7 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Performerable
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -9,8 +8,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AudioContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.AudioContent

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.DocumentFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.DocumentContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.DocumentContent

View File

@ -1,18 +1,16 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.Request
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.* import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.*
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.MediaGroupMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializeOnlySerializerClass
import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls import com.github.insanusmokrassar.TelegramBotAPI.utils.toJsonWithoutNulls
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.ArrayListSerializer import kotlinx.serialization.builtins.ListSerializer
import kotlinx.serialization.json.jsonArray import kotlinx.serialization.json.jsonArray
val membersCountInMediaGroup: IntRange = 2 .. 10 val membersCountInMediaGroup: IntRange = 2 .. 10
@ -55,8 +53,8 @@ fun SendMediaGroup(
} }
} }
private val messagesListSerializer: ArrayListSerializer<MediaGroupMessage> private val messagesListSerializer: KSerializer<List<MediaGroupMessage>>
= ArrayListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass()) = ListSerializer(TelegramBotAPIMessageDeserializeOnlySerializerClass())
@Serializable @Serializable
data class SendMediaGroupData internal constructor( data class SendMediaGroupData internal constructor(
@ -87,25 +85,3 @@ data class SendMediaGroupData internal constructor(
data class SendMediaGroupFiles internal constructor( data class SendMediaGroupFiles internal constructor(
val files: List<MultipartFile> val files: List<MultipartFile>
) : Files by (files.map { it.fileId to it }.toMap()) ) : Files by (files.map { it.fileId to it }.toMap())
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendMediaGroup(
chatId: ChatIdentifier,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
) = execute(
SendMediaGroup(
chatId, media, disableNotification, replyToMessageId
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendMediaGroup(
chat: Chat,
media: List<MediaGroupMemberInputMedia>,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null
) = sendMediaGroup(
chat.id, media, disableNotification, replyToMessageId
)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.files.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.PhotoContent
@ -85,95 +82,3 @@ data class SendPhotoFiles internal constructor(
) : Files by mapOf( ) : Files by mapOf(
photoField to photo photoField to photo
) )
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chatId: ChatIdentifier,
fileId: FileId,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendPhotoData(
chatId,
fileId.fileId,
caption,
parseMode,
disableNotification,
replyToMessageId,
replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chatId: ChatIdentifier,
file: PhotoSize,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(
chatId, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chatId: ChatIdentifier,
photo: Photo,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(
chatId, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chat: Chat,
fileId: FileId,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(
chat.id,
fileId,
caption,
parseMode,
disableNotification,
replyToMessageId,
replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chat: Chat,
file: PhotoSize,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(
chat.id, file.fileId, caption, parseMode, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendPhoto(
chat: Chat,
photo: Photo,
caption: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendPhoto(
chat.id, photo.biggest() ?: throw IllegalArgumentException("Photo $photo is empty"), caption, parseMode, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,13 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.StickerContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.StickerContent
@ -65,68 +62,3 @@ data class SendStickerByFile internal constructor(
override val mediaMap: Map<String, MultipartFile> = mapOf(stickerField to sticker) override val mediaMap: Map<String, MultipartFile> = mapOf(stickerField to sticker)
override val paramsJson: JsonObject = sendStickerByFileId.toJsonWithoutNulls(SendStickerByFileId.serializer()) override val paramsJson: JsonObject = sendStickerByFileId.toJsonWithoutNulls(SendStickerByFileId.serializer())
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chatId: ChatIdentifier,
sticker: FileId,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendStickerByFileId(chatId, sticker, disableNotification, replyToMessageId, replyMarkup)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chatId: ChatIdentifier,
sticker: MultipartFile,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendStickerByFile(
SendStickerByFileId(chatId, null, disableNotification, replyToMessageId, replyMarkup),
sticker
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chat: Chat,
sticker: FileId,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chat: Chat,
sticker: MultipartFile,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker, disableNotification, replyToMessageId, replyMarkup)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chatId: ChatIdentifier,
sticker: Sticker,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(
chatId, sticker.fileId, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendSticker(
chat: Chat,
sticker: Sticker,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendSticker(chat.id, sticker.fileId, disableNotification, replyToMessageId, replyMarkup)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoContent
@ -119,148 +116,3 @@ data class SendVideoFiles internal constructor(
videoField to video, videoField to video,
thumbField to thumb thumbField to thumb
) )
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: FileId,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVideoData(
chatId,
video.fileId,
thumb ?.fileId,
text,
parseMode,
duration,
width,
height,
null,
disableNotification,
replyToMessageId,
replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
thumb: PhotoSize? = video.thumb,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(
chatId, video.fileId, thumb ?.fileId, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: MultipartFile,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportStreaming: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVideoData(
chatId, null, thumb ?.fileId, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
),
SendVideoFiles(video)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: MultipartFile,
thumb: MultipartFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportStreaming: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVideoData(
chatId, null, null, text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
),
SendVideoFiles(video, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: FileId,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVideoData(
chatId, video.fileId, null, text, parseMode, duration, width, height, null, disableNotification, replyToMessageId, replyMarkup
),
SendVideoFiles(null, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: MultipartFile,
thumb: PhotoSize? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
width: Int? = null,
height: Int? = null,
supportStreaming: Boolean? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(
chatId, video, thumb ?.fileId , text, parseMode, duration, width, height, supportStreaming, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVideo(
chatId: ChatIdentifier,
video: VideoFile,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVideo(
chatId, video.fileId, thumb, text, parseMode, video.duration, video.width, video.height, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.files.VideoFile
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoNoteContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VideoNoteContent

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media package com.github.insanusmokrassar.TelegramBotAPI.requests.send.media
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.* import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.*
@ -8,8 +7,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.AudioFile
import com.github.insanusmokrassar.TelegramBotAPI.types.files.PhotoSize
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VoiceContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.media.VoiceContent
@ -106,132 +103,3 @@ data class SendVoiceFiles internal constructor(
voiceField to voice, voiceField to voice,
thumbField to thumb thumbField to thumb
) )
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: FileId,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendVoiceData(
chatId,
voice.fileId,
thumb ?.fileId,
text,
parseMode,
duration,
disableNotification,
replyToMessageId,
replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: AudioFile,
thumb: PhotoSize? = voice.thumb,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice.fileId, thumb ?.fileId, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: MultipartFile,
thumb: FileId? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVoiceData(
chatId, null, thumb ?.fileId, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
),
SendVoiceFiles(voice)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: MultipartFile,
thumb: MultipartFile? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVoiceData(
chatId, null, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
),
SendVoiceFiles(voice, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: FileId,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
MultipartRequestImpl(
SendVoiceData(
chatId, voice.fileId, null, text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
),
SendVoiceFiles(null, thumb)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: MultipartFile,
thumb: PhotoSize? = null,
text: String? = null,
parseMode: ParseMode? = null,
duration: Long? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice, thumb ?.fileId , text, parseMode, duration, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendVoice(
chatId: ChatIdentifier,
voice: AudioFile,
thumb: MultipartFile,
text: String? = null,
parseMode: ParseMode? = null,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendVoice(
chatId, voice.fileId, thumb, text, parseMode, voice.duration, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,7 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments package com.github.insanusmokrassar.TelegramBotAPI.requests.send.payments
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.* import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.*
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
@ -106,51 +105,3 @@ data class SendInvoice(
photoHeight = null photoHeight = null
} }
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendInvoice(
chatId: ChatId,
title: String,
description: String,
payload: String,
providerToken: String,
startParameter: StartParameter,
currency: Currency,
prices: List<LabeledPrice>,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = execute(
SendInvoice(chatId, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendInvoice(
user: CommonUser,
title: String,
description: String,
payload: String,
providerToken: String,
startParameter: StartParameter,
currency: Currency,
prices: List<LabeledPrice>,
providerData: String? = null,
requireName: Boolean = false,
requirePhoneNumber: Boolean = false,
requireEmail: Boolean = false,
requireShippingAddress: Boolean = false,
shouldSendPhoneNumberToProvider: Boolean = false,
shouldSendEmailToProvider: Boolean = false,
priceDependOnShipAddress: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: InlineKeyboardMarkup? = null
) = sendInvoice(user.id, title, description, payload, providerToken, startParameter, currency, prices, providerData, requireName, requirePhoneNumber, requireEmail, requireShippingAddress, shouldSendPhoneNumberToProvider, shouldSendEmailToProvider, priceDependOnShipAddress, disableNotification, replyToMessageId, replyMarkup)

View File

@ -1,11 +1,9 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls package com.github.insanusmokrassar.TelegramBotAPI.requests.send.polls
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.abstracts.SendMessageRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.KeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.chat.abstracts.Chat
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.ContentMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass import com.github.insanusmokrassar.TelegramBotAPI.types.message.abstracts.TelegramBotAPIMessageDeserializationStrategyClass
import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent import com.github.insanusmokrassar.TelegramBotAPI.types.message.content.PollContent
@ -185,136 +183,3 @@ data class SendQuizPoll(
} }
} }
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendRegularPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendRegularPoll(
chatId: ChatIdentifier,
poll: RegularPoll,
isClosed: Boolean = false,
question: String = poll.question,
options: List<String> = poll.options.map { it.text },
isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendRegularPoll(
chatId, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendRegularPoll(
chat: Chat,
question: String,
options: List<String>,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
allowMultipleAnswers: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendRegularPoll(
chat: Chat,
poll: RegularPoll,
isClosed: Boolean = false,
question: String = poll.question,
options: List<String> = poll.options.map { it.text },
isAnonymous: Boolean = poll.isAnonymous,
allowMultipleAnswers: Boolean = poll.allowMultipleAnswers,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendRegularPoll(
chat.id, question, options, isAnonymous, isClosed, allowMultipleAnswers, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendQuizPoll(
chatId: ChatIdentifier,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendQuizPoll(
chat: Chat,
question: String,
options: List<String>,
correctOptionId: Int,
isAnonymous: Boolean = true,
isClosed: Boolean = false,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendQuizPoll(
chatId: ChatIdentifier,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = execute(
SendQuizPoll(
chatId, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.sendQuizPoll(
chat: Chat,
isClosed: Boolean = false,
quizPoll: QuizPoll,
question: String = quizPoll.question,
options: List<String> = quizPoll.options.map { it.text },
correctOptionId: Int = quizPoll.correctOptionId ?: error("Correct option ID must be provided by income QuizPoll or by developer"),
isAnonymous: Boolean = quizPoll.isAnonymous,
disableNotification: Boolean = false,
replyToMessageId: MessageIdentifier? = null,
replyMarkup: KeyboardMarkup? = null
) = sendQuizPoll(
chat.id, question, options, correctOptionId, isAnonymous, isClosed, disableNotification, replyToMessageId, replyMarkup
)

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.StickerSet
import kotlinx.serialization.* import kotlinx.serialization.*
fun AddStickerToSet( fun AddStickerToSet(
@ -50,98 +48,3 @@ data class AddStickerToSet internal constructor(
override fun method(): String = "addStickerToSet" override fun method(): String = "addStickerToSet"
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
userId: UserId,
stickerSetName: String,
sticker: FileId,
emojis: String,
maskPosition: MaskPosition? = null
) = execute(
AddStickerToSet(
userId, stickerSetName, emojis, sticker, maskPosition
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
userId: UserId,
stickerSetName: String,
sticker: MultipartFile,
emojis: String,
maskPosition: MaskPosition? = null
) = execute(
CommonMultipartFileRequest(
AddStickerToSet(
userId, stickerSetName, emojis, null, maskPosition
),
mapOf(pngStickerField to sticker)
)
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
user: CommonUser,
stickerSetName: String,
sticker: FileId,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
user.id, stickerSetName, sticker, emojis, maskPosition
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
user: CommonUser,
stickerSetName: String,
sticker: MultipartFile,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
user.id, stickerSetName, sticker, emojis, maskPosition
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
userId: UserId,
stickerSet: StickerSet,
sticker: FileId,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
userId, stickerSet.name, sticker, emojis, maskPosition
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
userId: UserId,
stickerSet: StickerSet,
sticker: MultipartFile,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
userId, stickerSet.name, sticker, emojis, maskPosition
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
user: CommonUser,
stickerSet: StickerSet,
sticker: FileId,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
user.id, stickerSet.name, sticker, emojis, maskPosition
)
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.addStickerToSet(
user: CommonUser,
stickerSet: StickerSet,
sticker: MultipartFile,
emojis: String,
maskPosition: MaskPosition? = null
) = addStickerToSet(
user.id, stickerSet.name, sticker, emojis, maskPosition
)

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipartFileRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction

View File

@ -1,12 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class DeleteStickerFromSet( data class DeleteStickerFromSet(
@ -15,7 +13,7 @@ data class DeleteStickerFromSet(
) : SimpleRequest<Boolean> { ) : SimpleRequest<Boolean> {
override fun method(): String = "deleteStickerFromSet" override fun method(): String = "deleteStickerFromSet"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,13 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.files.Sticker
import com.github.insanusmokrassar.TelegramBotAPI.types.positionField import com.github.insanusmokrassar.TelegramBotAPI.types.positionField
import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField import com.github.insanusmokrassar.TelegramBotAPI.types.stickerField
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
data class SetStickerPositionInSet( data class SetStickerPositionInSet(
@ -24,7 +22,7 @@ data class SetStickerPositionInSet(
override fun method(): String = "setStickerPositionInSet" override fun method(): String = "setStickerPositionInSet"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers package com.github.insanusmokrassar.TelegramBotAPI.requests.stickers
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartFile
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.MultipartRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.UserId import com.github.insanusmokrassar.TelegramBotAPI.types.UserId
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
import kotlinx.serialization.KSerializer import kotlinx.serialization.KSerializer
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
interface StickerSetAction : SimpleRequest<Boolean> { interface StickerSetAction : SimpleRequest<Boolean> {
val userId: UserId val userId: UserId
@ -13,5 +13,5 @@ interface StickerSetAction : SimpleRequest<Boolean> {
val maskPosition: MaskPosition? val maskPosition: MaskPosition?
override val resultDeserializer: KSerializer<Boolean> override val resultDeserializer: KSerializer<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
} }

View File

@ -2,14 +2,14 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
@Serializable @Serializable
class DeleteWebhook : SimpleRequest<Boolean> { class DeleteWebhook : SimpleRequest<Boolean> {
override fun method(): String = "deleteWebhook" override fun method(): String = "deleteWebhook"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -1,6 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import com.github.insanusmokrassar.TelegramBotAPI.types.WebhookInfo import com.github.insanusmokrassar.TelegramBotAPI.types.WebhookInfo
import kotlinx.serialization.* import kotlinx.serialization.*
@ -14,6 +13,3 @@ class GetWebhookInfo : SimpleRequest<WebhookInfo> {
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }
@Deprecated("Deprecated due to extracting into separated library")
suspend fun RequestsExecutor.getWebhookInfo() = execute(GetWebhookInfo())

View File

@ -1,12 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
import com.github.insanusmokrassar.TelegramBotAPI.bot.RequestsExecutor
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.* import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataRequest import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.DataRequest
import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl import com.github.insanusmokrassar.TelegramBotAPI.requests.send.media.base.MultipartRequestImpl
import com.github.insanusmokrassar.TelegramBotAPI.types.* import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.BooleanSerializer import kotlinx.serialization.builtins.serializer
fun SetWebhook( fun SetWebhook(
url: String, url: String,
@ -53,7 +52,7 @@ data class SetWebhook internal constructor(
) : DataRequest<Boolean> { ) : DataRequest<Boolean> {
override fun method(): String = "setWebhook" override fun method(): String = "setWebhook"
override val resultDeserializer: DeserializationStrategy<Boolean> override val resultDeserializer: DeserializationStrategy<Boolean>
get() = BooleanSerializer get() = Boolean.serializer()
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()

View File

@ -1,6 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types package com.github.insanusmokrassar.TelegramBotAPI.types
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.json.JsonPrimitiveSerializer
@Serializable(ChatIdentifierSerializer::class) @Serializable(ChatIdentifierSerializer::class)
sealed class ChatIdentifier sealed class ChatIdentifier
@ -39,20 +40,22 @@ fun String.toUsername(): Username = Username(this)
@Serializer(ChatIdentifier::class) @Serializer(ChatIdentifier::class)
internal object ChatIdentifierSerializer : KSerializer<ChatIdentifier> { internal object ChatIdentifierSerializer : KSerializer<ChatIdentifier> {
override fun deserialize(decoder: Decoder): ChatIdentifier { override fun deserialize(decoder: Decoder): ChatIdentifier {
val id = decoder.decodeString() val id = JsonPrimitiveSerializer.deserialize(decoder)
return id.toLongOrNull() ?.let { return id.longOrNull ?.let {
ChatId(it) ChatId(it)
} ?: if (!id.startsWith("@")) { } ?: id.content.let {
Username("@$id") if (!it.startsWith("@")) {
} else { Username("@$it")
Username(id) } else {
Username(it)
}
} }
} }
override fun serialize(encoder: Encoder, obj: ChatIdentifier) { override fun serialize(encoder: Encoder, value: ChatIdentifier) {
when (obj) { when (value) {
is ChatId -> encoder.encodeLong(obj.chatId) is ChatId -> encoder.encodeLong(value.chatId)
is Username -> encoder.encodeString(obj.username) is Username -> encoder.encodeString(value.username)
} }
} }
} }

View File

@ -3,23 +3,22 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.RawChatMember import com.github.insanusmokrassar.TelegramBotAPI.types.ChatMember.RawChatMember
import com.github.insanusmokrassar.TelegramBotAPI.types.User import com.github.insanusmokrassar.TelegramBotAPI.types.User
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
interface ChatMember { interface ChatMember {
val user: User val user: User
} }
internal object AdministratorChatMemberSerializerWithoutDeserialization : KSerializer<AdministratorChatMember> { internal object AdministratorChatMemberSerializerWithoutDeserialization : KSerializer<AdministratorChatMember> {
override val descriptor: SerialDescriptor = StringDescriptor.withName("ChatMemberSerializerWithoutDeserialization") override val descriptor: SerialDescriptor = ChatMemberDeserializationStrategy.descriptor
override fun deserialize(decoder: Decoder): AdministratorChatMember override fun deserialize(decoder: Decoder): AdministratorChatMember
= ChatMemberDeserializationStrategy.deserialize(decoder) as AdministratorChatMember = ChatMemberDeserializationStrategy.deserialize(decoder) as AdministratorChatMember
override fun serialize(encoder: Encoder, obj: AdministratorChatMember) = throw UnsupportedOperationException() override fun serialize(encoder: Encoder, value: AdministratorChatMember) = throw UnsupportedOperationException()
} }
internal object ChatMemberDeserializationStrategy : DeserializationStrategy<ChatMember> { internal object ChatMemberDeserializationStrategy : DeserializationStrategy<ChatMember> {
override val descriptor: SerialDescriptor = StringDescriptor.withName("ChatMemberDeserializationStrategy") override val descriptor: SerialDescriptor = RawChatMember.serializer().descriptor
override fun deserialize(decoder: Decoder): ChatMember = RawChatMember.serializer().deserialize(decoder).asChatMember override fun deserialize(decoder: Decoder): ChatMember = RawChatMember.serializer().deserialize(decoder).asChatMember
override fun patch(decoder: Decoder, old: ChatMember): ChatMember = throw UpdateNotSupportedException(descriptor.name) override fun patch(decoder: Decoder, old: ChatMember): ChatMember = throw UpdateNotSupportedException("ChatMember")
} }

View File

@ -3,33 +3,32 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQue
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(InlineQueryResult::class) @Serializer(InlineQueryResult::class)
internal object InlineQueryResultSerializer : KSerializer<InlineQueryResult> { internal object InlineQueryResultSerializer : KSerializer<InlineQueryResult> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InlineQueryResult::class.toString()) override val descriptor: SerialDescriptor = SerialDescriptor(InlineQueryResult::class.toString(), PolymorphicKind.OPEN)
override fun serialize(encoder: Encoder, obj: InlineQueryResult) { override fun serialize(encoder: Encoder, value: InlineQueryResult) {
when(obj) { when(value) {
is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, obj) is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, value)
is InlineQueryResultAudioCachedImpl -> InlineQueryResultAudioCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultAudioCachedImpl -> InlineQueryResultAudioCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultAudioImpl -> InlineQueryResultAudioImpl.serializer().serialize(encoder, obj) is InlineQueryResultAudioImpl -> InlineQueryResultAudioImpl.serializer().serialize(encoder, value)
is InlineQueryResultContact -> InlineQueryResultContact.serializer().serialize(encoder, obj) is InlineQueryResultContact -> InlineQueryResultContact.serializer().serialize(encoder, value)
is InlineQueryResultDocumentCachedImpl -> InlineQueryResultDocumentCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultDocumentCachedImpl -> InlineQueryResultDocumentCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultDocumentImpl -> InlineQueryResultDocumentImpl.serializer().serialize(encoder, obj) is InlineQueryResultDocumentImpl -> InlineQueryResultDocumentImpl.serializer().serialize(encoder, value)
is InlineQueryResultGame -> InlineQueryResultGame.serializer().serialize(encoder, obj) is InlineQueryResultGame -> InlineQueryResultGame.serializer().serialize(encoder, value)
is InlineQueryResultGifCachedImpl -> InlineQueryResultGifCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultGifCachedImpl -> InlineQueryResultGifCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultGifImpl -> InlineQueryResultGifImpl.serializer().serialize(encoder, obj) is InlineQueryResultGifImpl -> InlineQueryResultGifImpl.serializer().serialize(encoder, value)
is InlineQueryResultLocation -> InlineQueryResultLocation.serializer().serialize(encoder, obj) is InlineQueryResultLocation -> InlineQueryResultLocation.serializer().serialize(encoder, value)
is InlineQueryResultMpeg4GifCachedImpl -> InlineQueryResultMpeg4GifCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultMpeg4GifCachedImpl -> InlineQueryResultMpeg4GifCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultMpeg4GifImpl -> InlineQueryResultMpeg4GifImpl.serializer().serialize(encoder, obj) is InlineQueryResultMpeg4GifImpl -> InlineQueryResultMpeg4GifImpl.serializer().serialize(encoder, value)
is InlineQueryResultPhotoCachedImpl -> InlineQueryResultPhotoCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultPhotoCachedImpl -> InlineQueryResultPhotoCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultPhotoImpl -> InlineQueryResultPhotoImpl.serializer().serialize(encoder, obj) is InlineQueryResultPhotoImpl -> InlineQueryResultPhotoImpl.serializer().serialize(encoder, value)
is InlineQueryResultStickerCached -> InlineQueryResultStickerCached.serializer().serialize(encoder, obj) is InlineQueryResultStickerCached -> InlineQueryResultStickerCached.serializer().serialize(encoder, value)
is InlineQueryResultVenue -> InlineQueryResultVenue.serializer().serialize(encoder, obj) is InlineQueryResultVenue -> InlineQueryResultVenue.serializer().serialize(encoder, value)
is InlineQueryResultVideoCachedImpl -> InlineQueryResultVideoCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultVideoCachedImpl -> InlineQueryResultVideoCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultVideoImpl -> InlineQueryResultVideoImpl.serializer().serialize(encoder, obj) is InlineQueryResultVideoImpl -> InlineQueryResultVideoImpl.serializer().serialize(encoder, value)
is InlineQueryResultVoiceCachedImpl -> InlineQueryResultVoiceCachedImpl.serializer().serialize(encoder, obj) is InlineQueryResultVoiceCachedImpl -> InlineQueryResultVoiceCachedImpl.serializer().serialize(encoder, value)
is InlineQueryResultVoiceImpl -> InlineQueryResultVoiceImpl.serializer().serialize(encoder, obj) is InlineQueryResultVoiceImpl -> InlineQueryResultVoiceImpl.serializer().serialize(encoder, value)
} }
} }

View File

@ -3,17 +3,16 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMessageContent.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMessageContent.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(InputMessageContent::class) @Serializer(InputMessageContent::class)
internal object InputMessageContentSerializer : KSerializer<InputMessageContent> { internal object InputMessageContentSerializer : KSerializer<InputMessageContent> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMessageContent::class.toString()) override val descriptor: SerialDescriptor = SerialDescriptor(InputMessageContent::class.toString(), PolymorphicKind.OPEN)
override fun serialize(encoder: Encoder, obj: InputMessageContent) { override fun serialize(encoder: Encoder, value: InputMessageContent) {
when (obj) { when (value) {
is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, obj) is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, value)
is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, obj) is InputLocationMessageContent -> InputLocationMessageContent.serializer().serialize(encoder, value)
is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, obj) is InputTextMessageContent -> InputTextMessageContent.serializer().serialize(encoder, value)
is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, obj) is InputVenueMessageContent -> InputVenueMessageContent.serializer().serialize(encoder, value)
else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent") else -> throw IllegalArgumentException("Unknown for serializing InputContactMessageContent")
} }
} }

View File

@ -25,7 +25,7 @@ data class InputMediaPhoto(
} }
@Transient @Transient
override val arguments: Map<String, Any?> = Mapper.mapNullable(serializer(), this) override val arguments: Map<String, Any?> = Properties.storeNullable(serializer(), this)
} }
fun PhotoSize.toInputMediaPhoto( fun PhotoSize.toInputMediaPhoto(

View File

@ -1,19 +1,18 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import kotlinx.serialization.* import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(InputMedia::class) @Serializer(InputMedia::class)
internal object InputMediaSerializer : KSerializer<InputMedia> { internal object InputMediaSerializer : KSerializer<InputMedia> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMedia::class.toString()) override val descriptor: SerialDescriptor = SerialDescriptor(InputMedia::class.toString(), PolymorphicKind.OPEN)
override fun serialize(encoder: Encoder, obj: InputMedia) { override fun serialize(encoder: Encoder, value: InputMedia) {
when (obj) { when (value) {
is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj) is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, value)
is InputMediaAudio -> InputMediaAudio.serializer().serialize(encoder, obj) is InputMediaAudio -> InputMediaAudio.serializer().serialize(encoder, value)
is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, obj) is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, value)
is InputMediaAnimation -> InputMediaAnimation.serializer().serialize(encoder, obj) is InputMediaAnimation -> InputMediaAnimation.serializer().serialize(encoder, value)
is InputMediaDocument -> InputMediaDocument.serializer().serialize(encoder, obj) is InputMediaDocument -> InputMediaDocument.serializer().serialize(encoder, value)
else -> throw IllegalArgumentException("Can't perform and serialize $obj") else -> throw IllegalArgumentException("Can't perform and serialize $value")
} }
} }

Some files were not shown because too many files have changed in this diff Show More