1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-04 15:33:47 +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 package com.github.insanusmokrassar.TelegramBotAPI.CommonAbstracts
interface CommonVenueData { interface CommonVenueData : Titled {
val title: String override val title: String
val address: String val address: String
val foursquareId: String? val foursquareId: String?
val foursquareType: String? // TODO:: Rewrite with enum or interface 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, override val id: String,
@SerialName(audioUrlField) @SerialName(audioUrlField)
override val url: String, override val url: String,
@SerialName(titleField)
override val title: String,
@SerialName(performerField) @SerialName(performerField)
@Optional @Optional
override val performer: String? = null, override val performer: String? = null,
@SerialName(audioDurationField) @SerialName(audioDurationField)
@Optional @Optional
override val duration: Int? = null, override val duration: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(captionField) @SerialName(captionField)
@Optional @Optional
override val caption: String? = null, override val caption: String? = null,

View File

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

View File

@ -16,6 +16,8 @@ data class InlineQueryResultDocumentImpl(
override val id: String, override val id: String,
@SerialName(documentUrlField) @SerialName(documentUrlField)
override val url: String, override val url: String,
@SerialName(titleField)
override val title: String,
@SerialName(thumbUrlField) @SerialName(thumbUrlField)
@Optional @Optional
override val thumbUrl: String? = null, override val thumbUrl: String? = null,
@ -27,9 +29,6 @@ data class InlineQueryResultDocumentImpl(
override val thumbHeight: Int? = null, override val thumbHeight: Int? = null,
@SerialName(mimeTypeField) @SerialName(mimeTypeField)
override val mimeType: String? = null, override val mimeType: String? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(descriptionField) @SerialName(descriptionField)
@Optional @Optional
override val description: String? = null, override val description: String? = null,

View File

@ -20,6 +20,8 @@ data class InlineQueryResultLocation(
override val latitude: Double, override val latitude: Double,
@SerialName(longitudeField) @SerialName(longitudeField)
override val longitude: Double, override val longitude: Double,
@SerialName(titleField)
override val title: String,
@SerialName(livePeriodField) @SerialName(livePeriodField)
@Optional @Optional
override val livePeriod: Int? = null, override val livePeriod: Int? = null,
@ -32,9 +34,6 @@ data class InlineQueryResultLocation(
@SerialName(thumbHeightField) @SerialName(thumbHeightField)
@Optional @Optional
override val thumbHeight: Int? = null, override val thumbHeight: Int? = null,
@SerialName(titleField)
@Optional
override val title: String? = null,
@SerialName(replyMarkupField) @SerialName(replyMarkupField)
@Optional @Optional
override val replyMarkup: InlineKeyboardMarkup? = null, 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) @SerialName(videoFileIdField)
override val fileId: FileId, override val fileId: FileId,
@SerialName(titleField) @SerialName(titleField)
@Optional override val title: String,
override val title: String? = null,
@SerialName(descriptionField) @SerialName(descriptionField)
@Optional @Optional
override val description: String? = null, override val description: String? = null,

View File

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

View File

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

View File

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

View File

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

View File

@ -1,5 +1,5 @@
package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts package com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts
interface TitledInlineQueryResult : OptionallyTitledInlineQueryResult { 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.* import com.github.insanusmokrassar.TelegramBotAPI.types.InlineQueries.InlineQueryResult.abstracts.*
interface InlineQueryResultGifCommon : InlineQueryResult, interface InlineQueryResultGifCommon : InlineQueryResult,
TitledInlineQueryResult, OptionallyTitledInlineQueryResult,
Captioned, Captioned,
WithInputMessageContentInlineQueryResult WithInputMessageContentInlineQueryResult
{ {

View File

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

View File

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