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

add Venue InlineQueryResult + fix titles in all results

This commit is contained in:
InsanusMokrassar 2019-02-07 13:55:29 +08:00
parent 8369114d26
commit 1963432bc8
16 changed files with 82 additions and 31 deletions

View File

@ -1,7 +1,7 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
interface CommonVenueData {
val title: String
interface CommonVenueData : Titled {
override val title: String
val address: String
val foursquareId: String?
val foursquareType: String? // TODO:: Rewrite with enum or interface

View File

@ -0,0 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
interface Titled {
val title: String?
}

View File

@ -16,15 +16,14 @@ data class InlineQueryResultAudioImpl(
override val id: String,
@SerialName(audioUrlField)
override val url: String,
@SerialName(titleField)
override val title: String,
@SerialName(performerField)
@Optional
override val performer: String? = null,
@SerialName(audioDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,

View File

@ -19,8 +19,7 @@ data class InlineQueryResultDocumentCachedImpl(
@SerialName(documentFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
override val title: String,
@SerialName(descriptionField)
@Optional
override val description: String? = null,

View File

@ -16,6 +16,8 @@ data class InlineQueryResultDocumentImpl(
override val id: String,
@SerialName(documentUrlField)
override val url: String,
@SerialName(titleField)
override val title: String,
@SerialName(thumbUrlField)
@Optional
override val thumbUrl: String? = null,
@ -27,9 +29,6 @@ data class InlineQueryResultDocumentImpl(
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,

View File

@ -20,6 +20,8 @@ data class InlineQueryResultLocation(
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(titleField)
override val title: String,
@SerialName(livePeriodField)
@Optional
override val livePeriod: Int? = null,
@ -32,9 +34,6 @@ data class InlineQueryResultLocation(
@SerialName(thumbHeightField)
@Optional
override val thumbHeight: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(replyMarkupField)
@Optional
override val replyMarkup: InlineKeyboardMarkup? = null,

View File

@ -0,0 +1,56 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.*
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.*
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 InlineQueryResultVenue(
@SerialName(idField)
override val id: String,
@SerialName(latitudeField)
override val latitude: Double,
@SerialName(longitudeField)
override val longitude: Double,
@SerialName(titleField)
override val title: String,
@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,
CommonVenueData,
TitledInlineQueryResult,
WithInputMessageContentInlineQueryResult,
ThumbedInlineQueryResult,
ThumbSizedInlineQueryResult
{
override val type: String = "venue"
}

View File

@ -18,8 +18,7 @@ data class InlineQueryResultVideoCachedImpl(
@SerialName(videoFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
override val title: String,
@SerialName(descriptionField)
@Optional
override val description: String? = null,

View File

@ -19,6 +19,8 @@ data class InlineQueryResultVideoImpl(
override val thumbUrl: String,
@SerialName(mimeTypeField)
override val mimeType: String? = null,
@SerialName(titleField)
override val title: String,
@SerialName(videoWidthField)
@Optional
override val width: Int? = null,
@ -28,9 +30,6 @@ data class InlineQueryResultVideoImpl(
@SerialName(videoDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(descriptionField)
@Optional
override val description: String? = null,

View File

@ -17,8 +17,7 @@ data class InlineQueryResultVoiceCachedImpl(
@SerialName(voiceFileIdField)
override val fileId: FileId,
@SerialName(titleField)
@Optional
override val title: String? = null,
override val title: String,
@SerialName(captionField)
@Optional
override val caption: String? = null,

View File

@ -14,12 +14,11 @@ data class InlineQueryResultVoiceImpl(
override val id: String,
@SerialName(voiceUrlField)
override val url: String,
@SerialName(titleField)
override val title: String,
@SerialName(voiceDurationField)
@Optional
override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField)
@Optional
override val caption: String? = null,

View File

@ -1,7 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts
interface OptionallyTitledInlineQueryResult : InlineQueryResult {
val title: String?
import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Titled
}
interface OptionallyTitledInlineQueryResult : InlineQueryResult, Titled

View File

@ -1,5 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts
interface TitledInlineQueryResult : OptionallyTitledInlineQueryResult {
override val title: String?
override val title: String
}

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Captioned
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultGifCommon : InlineQueryResult,
TitledInlineQueryResult,
OptionallyTitledInlineQueryResult,
Captioned,
WithInputMessageContentInlineQueryResult
{

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Captioned
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultMpeg4GifCommon : InlineQueryResult,
TitledInlineQueryResult,
OptionallyTitledInlineQueryResult,
Captioned,
WithInputMessageContentInlineQueryResult
{

View File

@ -4,7 +4,7 @@ import com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts.Captioned
import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultPhotoCommon : InlineQueryResult,
TitledInlineQueryResult,
OptionallyTitledInlineQueryResult,
DescribedInlineQueryResult,
Captioned,
WithInputMessageContentInlineQueryResult