1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-25 19:48:43 +00:00

rename all thumb* usages

This commit is contained in:
InsanusMokrassar 2023-03-10 12:24:12 +06:00
parent e7b21dcd3d
commit 90b9c66bea
12 changed files with 106 additions and 86 deletions

View File

@ -332,9 +332,17 @@ const val stickerFileIdField = "sticker_file_id"
const val gameShortNameField = "game_short_name"
const val thumbnailUrlField = "thumbnail_url"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailUrlField", "dev.inmo.tgbotapi.types.thumbnailUrlField"))
const val thumbUrlField = "thumb_url"
const val thumbnailMimeTypeField = "thumbnail_mime_type"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailMimeTypeField", "dev.inmo.tgbotapi.types.thumbnailMimeTypeField"))
const val thumbMimeTypeField = "thumb_mime_type"
const val thumbnailWidthField = "thumbnail_width"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailWidthField", "dev.inmo.tgbotapi.types.thumbnailWidthField"))
const val thumbWidthField = "thumb_width"
const val thumbnailHeightField = "thumbnail_height"
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailHeightField", "dev.inmo.tgbotapi.types.thumbnailHeightField"))
const val thumbHeightField = "thumb_height"
const val inputMessageContentField = "input_message_content"

View File

@ -23,12 +23,12 @@ class InlineQueryResultArticle(
val hideUrl: Boolean? = null,
@SerialName(descriptionField)
override val description: String? = null,
@SerialName(thumbUrlField)
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
override val thumbHeight: Int? = null
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String? = null,
@SerialName(thumbnailWidthField)
override val thumbnailWidth: Int? = null,
@SerialName(thumbnailHeightField)
override val thumbnailHeight: Int? = null
) : InlineQueryResult,
ThumbSizedInlineQueryResult,
TitledInlineQueryResult,

View File

