1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

Merge pull request #30 from InsanusMokrassar/0.12.6

0.12.6
This commit is contained in:
InsanusMokrassar 2019-04-13 20:10:18 -05:00 committed by GitHub
commit 0fafd69903
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
119 changed files with 275 additions and 548 deletions

View File

@ -67,6 +67,16 @@ of `]` in links titles
* Now `MediaGroupContent` is `MediaContent`
* All `MedaContent` now have no generics and have basic `TelegramMediaFile` media field
### 0.12.6 Libraries updates
* `kotlin` version `1.3.21` -> `1.3.30`
* `kotlin coroutines` version `1.1.1` -> `1.2.0`
* `kotlin serialization` version `0.10.0` -> `0.11.0`
* `ktor` version `1.1.2` -> `1.1.3`
* Added `DeleteWebhook` request
* All default `startGettingOfUpdates` (in fact - method `start` of `UpdatesPoller`) are suspend and
will try to delete webhook
## 0.11.0
* Kotlin `1.3.11` -> `1.3.21`

View File

@ -12,7 +12,39 @@ solves or unuseful moments are describing by official [Telegram Bot API](https:/
This version compatible with [July 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api#july-26-2018). That means that
most part of API has been implemented (according to last [August 2018 update of TelegramBotAPI](https://core.telegram.org/bots/api#august-27-2018))
except the Passport API which will be included as soon as possible.
except the Passport API which will be included as soon as possible. All included and supported API
can be found on [wiki](https://github.com/InsanusMokrassar/TelegramBotAPI/wiki/Included-API).
## How to implement library?
Common ways to implement this library are presented here. In some cases it will require additional steps
like inserting of additional libraries (like `kotlin stdlib`). In the examples will be used variable
`telegrambotapi.version`, which must be set up by developer. Available versions are presented on
[bintray](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI), next version is last published:
[![Download](https://api.bintray.com/packages/insanusmokrassar/StandardRepository/TelegramBotAPI/images/download.svg) ](https://bintray.com/insanusmokrassar/StandardRepository/TelegramBotAPI/_latestVersion)
### Maven
```xml
<dependency>
<groupId>com.github.insanusmokrassar</groupId>
<artifactId>TelegramBotAPI</artifactId>
<version>${telegrambotapi.version}</version>
</dependency>
```
### Gradle
```groovy
implementation "com.github.insanusmokrassar:TelegramBotAPI:${telegrambotapi.version}"
```
### Gradle (old)
```groovy
compile "com.github.insanusmokrassar:TelegramBotAPI:${telegrambotapi.version}"
```
## How to work with library?

View File

@ -1,4 +1,4 @@
project.version = "0.12.5"
project.version = "0.12.6"
project.group = "com.github.insanusmokrassar"
buildscript {

View File

@ -1,9 +1,9 @@
kotlin.code.style=official
kotlin_version=1.3.21
kotlin_coroutines_version=1.1.1
kotlin_serialisation_runtime_version=0.10.0
kotlin_version=1.3.30
kotlin_coroutines_version=1.2.0
kotlin_serialisation_runtime_version=0.11.0
joda_time_version=2.10.1
ktor_version=1.1.2
ktor_version=1.1.3
gradle_bintray_plugin_version=1.8.4

View File

@ -1,16 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.bot.settings
import kotlinx.serialization.Optional
import kotlinx.serialization.Serializable
@Serializable
data class ProxySettings(
@Optional
val host: String = "localhost",
@Optional
val port: Int = 1080,
@Optional
val username: String? = null,
@Optional
val password: String? = null
)

View File

@ -2,7 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.bot.settings.limiters
import kotlinx.coroutines.*
import kotlinx.coroutines.channels.Channel
import kotlinx.serialization.*
import kotlinx.serialization.Serializable
import kotlinx.serialization.Transient
import java.util.concurrent.Executors
import kotlin.coroutines.*
@ -14,13 +15,9 @@ private object CompleteRequest : RequestEvent()
@Serializable
data class PowLimiter(
@Optional
private val minAwaitTime: Long = 0L,
@Optional
private val maxAwaitTime: Long = 10000L,
@Optional
private val powValue: Double = 4.0,
@Optional
private val powK: Double = 0.0016
) : RequestLimiter {
@Transient

View File

@ -14,7 +14,6 @@ data class ForwardMessage(
@SerialName(messageIdField)
val messageId: MessageIdentifier,
@SerialName(disableNotificationField)
@Optional
val disableNotification: Boolean = false
): SimpleRequest<RawMessage> {
override fun method(): String = "forwardMessage"

View File

@ -4,7 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleReque
import com.github.insanusmokrassar.TelegramBotAPI.types.ALL_UPDATES_LIST
import com.github.insanusmokrassar.TelegramBotAPI.types.UpdateIdentifier
import com.github.insanusmokrassar.TelegramBotAPI.types.update.RawUpdate
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.internal.ArrayListSerializer
@Deprecated("Replaced to other package", ReplaceWith("UPDATE_MESSAGE", "com.github.insanusmokrassar.TelegramBotAPI.types.UPDATE_MESSAGE"))
@ -28,13 +29,9 @@ const val UPDATE_PRE_CHECKOUT_QUERY = com.github.insanusmokrassar.TelegramBotAPI
@Serializable
data class GetUpdates(
@Optional
val offset: UpdateIdentifier? = null,// set `last update id + 1` to receive next part of updates
@Optional
val limit: Int? = null,
@Optional
val timeout: Int? = null,
@Optional
val allowed_updates: List<String>? = ALL_UPDATES_LIST
): SimpleRequest<List<RawUpdate>> {
override fun method(): String = "getUpdates"

View File

@ -2,8 +2,10 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts
import com.github.insanusmokrassar.TelegramBotAPI.utils.StorageFile
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
import java.io.File
@Serializable(InputFileSerializer::class)
sealed class InputFile {
abstract val fileId: String
}
@ -12,16 +14,17 @@ sealed class InputFile {
/**
* Contains file id or file url
*/
@Serializable(FileIdSerializer::class)
@Serializable(InputFileSerializer::class)
data class FileId(
override val fileId: String
) : InputFile()
fun String.toInputFile(): InputFile = FileId(this)
@Serializer(FileId::class)
object FileIdSerializer : KSerializer<FileId> {
override fun serialize(encoder: Encoder, obj: FileId) = encoder.encodeString(obj.fileId)
@Serializer(InputFile::class)
object InputFileSerializer : KSerializer<InputFile> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(FileId::class.toString())
override fun serialize(encoder: Encoder, obj: InputFile) = encoder.encodeString(obj.fileId)
override fun deserialize(decoder: Decoder): FileId = FileId(decoder.decodeString())
}
@ -29,7 +32,7 @@ object FileIdSerializer : KSerializer<FileId> {
/**
* Contains info about file for sending
*/
@Serializable
@Serializable(InputFileSerializer::class)
data class MultipartFile (
val file: StorageFile,
val mimeType: String = file.contentType,

View File

@ -11,16 +11,12 @@ data class AnswerCallbackQuery(
@SerialName(callbackQueryIdField)
val callbackQueryId: CallbackQueryIdentifier,
@SerialName(textField)
@Optional
val text: String? = null,
@SerialName(showAlertField)
@Optional
val showAlert: Boolean? = null,
@SerialName(urlField)
@Optional
val url: String? = null,
@SerialName(cachedTimeField)
@Optional
val cachedTimeSeconds: Int? = null
) : SimpleRequest<Boolean> {
override fun method(): String = "answerCallbackQuery"

View File

@ -17,19 +17,14 @@ data class AnswerInlineQuery(
@SerialName(resultsField)
val results: List<InlineQueryResult> = emptyList(),
@SerialName(cachedTimeField)
@Optional
val cachedTime: Int? = null,
@SerialName(isPersonalField)
@Optional
val isPersonal: Boolean? = null,
@SerialName(nextOffsetField)
@Optional
val nextOffset: String? = null,
@SerialName(switchPmTextField)
@Optional
val switchPmText: String? = null,
@SerialName(switchPmParameterField)
@Optional
val switchPmParameter: String? = null
): SimpleRequest<Boolean> {
override fun method(): String = "answerInlineQuery"

View File

@ -13,7 +13,6 @@ data class KickChatMember(
@SerialName(userIdField)
override val userId: UserId,
@SerialName(untilDateField)
@Optional
override val untilDate: TelegramDate? = null
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "kickChatMember"

View File

@ -13,31 +13,22 @@ data class PromoteChatMember(
@SerialName(userIdField)
override val userId: UserId,
@SerialName(untilDateField)
@Optional
override val untilDate: TelegramDate? = null,
@SerialName(canChangeInfoField)
@Optional
private val canChangeInfo: Boolean? = null,
@SerialName(canPostMessagesField)
@Optional
private val canPostMessages: Boolean? = null,
@SerialName(canEditMessagesField)
@Optional
private val canEditMessages: Boolean? = null,
@SerialName(canDeleteMessagesField)
@Optional
private val canDeleteMessages: Boolean? = null,
@SerialName(canInviteUsersField)
@Optional
private val canInviteUsers: Boolean? = null,
@SerialName(canRestrictMembersField)
@Optional
private val canRestrictMembers: Boolean? = null,
@SerialName(canPinMessagesField)
@Optional
private val canPinMessages: Boolean? = null,
@SerialName(canPromoteMembersField)
@Optional
private val canPromoteMembers: Boolean? = null
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "promoteChatMember"

View File

@ -13,19 +13,14 @@ data class RestrictChatMember(
@SerialName(userIdField)
override val userId: UserId,
@SerialName(untilDateField)
@Optional
override val untilDate: TelegramDate? = null,
@SerialName(canSendMessagesField)
@Optional
private val canSendMessages: Boolean? = null,
@SerialName(canSendMediaMessagesField)
@Optional
private val canSendMediaMessages: Boolean? = null,
@SerialName(canSendOtherMessagesField)
@Optional
private val canSendOtherMessages: Boolean? = null,
@SerialName(canAddWebPagePreviewsField)
@Optional
private val canAddWebPagePreviews: Boolean? = null
) : ChatMemberRequest<Boolean>, UntilDate {
override fun method(): String = "restrictChatMember"

View File

@ -14,7 +14,6 @@ data class PinChatMessage (
@SerialName(messageIdField)
val messageId: MessageIdentifier,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false
): ChatRequest, SimpleRequest<Boolean>, DisableNotification {
override fun method(): String = "pinChatMessage"

View File

@ -13,11 +13,10 @@ import kotlinx.serialization.json.JsonObject
data class SetChatPhoto (
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@Transient
val photo: MultipartFile = throw IllegalArgumentException("Unfortunately, this type of objects can't be parsed automatically")
): ChatRequest, MultipartRequest<Boolean> {
override fun method(): String = "setChatPhoto"
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
override val mediaMap: Map<String, MultipartFile> = mapOf(photoField to photo)
override val paramsJson: JsonObject = this.toJson(serializer())
override val paramsJson: JsonObject = toJson(serializer())
}

View File

@ -17,7 +17,6 @@ data class EditChatMessageLiveLocation(
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditReplyMessage, EditLocationMessage {
override fun method(): String = "editMessageLiveLocation"

View File

@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.edit.LiveLocation
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class EditInlineMessageLiveLocation(
@ -14,7 +15,6 @@ data class EditInlineMessageLiveLocation(
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage, EditLocationMessage {
override fun method(): String = "editMessageLiveLocation"

View File

@ -14,7 +14,6 @@ data class StopChatMessageLiveLocation(
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditReplyMessage {
override fun method(): String = "stopMessageLiveLocation"

View File

@ -4,14 +4,14 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditIn
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class StopInlineMessageLiveLocation(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = "stopMessageLiveLocation"

View File

@ -16,7 +16,6 @@ data class EditChatMessageReplyMarkup(
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditReplyMessage {

View File

@ -4,14 +4,14 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditIn
import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.EditReplyMessage
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class EditInlineMessageReplyMarkup(
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage {
override fun method(): String = editMessageReplyMarkupMethod

View File

@ -19,10 +19,8 @@ data class EditChatMessageCaption(
@SerialName(captionField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditTextChatMessage, EditReplyMessage {

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class EditInlineMessageCaption(
@ -14,10 +15,8 @@ data class EditInlineMessageCaption(
@SerialName(captionField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage {
override fun method(): String = editMessageCaptionMethod

View File

@ -19,7 +19,6 @@ data class EditChatMessageMedia(
@SerialName(mediaField)
override val media: InputMedia,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditReplyMessage, EditMediaMessage {

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.edit.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia.InputMedia
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class EditInlineMessageMedia(
@ -14,7 +15,6 @@ data class EditInlineMessageMedia(
@SerialName(mediaField)
override val media: InputMedia,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditReplyMessage, EditMediaMessage {

View File

@ -19,13 +19,10 @@ data class EditChatMessageText(
@SerialName(textField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableWebPagePreviewField)
@Optional
override val disableWebPagePreview: Boolean? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditChatMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {

View File

@ -6,7 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class EditInlineMessageText(
@ -15,13 +16,10 @@ data class EditInlineMessageText(
@SerialName(textField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableWebPagePreviewField)
@Optional
override val disableWebPagePreview: Boolean? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : EditInlineMessage, EditTextChatMessage, EditReplyMessage, EditDisableWebPagePreviewMessage {
override fun method(): String = editMessageMediaMethod

View File

@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByMessageId
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class SetGameScoreByChatId (
@ -16,9 +17,7 @@ data class SetGameScoreByChatId (
@SerialName(messageIdField)
override val messageId: MessageIdentifier,
@SerialName(forceField)
@Optional
override val force: Boolean = false,
@SerialName(disableEditMessageField)
@Optional
override val disableEditMessage: Boolean = false
) : SetGameScore, ByMessageId

View File

@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.requests.games
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.types.ByInlineMessageId
import com.github.insanusmokrassar.TelegramBotAPI.requests.games.abstracts.SetGameScore
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class SetGameScoreByInlineMessageId (
@ -14,9 +15,7 @@ data class SetGameScoreByInlineMessageId (
@SerialName(inlineMessageIdField)
override val inlineMessageId: InlineMessageIdentifier,
@SerialName(forceField)
@Optional
override val force: Boolean = false,
@SerialName(disableEditMessageField)
@Optional
override val disableEditMessage: Boolean = false
) : SetGameScore, ByInlineMessageId

View File

@ -16,16 +16,12 @@ data class SendContact(
@SerialName(firstNameField)
val firstName: String,
@SerialName(lastNameField)
@Optional
val lastName: String? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
ReplyingMarkupSendMessageRequest<RawMessage>

View File

@ -16,16 +16,12 @@ data class SendLocation(
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(livePeriodField)
@Optional
val livePeriod: Long? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
ReplyingMarkupSendMessageRequest<RawMessage>,

View File

@ -16,19 +16,14 @@ data class SendMessage(
@SerialName(textField)
override val text: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableWebPagePreviewField)
@Optional
override val disableWebPagePreview: Boolean? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
ReplyingMarkupSendMessageRequest<RawMessage>,

View File

@ -19,16 +19,12 @@ data class SendVenue(
@SerialName(addressField)
val address: String,
@SerialName(foursquareIdField)
@Optional
val foursquareId: String? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
PositionedSendMessageRequest<RawMessage>,

View File

@ -14,13 +14,10 @@ data class SendGame (
@SerialName(gameShortNameField)
val gameShortName: String,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>,
ReplyMarkup {

View File

@ -58,34 +58,24 @@ data class SendAnimationData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(animationField)
@Optional
val animation: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(durationField)
@Optional
override val duration: Long? = null,
@SerialName(widthField)
@Optional
override val width: Int? = null,
@SerialName(heightField)
@Optional
override val height: Int? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -59,34 +59,24 @@ data class SendAudioData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(audioField)
@Optional
val audio: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(durationField)
@Optional
override val duration: Long? = null,
@SerialName(performerField)
@Optional
override val performer: String? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -52,25 +52,18 @@ data class SendDocumentData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(documentField)
@Optional
val document: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -61,10 +61,8 @@ data class SendMediaGroupData internal constructor(
@Transient
val media: List<MediaGroupMemberInputMedia> = emptyList(),
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null
) : DataRequest<List<RawMessage>>,
SendMessageRequest<List<RawMessage>>

View File

@ -41,22 +41,16 @@ data class SendPhotoData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(photoField)
@Optional
val photo: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -34,16 +34,12 @@ data class SendStickerByFileId internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(stickerField)
@Optional
val sticker: FileId? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<RawMessage>, ReplyingMarkupSendMessageRequest<RawMessage> {
override fun method(): String = "sendSticker"

View File

@ -60,37 +60,26 @@ data class SendVideoData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(videoField)
@Optional
val video: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(durationField)
@Optional
override val duration: Long? = null,
@SerialName(widthField)
@Optional
override val width: Int? = null,
@SerialName(heightField)
@Optional
override val height: Int? = null,
@SerialName(supportStreamingField)
@Optional
val supportStreaming: Boolean? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -56,31 +56,22 @@ data class SendVideoNoteData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(videoNoteField)
@Optional
val videoNote: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(durationField)
@Optional
override val duration: Long? = null,
@SerialName(lengthField)
@Optional
override val width: Int? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -54,28 +54,20 @@ data class SendVoiceData internal constructor(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(voiceField)
@Optional
val voice: String? = null,
@SerialName(thumbField)
@Optional
override val thumb: String? = null,
@SerialName(captionField)
@Optional
override val text: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(durationField)
@Optional
override val duration: Long? = null,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<RawMessage>,
SendMessageRequest<RawMessage>,

View File

@ -9,7 +9,6 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPrice
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.LabeledPricesSerializer
import com.github.insanusmokrassar.TelegramBotAPI.types.payments.abstracts.*
import kotlinx.serialization.*
import kotlinx.serialization.Optional
import java.util.*
/**
@ -36,37 +35,26 @@ data class SendInvoice(
@SerialName(pricesField)
override val prices: List<LabeledPrice>,
@SerialName(providerDataField)
@Optional
val providerData: String? = null,
@SerialName(requireNameField)
@Optional
val requireName: Boolean = false,
@SerialName(requirePhoneNumberField)
@Optional
val requirePhoneNumber: Boolean = false,
@SerialName(requireEmailField)
@Optional
val requireEmail: Boolean = false,
@SerialName(requireShippingAddressField)
@Optional
val requireShippingAddress: Boolean = false,
@SerialName(shouldSendPhoneNumberToProviderField)
@Optional
val shouldSendPhoneNumberToProvider: Boolean = false,
@SerialName(shouldSendEmailToProviderField)
@Optional
val shouldSendEmailToProvider: Boolean = false,
@SerialName(priceDependOnShipAddressField)
@Optional
val priceDependOnShipAddress: Boolean = false,
@SerialName(disableNotificationField)
@Optional
override val disableNotification: Boolean = false,
@SerialName(replyToMessageIdField)
@Optional
override val replyToMessageId: MessageIdentifier? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null
) : Currencied,
Priced,

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipar
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun AddStickerToSet(
userId: UserId,
@ -33,10 +34,8 @@ data class AddStickerToSet internal constructor(
@SerialName(emojisField)
override val emojis: String,
@SerialName(pngStickerField)
@Optional
val sticker: FileId? = null,
@SerialName(maskPositionField)
@Optional
override val maskPosition: MaskPosition? = null
) : StickerSetAction {
init {

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.common.CommonMultipar
import com.github.insanusmokrassar.TelegramBotAPI.requests.stickers.abstracts.StickerSetAction
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.stickers.MaskPosition
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
fun CreateNewStickerSet(
userId: UserId,
@ -34,13 +35,10 @@ data class CreateNewStickerSet internal constructor(
@SerialName(emojisField)
override val emojis: String,
@SerialName(pngStickerField)
@Optional
val sticker: FileId? = null,
@SerialName(containsMasksField)
@Optional
val containsMasks: Boolean? = null,
@SerialName(maskPositionField)
@Optional
override val maskPosition: MaskPosition? = null
) : StickerSetAction {
init {

View File

@ -0,0 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.requests.webhook
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.SimpleRequest
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.internal.BooleanSerializer
@Serializable
class DeleteWebhook : SimpleRequest<Boolean> {
override fun method(): String = "deleteWebhook"
override fun resultSerializer(): KSerializer<Boolean> = BooleanSerializer
}

View File

@ -44,13 +44,10 @@ data class SetWebhook internal constructor(
@SerialName(urlField)
val url: String,
@SerialName(certificateField)
@Optional
val certificateFile: String? = null,
@SerialName(maxAllowedConnectionsField)
@Optional
val maxAllowedConnections: Int? = null,
@SerialName(allowedUpdatesField)
@Optional
val allowedUpdates: List<String>? = null
) : DataRequest<Boolean> {
override fun method(): String = "setWebhook"

View File

@ -10,17 +10,13 @@ data class RawCallbackQuery(
val id: CallbackQueryIdentifier,
@SerialName(fromField)
val from: User,
@Optional
val message: RawMessage? = null,
@SerialName(inlineMessageIdField)
@Optional
val inlineMessageId: InlineMessageIdentifier? = null,
@SerialName("chat_instance")
val chatInstance: String,
@Optional
val data: String? = null,
@SerialName("game_short_name")
@Optional
val gameShortName: String? = null
) {
@Transient

View File

@ -7,46 +7,32 @@ import kotlinx.serialization.*
data class RawChatMember(
val user: User,
private val status: String,
@Optional
private val until_date: TelegramDate? = null,
@SerialName(canBeEditedField)
@Optional
private val canBeEdited: Boolean = false,
@SerialName(canChangeInfoField)
@Optional
private val canChangeInfo: Boolean = false,
@SerialName(canPostMessagesField)
@Optional
private val canPostMessages: Boolean = false,
@SerialName(canEditMessagesField)
@Optional
private val canEditMessages: Boolean = false,
@SerialName(canDeleteMessagesField)
@Optional
private val canDeleteMessages: Boolean = false,
@SerialName(canInviteUsersField)
@Optional
private val canInviteUsers: Boolean = false,
@SerialName(canRestrictMembersField)
@Optional
private val canRestrictMembers: Boolean = false,
@SerialName(canPinMessagesField)
@Optional
private val canPinMessages: Boolean = false,
@SerialName(canPromoteMembersField)
@Optional
private val canPromoteMembers: Boolean = false,
@SerialName(canSendMessagesField)
@Optional
private val canSendMessages: Boolean = false,
@SerialName(canSendMediaMessagesField)
@Optional
private val canSendMediaMessages: Boolean = false,
@SerialName(canSendOtherMessagesField)
@Optional
private val canSendOtherMessages: Boolean = false,
@SerialName(canAddWebPagePreviewsField)
@Optional
private val canAddWebPagePreviews: Boolean = false
) {
@Transient

View File

@ -184,7 +184,7 @@ const val certificateField = "certificate"
const val pointField = "point"
const val xShiftField = "x_shift"
const val yShiftField = "y_shift"
const val scaleField = "y_shift"
const val scaleField = "scale"
const val currencyField = "currency"

View File

@ -1,7 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonContactData
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class Contact(
@ -10,12 +11,9 @@ data class Contact(
@SerialName(firstNameField)
override val firstName: String,
@SerialName(lastNameField)
@Optional
override val lastName: String? = null,
@SerialName(userIdField)
@Optional
val userId: UserId? = null,
@SerialName(vcardField)
@Optional
override val vcard: String? = null
) : CommonContactData

View File

@ -13,10 +13,8 @@ data class RawChosenInlineResult(
@SerialName(queryField)
val query: String,
@SerialName(locationField)
@Optional
val location: Location? = null,
@SerialName(inlineMessageIdField)
@Optional
val inlineMessageId: InlineMessageIdentifier? = null
) {
@Transient

View File

@ -4,7 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
class InlineQueryResultArticle(
@ -15,25 +16,18 @@ class InlineQueryResultArticle(
@SerialName(inputMessageContentField)
override val inputMessageContent: InputMessageContent,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(urlField)
@Optional
override val url: String? = null,
@SerialName(hideUrlField)
@Optional
val hideUrl: Boolean? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
@Optional
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null
) : InlineQueryResult,
ThumbSizedInlineQueryResult,

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioCachedImpl(
@ -17,16 +18,12 @@ data class InlineQueryResultAudioCachedImpl(
@SerialName(audioFileIdField)
override val fileId: FileId,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultAudioCached {
override val type: String = inlineQueryResultAudioType

View File

@ -7,7 +7,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultAudioImpl(
@ -18,22 +19,16 @@ data class InlineQueryResultAudioImpl(
@SerialName(titleField)
override val title: String,
@SerialName(performerField)
@Optional
override val performer: String? = null,
@SerialName(audioDurationField)
@Optional
override val duration: Int? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultAudio {
override val type: String = inlineQueryResultAudioType

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultContact(
@ -16,25 +17,18 @@ data class InlineQueryResultContact(
@SerialName(firstNameField)
override val firstName: String,
@SerialName(lastNameField)
@Optional
override val lastName: String? = null,
@SerialName(vcardField)
@Optional
override val vcard: String? = null,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
@Optional
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResult,
CommonContactData,

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentCachedImpl(
@ -19,19 +20,14 @@ data class InlineQueryResultDocumentCachedImpl(
@SerialName(titleField)
override val title: String,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultDocumentCached {
override val type: String = inlineQueryResultDocumentType

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultDocumentImpl(
@ -21,28 +22,20 @@ data class InlineQueryResultDocumentImpl(
@SerialName(mimeTypeField)
override val mimeType: String,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
@Optional
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultDocument {
override val type: String = inlineQueryResultDocumentType

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifCachedImpl(
@ -17,19 +18,14 @@ data class InlineQueryResultGifCachedImpl(
@SerialName(gifFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultGifCached {
override val type: String = inlineQueryResultGifType

View File

@ -7,7 +7,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultGifImpl(
@ -18,28 +19,20 @@ data class InlineQueryResultGifImpl(
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(gifWidthField)
@Optional
override val width: Int? = null,
@SerialName(gifHeightField)
@Optional
override val height: Int? = null,
@SerialName(gifDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultGif {
override val type: String = inlineQueryResultGifType

View File

@ -6,7 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultLocation(
@ -19,22 +20,16 @@ data class InlineQueryResultLocation(
@SerialName(titleField)
override val title: String,
@SerialName(livePeriodField)
@Optional
override val livePeriod: Int? = null,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
@Optional
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResult,
Locationed,

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifCachedImpl(
@ -17,19 +18,14 @@ data class InlineQueryResultMpeg4GifCachedImpl(
@SerialName(mpeg4GifFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultMpeg4GifCached {
override val type: String = inlineQueryResultMpeg4GifType

View File

@ -7,7 +7,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultMpeg4GifImpl(
@ -18,28 +19,20 @@ data class InlineQueryResultMpeg4GifImpl(
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(mpeg4GifWidthField)
@Optional
override val width: Int? = null,
@SerialName(mpeg4GifHeightField)
@Optional
override val height: Int? = null,
@SerialName(mpeg4GifDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultMpeg4Gif {
override val type: String = inlineQueryResultMpeg4GifType

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultPhotoCachedImpl(
@ -17,22 +18,16 @@ data class InlineQueryResultPhotoCachedImpl(
@SerialName(photoFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultPhotoCached {
override val type: String = inlineQueryResultPhotoType

View File

@ -7,7 +7,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultPhotoImpl(
@ -18,28 +19,20 @@ data class InlineQueryResultPhotoImpl(
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(photoWidthField)
@Optional
override val width: Int? = null,
@SerialName(photoHeightField)
@Optional
override val height: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultPhoto {
override val type: String = inlineQueryResultPhotoType

View File

@ -5,7 +5,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultStickerCached(
@ -14,10 +15,8 @@ data class InlineQueryResultStickerCached(
@SerialName(stickerFileIdField)
override val fileId: FileId,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResult, WithInputMessageContentInlineQueryResult, WithFileIdInlineQueryResult {
override val type: String = "sticker"

View File

@ -6,7 +6,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVenue(
@ -21,25 +22,18 @@ data class InlineQueryResultVenue(
@SerialName(addressField)
override val address: String,
@SerialName(foursquareIdField)
@Optional
override val foursquareId: String? = null,
@SerialName(foursquareTypeField)
@Optional
override val foursquareType: String? = null,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
@Optional
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResult,
Locationed,

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoCachedImpl(
@ -19,19 +20,14 @@ data class InlineQueryResultVideoCachedImpl(
@SerialName(titleField)
override val title: String,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultVideoCached {
override val type: String = inlineQueryResultVideoType

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVideoImpl(
@ -23,28 +24,20 @@ data class InlineQueryResultVideoImpl(
@SerialName(titleField)
override val title: String,
@SerialName(videoWidthField)
@Optional
override val width: Int? = null,
@SerialName(videoHeightField)
@Optional
override val height: Int? = null,
@SerialName(videoDurationField)
@Optional
override val duration: Int? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultVideo {
override val type: String = inlineQueryResultVideoType

View File

@ -8,7 +8,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceCachedImpl(
@ -19,16 +20,12 @@ data class InlineQueryResultVoiceCachedImpl(
@SerialName(titleField)
override val title: String,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultVoiceCached {
override val type: String = inlineQueryResultVoiceType

View File

@ -7,7 +7,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InlineQueryResultVoiceImpl(
@ -18,19 +19,14 @@ data class InlineQueryResultVoiceImpl(
@SerialName(titleField)
override val title: String,
@SerialName(voiceDurationField)
@Optional
override val duration: Int? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)
@Optional
override val inputMessageContent: InputMessageContent? = null
) : InlineQueryResultVoice {
override val type: String = inlineQueryResultVoiceType

View File

@ -3,11 +3,12 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQue
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.InlineQueryResult
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
import sun.reflect.generics.reflectiveObjects.NotImplementedException
@Serializer(InlineQueryResult::class)
object InlineQueryResultSerializer :
KSerializer<InlineQueryResult> {
object InlineQueryResultSerializer : KSerializer<InlineQueryResult> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InlineQueryResult::class.toString())
override fun serialize(encoder: Encoder, obj: InlineQueryResult) {
when(obj) {
is InlineQueryResultArticle -> InlineQueryResultArticle.serializer().serialize(encoder, obj)

View File

@ -3,7 +3,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMess
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonContactData
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InputContactMessageContent(
@ -12,9 +13,7 @@ data class InputContactMessageContent(
@SerialName(firstNameField)
override val firstName: String,
@SerialName(lastNameField)
@Optional
override val lastName: String? = null,
@SerialName(vcardField)
@Optional
override val vcard: String? = null
) : CommonContactData, InputMessageContent

View File

@ -4,7 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Livable
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Locationed
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InputLocationMessageContent(
@ -13,6 +14,5 @@ data class InputLocationMessageContent(
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(livePeriodField)
@Optional
override val livePeriod: Int? = null
) : Locationed, Livable, InputMessageContent

View File

@ -7,16 +7,15 @@ import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.disableWebPagePreviewField
import com.github.insanusmokrassar.TelegramBotAPI.types.messageTextField
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InputTextMessageContent(
@SerialName(messageTextField)
override val caption: String,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@SerialName(disableWebPagePreviewField)
@Optional
override val disableWebPagePreview: Boolean? = null
) : Captioned, DisableWebPagePreview, InputMessageContent

View File

@ -4,7 +4,8 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonVenueDat
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Locationed
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InputVenueMessageContent(
@ -17,9 +18,7 @@ data class InputVenueMessageContent(
@SerialName(addressField)
override val address: String,
@SerialName(foursquareIdField)
@Optional
override val foursquareId: String? = null,
@SerialName(foursquareTypeField)
@Optional
override val foursquareType: String? = null
) : Locationed, CommonVenueData, InputMessageContent

View File

@ -3,9 +3,11 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InputMessageContent.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(InputMessageContent::class)
object InputMessageContentSerializer : KSerializer<InputMessageContent> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMessageContent::class.toString())
override fun serialize(encoder: Encoder, obj: InputMessageContent) {
when (obj) {
is InputContactMessageContent -> InputContactMessageContent.serializer().serialize(encoder, obj)

View File

@ -14,7 +14,6 @@ data class RawInlineQuery(
@SerialName(offsetField)
val offset: String,
@SerialName(locationField)
@Optional
val location: Location? = null
) {
@Transient

View File

@ -10,16 +10,11 @@ import kotlinx.serialization.*
data class InputMediaAnimation(
@Transient
override val file: InputFile = throw IllegalStateException("Must be created with file"),
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@Optional
override val width: Int? = null,
@Optional
override val height: Int? = null,
@Optional
override val duration: Long? = null,
@Transient
override val thumb: InputFile? = null

View File

@ -5,22 +5,17 @@ import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.*
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.mediaField
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class InputMediaAudio(
@Transient
override val file: InputFile = throw IllegalStateException("Must be created with file"),
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@Optional
override val duration: Long? = null,
@Optional
override val performer: String? = null,
@Optional
override val title: String? = null,
override val thumb: InputFile? = null
) : InputMedia, DuratedInputMedia, ThumbedInputMedia, TitledInputMedia, CaptionedInputMedia, Performerable {

View File

@ -10,10 +10,8 @@ import kotlinx.serialization.*
data class InputMediaDocument(
@Transient
override val file: InputFile = throw IllegalStateException("Must be created with file"),
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@Transient
override val thumb: InputFile? = null

View File

@ -11,10 +11,8 @@ import kotlinx.serialization.*
data class InputMediaPhoto(
@Transient
override val file: InputFile = throw IllegalStateException("Must be created with file"),
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null
) : InputMedia, CaptionedInputMedia, MediaGroupMemberInputMedia {
override val type: String = "photo"

View File

@ -1,9 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(InputMedia::class)
object InputMediaSerializer : KSerializer<InputMedia> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(InputMedia::class.toString())
override fun serialize(encoder: Encoder, obj: InputMedia) {
when (obj) {
is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj)

View File

@ -10,16 +10,11 @@ import kotlinx.serialization.*
data class InputMediaVideo(
@Transient
override val file: InputFile = throw IllegalStateException("Must be created with file"),
@Optional
override val caption: String? = null,
@SerialName(parseModeField)
@Optional
override val parseMode: ParseMode? = null,
@Optional
override val width: Int? = null,
@Optional
override val height: Int? = null,
@Optional
override val duration: Long? = null,
@Transient
override val thumb: InputFile? = null

View File

@ -1,13 +1,19 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InputMedia
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(MediaGroupMemberInputMedia::class)
object MediaGroupMemberInputMediaSerializer : KSerializer<MediaGroupMemberInputMedia> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(MediaGroupMemberInputMedia::class.toString())
override fun serialize(encoder: Encoder, obj: MediaGroupMemberInputMedia) {
when (obj) {
is InputMediaPhoto -> InputMediaPhoto.serializer().serialize(encoder, obj)
is InputMediaVideo -> InputMediaVideo.serializer().serialize(encoder, obj)
}
}
override fun deserialize(decoder: Decoder): MediaGroupMemberInputMedia {
TODO("not implemented")
}
}

View File

@ -1,7 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.MessageEntity
import com.github.insanusmokrassar.TelegramBotAPI.types.User
import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.Serializable
import kotlinx.serialization.internal.ArrayListSerializer
@Serializable
@ -9,9 +10,7 @@ data class RawMessageEntity(
val type: String,
val offset: Int,
val length: Int,
@Optional
val url: String? = null,
@Optional
val user: User? = null
) {
fun asMessageEntity(source: String): MessageEntity {

View File

@ -1,6 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.types
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Deprecated(
"Deprecated because incorrect name",
@ -11,13 +12,9 @@ typealias ResponseParameters<T> = Response<T>
@Serializable
data class Response<T : Any>(
val ok: Boolean = false,
@Optional
val description: String? = null,
@SerialName("error_code")
@Optional
val errorCode: Int? = null,
@Optional
val result: T? = null,
@Optional
val parameters: ResponseParametersRaw? = null
)

View File

@ -5,10 +5,8 @@ import kotlinx.serialization.*
@Serializable
data class ResponseParametersRaw(
@SerialName("migrate_to_chat_id")
@Optional
private val migrateToChatId: ChatId? = null,
@SerialName("retry_after")
@Optional
private val retryAfter: Long? = null
) {
@Transient

View File

@ -1,25 +1,20 @@
package com.github.insanusmokrassar.TelegramBotAPI.types
import kotlinx.serialization.*
import kotlinx.serialization.Optional
import java.util.*
@Serializable
data class User(
val id: ChatId,
@SerialName(isBotField)
@Optional
val isBot: Boolean = false,
@SerialName(firstNameField)
val firstName: String,
@SerialName(lastNameField)
@Optional
val lastName: String? = null,
@SerialName(usernameField)
@Optional
val username: Username? = null,
@SerialName(languageCodeField)
@Optional
private val languageCode: String? = null
) {
@Transient

View File

@ -1,7 +1,8 @@
package com.github.insanusmokrassar.TelegramBotAPI.types
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.CommonVenueData
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class Venue(
@ -12,9 +13,7 @@ data class Venue(
@SerialName(addressField)
override val address: String,
@SerialName(foursquareIdField)
@Optional
override val foursquareId: String? = null,
@SerialName(foursquareTypeField)
@Optional
override val foursquareType: String? = null
) : CommonVenueData

View File

@ -9,19 +9,14 @@ data class WebhookInfo(
@SerialName(pendingUpdateCountField)
val awaitDeliery: Int,
@SerialName(maxAllowedConnectionsField)
@Optional
val maxConnections: Int = 40, // default count according to documentation
@SerialName(hasCustomCertificateField)
@Optional
val customCertificate: Boolean = false,
@SerialName(allowedUpdatesField)
@Optional
val allowedUpdates: List<String> = ALL_UPDATES_LIST,
@SerialName(lastErrorDateField)
@Optional
val lastErrorDate: TelegramDate? = null,
@SerialName(lastErrorMessageField)
@Optional
val lastErrorMessage: String? = null
) {
@Transient

View File

@ -1,10 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ForceReply(
@Optional
val selective: Boolean? = null
) : KeyboardMarkup {
@SerialName("force_reply")

View File

@ -1,14 +1,13 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class KeyboardButton(
val text: String,
@SerialName("request_contact")
@Optional
val requestContact: Boolean? = null,
@SerialName("request_location")
@Optional
val requestLocation: Boolean? = null
)

View File

@ -1,9 +1,11 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons
import kotlinx.serialization.*
import kotlinx.serialization.internal.StringDescriptor
@Serializer(KeyboardMarkup::class)
object KeyboardMarkupSerializer : KSerializer<KeyboardMarkup> {
override val descriptor: SerialDescriptor = StringDescriptor.withName(KeyboardMarkup::class.toString())
override fun serialize(encoder: Encoder, obj: KeyboardMarkup) {
when(obj) {
is ForceReply -> ForceReply.serializer().serialize(encoder, obj)
@ -12,4 +14,8 @@ object KeyboardMarkupSerializer : KSerializer<KeyboardMarkup> {
is ReplyKeyboardRemove -> ReplyKeyboardRemove.serializer().serialize(encoder, obj)
}
}
override fun deserialize(decoder: Decoder): KeyboardMarkup {
TODO("not implemented")
}
}

View File

@ -1,16 +1,14 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ReplyKeyboardMarkup(
val keyboard: Matrix<KeyboardButton>,
@SerialName("resize_keyboard")
@Optional
val resizeKeyboard: Boolean? = null,
@SerialName("one_time_keyboard")
@Optional
val oneTimeKeyboard: Boolean? = null,
@Optional
val selective: Boolean? = null
) : KeyboardMarkup

View File

@ -1,10 +1,10 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.buttons
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class ReplyKeyboardRemove(
@Optional
val selective: Boolean? = null
) : KeyboardMarkup {
@SerialName("remove_keyboard")

View File

@ -2,24 +2,25 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.chat
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.message.RawMessage
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class RawChat(
override val id: ChatId,
private val type: String,
@Optional private val title: String? = null,
@Optional private val username: Username? = null,
@Optional private val first_name: String? = null,
@Optional private val last_name: String? = null,
@Optional private val all_members_are_administrators: Boolean? = null,
@Optional private val description: String? = null,
@Optional private val invite_link: String? = null,
@Optional private val pinned_message: RawMessage? = null,
@Optional private val sticker_set_name: String? = null,
@Optional private val can_set_sticker_set: Boolean? = null,
private val title: String? = null,
private val username: Username? = null,
private val first_name: String? = null,
private val last_name: String? = null,
private val all_members_are_administrators: Boolean? = null,
private val description: String? = null,
private val invite_link: String? = null,
private val pinned_message: RawMessage? = null,
private val sticker_set_name: String? = null,
private val can_set_sticker_set: Boolean? = null,
@SerialName("photo")
@Optional override val chatPhoto: ChatPhoto? = null
override val chatPhoto: ChatPhoto? = null
) : Chat {
fun extractChat(): Chat {
return when (type) {

View File

@ -2,7 +2,8 @@ package com.github.insanusmokrassar.TelegramBotAPI.types.files
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.*
import kotlinx.serialization.*
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
@Serializable
data class AnimationFile(
@ -10,17 +11,12 @@ data class AnimationFile(
override val fileId: FileId,
override val width: Int,
override val height: Int,
@Optional
override val duration: Long? = null,
@Optional
override val thumb: PhotoSize? = null,
@SerialName(fileNameField)
@Optional
override val fileName: String? = null,
@SerialName(mimeTypeField)
@Optional
override val mimeType: String? = null,
@SerialName(fileSizeField)
@Optional
override val fileSize: Long? = null
) : TelegramMediaFile, MimedMediaFile, ThumbedMediaFile, PlayableMediaFile, CustomNamedMediaFile, SizedMediaFile

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