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

add Document InlineQueryResult + a little fixes in audio and voice results

This commit is contained in:
InsanusMokrassar 2019-02-07 13:28:31 +08:00
parent 99c3f9b742
commit 78b63d7b1b
8 changed files with 118 additions and 2 deletions

View File

@ -93,6 +93,9 @@ const val voiceUrlField = "voice_url"
const val voiceFileIdField = "voice_file_id"
const val voiceDurationField = "voice_duration"
const val documentUrlField = "document_url"
const val documentFileIdField = "document_file_id"
const val gameShortNameField = "game_short_name"
const val thumbUrlField = "thumb_url"

View File

@ -0,0 +1,39 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.requests.abstracts.FileId
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocumentCached
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
data class InlineQueryResultDocumentCachedImpl(
@SerialName(idField)
override val id: String,
@SerialName(documentFileIdField)
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
) : InlineQueryResultDocumentCached

View File

@ -0,0 +1,48 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.abstracts.InputMessageContent
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.ParseMode
import com.github.insanusmokrassar.TelegramBotAPI.types.buttons.InlineKeyboardMarkup
import com.github.insanusmokrassar.TelegramBotAPI.types.*
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document.InlineQueryResultDocument
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.video.InlineQueryResultVideo
import com.github.insanusmokrassar.TelegramBotAPI.types.ParseMode.parseModeField
import com.github.insanusmokrassar.TelegramBotAPI.types.files.abstracts.mimeTypeField
import kotlinx.serialization.Optional
import kotlinx.serialization.SerialName
data class InlineQueryResultDocumentImpl(
@SerialName(idField)
override val id: String,
@SerialName(documentUrlField)
override val url: 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(mimeTypeField)
override val mimeType: String? = 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
) : InlineQueryResultDocument

View File

@ -18,7 +18,7 @@ data class InlineQueryResultVideoImpl(
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(mimeTypeField)
override val mimeType: String?,
override val mimeType: String? = null,
@SerialName(videoWidthField)
@Optional
override val width: Int? = null,

View File

@ -0,0 +1,6 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.MimeTyped
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultDocument : InlineQueryResultDocumentCommon, UrlInlineQueryResult, ThumbedInlineQueryResult, ThumbSizedInlineQueryResult, MimeTyped

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultDocumentCached : InlineQueryResultDocumentCommon, WithFileIdInlineQueryResult

View File

@ -0,0 +1,15 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.results.document
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Captioned
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.MimeTyped
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultDocumentCommon : InlineQueryResult,
TitledInlineQueryResult,
DescribedInlineQueryResult,
Captioned,
WithInputMessageContentInlineQueryResult
{
override val type: String
get() = "document"
}

View File

@ -10,5 +10,5 @@ interface InlineQueryResultVoiceCommon : InlineQueryResult,
TitledInlineQueryResult
{
override val type: String
get() = "audio"
get() = "voice"
}