@ -20,12 +20,12 @@ data class InlineQueryResultContact(
override val lastName: String? = null,
@SerialName(vcardField)
override val vcard: String? = null,
@SerialName(thumbUrlField)
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
override val thumbHeight: Int? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String? = null,
@SerialName(thumbnailWidthField)
override val thumbnailWidth: Int? = null,
@SerialName(thumbnailHeightField)
override val thumbnailHeight: Int? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@ -21,24 +21,24 @@ fun InlineQueryResultDocumentImpl(
url: String,
title: String,
mimeType: MimeType,
thumbUrl: String? = null,
thumbWidth: Int? = null,
thumbHeight: Int? = null,
thumbnailUrl: String? = null,
thumbnailWidth: Int? = null,
thumbnailHeight: Int? = null,
description: String? = null,
text: String? = null,
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbUrl, thumbWidth, thumbHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultDocumentImpl(id, url, title, mimeType, thumbnailUrl, thumbnailWidth, thumbnailHeight, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultDocumentImpl(
id: InlineQueryIdentifier,
url: String,
title: String,
mimeType: MimeType,
thumbUrl: String? = null,
thumbWidth: Int? = null,
thumbHeight: Int? = null,
thumbnailUrl: String? = null,
thumbnailWidth: Int? = null,
thumbnailHeight: Int? = null,
description: String? = null,
entities: TextSourcesList,
replyMarkup: InlineKeyboardMarkup? = null,
@ -48,9 +48,9 @@ fun InlineQueryResultDocumentImpl(
url,
title,
mimeType,
thumbUrl,
thumbWidth,
thumbHeight,
thumbnailUrl,
thumbnailWidth,
thumbnailHeight,
description,
entities.makeString(),
null,
@ -69,12 +69,12 @@ data class InlineQueryResultDocumentImpl internal constructor(
override val title: String,
@SerialName(mimeTypeField)
override val mimeType: MimeType,
@SerialName(thumbUrlField)
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
override val thumbHeight: Int? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String? = null,
@SerialName(thumbnailWidthField)
override val thumbnailWidth: Int? = null,
@SerialName(thumbnailHeightField)
override val thumbnailHeight: Int? = null,
@SerialName(descriptionField)
override val description: String? = null,
@SerialName(captionField)

View File

@ -20,8 +20,8 @@ import kotlinx.serialization.Serializable
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -30,13 +30,13 @@ fun InlineQueryResultGifImpl(
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultGifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -47,8 +47,8 @@ fun InlineQueryResultGifImpl(
) = InlineQueryResultGifImpl(
id,
url,
thumbUrl,
thumbMimeType,
thumbnailUrl,
thumbnailMimeType,
width,
height,
duration,
@ -63,8 +63,8 @@ fun InlineQueryResultGifImpl(
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
gifFile: FileId,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -73,13 +73,13 @@ fun InlineQueryResultGifImpl(
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
) = InlineQueryResultGifImpl(id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, replyMarkup, inputMessageContent)
fun InlineQueryResultGifImpl(
id: InlineQueryIdentifier,
gifFile: FileId,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -88,7 +88,7 @@ fun InlineQueryResultGifImpl(
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultGifImpl(
id, gifFile.fileId, thumbUrl, thumbMimeType, width, height, duration, title, entities, replyMarkup, inputMessageContent
id, gifFile.fileId, thumbnailUrl, thumbnailMimeType, width, height, duration, title, entities, replyMarkup, inputMessageContent
)
@Serializable
@ -97,10 +97,10 @@ data class InlineQueryResultGifImpl internal constructor(
override val id: InlineQueryIdentifier,
@SerialName(gifUrlField)
override val url: String,
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(thumbMimeTypeField)
override val thumbMimeType: MimeType? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String,
@SerialName(thumbnailMimeTypeField)
override val thumbnailMimeType: MimeType? = null,
@SerialName(gifWidthField)
override val width: Int? = null,
@SerialName(gifHeightField)
@ -126,8 +126,8 @@ data class InlineQueryResultGifImpl internal constructor(
}
init {
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
if (thumbnailMimeType != null && thumbnailMimeType !in telegramInlineModeGifPermittedMimeTypes) {
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbnailMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
}
}
}

View File

@ -26,12 +26,12 @@ data class InlineQueryResultLocation(
override val heading: Degrees? = null,
@SerialName(proximityAlertRadiusField)
override val proximityAlertRadius: Meters? = null,
@SerialName(thumbUrlField)
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
override val thumbHeight: Int? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String? = null,
@SerialName(thumbnailWidthField)
override val thumbnailWidth: Int? = null,
@SerialName(thumbnailHeightField)
override val thumbnailHeight: Int? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@ -19,8 +19,8 @@ import kotlinx.serialization.Serializable
fun InlineQueryResultMpeg4GifImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -29,13 +29,13 @@ fun InlineQueryResultMpeg4GifImpl(
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultMpeg4GifImpl(id, url, thumbUrl, thumbMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultMpeg4GifImpl(id, url, thumbnailUrl, thumbnailMimeType, width, height, duration, title, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultMpeg4GifImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbMimeType: MimeType? = null,
thumbnailUrl: String,
thumbnailMimeType: MimeType? = null,
width: Int? = null,
height: Int? = null,
duration: Int? = null,
@ -46,8 +46,8 @@ fun InlineQueryResultMpeg4GifImpl(
) = InlineQueryResultMpeg4GifImpl(
id,
url,
thumbUrl,
thumbMimeType,
thumbnailUrl,
thumbnailMimeType,
width,
height,
duration,
@ -65,10 +65,10 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
override val id: InlineQueryIdentifier,
@SerialName(mpeg4GifUrlField)
override val url: String,
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(thumbMimeTypeField)
override val thumbMimeType: MimeType? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String,
@SerialName(thumbnailMimeTypeField)
override val thumbnailMimeType: MimeType? = null,
@SerialName(mpeg4GifWidthField)
override val width: Int? = null,
@SerialName(mpeg4GifHeightField)
@ -94,8 +94,8 @@ data class InlineQueryResultMpeg4GifImpl internal constructor(
}
init {
if (thumbMimeType != null && thumbMimeType !in telegramInlineModeGifPermittedMimeTypes) {
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
if (thumbnailMimeType != null && thumbnailMimeType !in telegramInlineModeGifPermittedMimeTypes) {
error("Passed thumb mime type is not permitted in Telegram Bot API. Passed $thumbnailMimeType, but permitted $telegramInlineModeGifPermittedMimeTypes")
}
}
}

View File

@ -18,7 +18,7 @@ import kotlinx.serialization.Serializable
fun InlineQueryResultPhotoImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbnailUrl: String,
width: Int? = null,
height: Int? = null,
title: String? = null,
@ -27,12 +27,12 @@ fun InlineQueryResultPhotoImpl(
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultPhotoImpl(id, url, thumbUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultPhotoImpl(id, url, thumbnailUrl, width, height, title, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultPhotoImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbnailUrl: String,
width: Int? = null,
height: Int? = null,
title: String? = null,
@ -43,7 +43,7 @@ fun InlineQueryResultPhotoImpl(
) = InlineQueryResultPhotoImpl(
id,
url,
thumbUrl,
thumbnailUrl,
width,
height,
title,
@ -61,8 +61,8 @@ data class InlineQueryResultPhotoImpl internal constructor(
override val id: InlineQueryIdentifier,
@SerialName(photoUrlField)
override val url: String,
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String,
@SerialName(photoWidthField)
override val width: Int? = null,
@SerialName(photoHeightField)

View File

@ -29,12 +29,12 @@ data class InlineQueryResultVenue(
override val googlePlaceId: GooglePlaceId? = null,
@SerialName(googlePlaceTypeField)
override val googlePlaceType: GooglePlaceType? = null,
@SerialName(thumbUrlField)
override val thumbUrl: String? = null,
@SerialName(thumbWidthField)
override val thumbWidth: Int? = null,
@SerialName(thumbHeightField)
override val thumbHeight: Int? = null,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String? = null,
@SerialName(thumbnailWidthField)
override val thumbnailWidth: Int? = null,
@SerialName(thumbnailHeightField)
override val thumbnailHeight: Int? = null,
@SerialName(replyMarkupField)
override val replyMarkup: InlineKeyboardMarkup? = null,
@SerialName(inputMessageContentField)

View File

@ -19,7 +19,7 @@ import kotlinx.serialization.Serializable
fun InlineQueryResultVideoImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbnailUrl: String,
mimeType: MimeType,
title: String,
width: Int? = null,
@ -30,12 +30,12 @@ fun InlineQueryResultVideoImpl(
parseMode: ParseMode? = null,
replyMarkup: InlineKeyboardMarkup? = null,
inputMessageContent: InputMessageContent? = null
) = InlineQueryResultVideoImpl(id, url, thumbUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
) = InlineQueryResultVideoImpl(id, url, thumbnailUrl, mimeType, title, width, height, duration, description, text, parseMode, null, replyMarkup, inputMessageContent)
fun InlineQueryResultVideoImpl(
id: InlineQueryIdentifier,
url: String,
thumbUrl: String,
thumbnailUrl: String,
mimeType: MimeType,
title: String,
width: Int? = null,
@ -48,7 +48,7 @@ fun InlineQueryResultVideoImpl(
) = InlineQueryResultVideoImpl(
id,
url,
thumbUrl,
thumbnailUrl,
mimeType,
title,
width,
@ -68,8 +68,8 @@ data class InlineQueryResultVideoImpl internal constructor(
override val id: InlineQueryIdentifier,
@SerialName(videoUrlField)
override val url: String,
@SerialName(thumbUrlField)
override val thumbUrl: String,
@SerialName(thumbnailUrlField)
override val thumbnailUrl: String,
@SerialName(mimeTypeField)
override val mimeType: MimeType,
@SerialName(titleField)

View File

@ -1,6 +1,12 @@
package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
interface ThumbSizedInlineQueryResult : InlineQueryResult, ThumbedInlineQueryResult {
val thumbnailWidth: Int?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailWidth"))
val thumbWidth: Int?
get() = thumbnailWidth
val thumbnailHeight: Int?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailHeight"))
val thumbHeight: Int?
}
get() = thumbnailHeight
}

View File

@ -3,9 +3,15 @@ package dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts
import dev.inmo.tgbotapi.utils.MimeType
interface ThumbedInlineQueryResult : InlineQueryResult {
val thumbnailUrl: String?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailUrl"))
val thumbUrl: String?
get() = thumbnailUrl
}
interface ThumbedWithMimeTypeInlineQueryResult : ThumbedInlineQueryResult {
val thumbnailMimeType: MimeType?
@Deprecated("Renamed in telegram bot api", ReplaceWith("thumbnailMimeType"))
val thumbMimeType: MimeType?
}
get() = thumbnailMimeType
}