tgbotapi/tgbotapi.utils/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/utils/ClassCasts.kt

3697 lines
145 KiB
Kotlin
Raw Normal View History

2021-01-05 17:04:09 +00:00
@file:Suppress("NOTHING_TO_INLINE", "unused", "UNCHECKED_CAST")
2021-01-05 05:54:02 +00:00
package dev.inmo.tgbotapi.extensions.utils
2021-05-29 09:34:14 +00:00
2022-05-01 16:13:40 +00:00
import dev.inmo.tgbotapi.abstracts.*
2022-06-21 12:52:55 +00:00
import dev.inmo.tgbotapi.requests.send.payments.CreateInvoiceLink
2021-04-28 14:08:02 +00:00
import dev.inmo.tgbotapi.requests.send.payments.SendInvoice
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.*
2022-01-06 10:52:28 +00:00
import dev.inmo.tgbotapi.types.InlineQueries.ChosenInlineResult.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.audio.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.document.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.gif.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.mpeg4gif.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.photo.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.video.*
import dev.inmo.tgbotapi.types.InlineQueries.InlineQueryResult.abstracts.results.voice.*
import dev.inmo.tgbotapi.types.InlineQueries.InputMessageContent.*
2021-06-03 17:34:11 +00:00
import dev.inmo.tgbotapi.types.InlineQueries.query.*
import dev.inmo.tgbotapi.types.abstracts.WithOptionalLanguageCode
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.actions.*
import dev.inmo.tgbotapi.types.buttons.*
import dev.inmo.tgbotapi.types.buttons.InlineKeyboardButtons.*
2022-04-21 18:16:41 +00:00
import dev.inmo.tgbotapi.types.chat.*
2022-08-05 10:35:07 +00:00
import dev.inmo.tgbotapi.types.chat.member.*
2021-02-17 16:29:29 +00:00
import dev.inmo.tgbotapi.types.dice.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.files.*
import dev.inmo.tgbotapi.types.location.*
2022-08-05 10:35:07 +00:00
import dev.inmo.tgbotapi.types.media.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.message.*
2021-03-11 15:39:34 +00:00
import dev.inmo.tgbotapi.types.message.ChatEvents.*
import dev.inmo.tgbotapi.types.message.ChatEvents.LeftChatMember
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.message.ChatEvents.abstracts.*
2021-03-11 15:39:34 +00:00
import dev.inmo.tgbotapi.types.message.ChatEvents.voice.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.message.abstracts.*
import dev.inmo.tgbotapi.types.message.abstracts.MediaGroupMessage
2021-01-09 14:59:37 +00:00
import dev.inmo.tgbotapi.types.message.content.*
import dev.inmo.tgbotapi.types.message.payments.SuccessfulPaymentEvent
2022-05-01 14:36:07 +00:00
import dev.inmo.tgbotapi.types.message.textsources.*
2021-01-23 15:10:57 +00:00
import dev.inmo.tgbotapi.types.passport.*
2021-01-28 16:21:21 +00:00
import dev.inmo.tgbotapi.types.passport.decrypted.*
import dev.inmo.tgbotapi.types.passport.decrypted.abstracts.*
import dev.inmo.tgbotapi.types.passport.encrypted.*
import dev.inmo.tgbotapi.types.passport.encrypted.abstracts.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.polls.*
2022-08-05 10:35:07 +00:00
import dev.inmo.tgbotapi.types.queries.callback.*
2021-01-05 05:54:02 +00:00
import dev.inmo.tgbotapi.types.update.*
import dev.inmo.tgbotapi.types.update.abstracts.*
2022-05-01 15:01:03 +00:00
import dev.inmo.tgbotapi.types.update.media_group.*
2021-01-05 17:02:00 +00:00
import dev.inmo.tgbotapi.utils.PreviewFeature
2021-01-05 05:54:02 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenBot(block: (Bot) -> T) = asBot()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asBot(): Bot? = this as? Bot
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireBot(): Bot = this as Bot
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenCommonBot(block: (CommonBot) -> T) = asCommonBot()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asCommonBot(): CommonBot? = this as? CommonBot
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireCommonBot(): CommonBot = this as CommonBot
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenCommonUser(block: (CommonUser) -> T) = asCommonUser()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asCommonUser(): CommonUser? = this as? CommonUser
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireCommonUser(): CommonUser = this as CommonUser
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedBot(block: (ExtendedBot) -> T) = asExtendedBot()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedBot(): ExtendedBot? = this as? ExtendedBot
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedBot(): ExtendedBot = this as ExtendedBot
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenUser(block: (User) -> T) = asUser()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asUser(): User? = this as? User
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireUser(): User = this as User
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenChannelChat(block: (ChannelChat) -> T) = asChannelChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asChannelChat(): ChannelChat? = this as? ChannelChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireChannelChat(): ChannelChat = this as ChannelChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenGroupChat(block: (GroupChat) -> T) = asGroupChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asGroupChat(): GroupChat? = this as? GroupChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireGroupChat(): GroupChat = this as GroupChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenPrivateChat(block: (PrivateChat) -> T) = asPrivateChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asPrivateChat(): PrivateChat? = this as? PrivateChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requirePrivateChat(): PrivateChat = this as PrivateChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenPublicChat(block: (PublicChat) -> T) = asPublicChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asPublicChat(): PublicChat? = this as? PublicChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requirePublicChat(): PublicChat = this as PublicChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenSuperPublicChat(block: (SuperPublicChat) -> T) = asSuperPublicChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asSuperPublicChat(): SuperPublicChat? = this as? SuperPublicChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireSuperPublicChat(): SuperPublicChat = this as SuperPublicChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenSupergroupChat(block: (SupergroupChat) -> T) = asSupergroupChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asSupergroupChat(): SupergroupChat? = this as? SupergroupChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireSupergroupChat(): SupergroupChat = this as SupergroupChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenUnknownChatType(block: (UnknownChatType) -> T) = asUnknownChatType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asUnknownChatType(): UnknownChatType? = this as? UnknownChatType
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireUnknownChatType(): UnknownChatType = this as UnknownChatType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenUsernameChat(block: (UsernameChat) -> T) = asUsernameChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asUsernameChat(): UsernameChat? = this as? UsernameChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireUsernameChat(): UsernameChat = this as UsernameChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedChannelChat(block: (ExtendedChannelChat) -> T) = asExtendedChannelChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedChannelChat(): ExtendedChannelChat? = this as? ExtendedChannelChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedChannelChat(): ExtendedChannelChat = this as ExtendedChannelChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedChat(block: (ExtendedChat) -> T) = asExtendedChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedChat(): ExtendedChat? = this as? ExtendedChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedChat(): ExtendedChat = this as ExtendedChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedGroupChat(block: (ExtendedGroupChat) -> T) = asExtendedGroupChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedGroupChat(): ExtendedGroupChat? = this as? ExtendedGroupChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedGroupChat(): ExtendedGroupChat = this as ExtendedGroupChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedPrivateChat(block: (ExtendedPrivateChat) -> T) = asExtendedPrivateChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedPrivateChat(): ExtendedPrivateChat? = this as? ExtendedPrivateChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedPrivateChat(): ExtendedPrivateChat = this as ExtendedPrivateChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedPublicChat(block: (ExtendedPublicChat) -> T) = asExtendedPublicChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedPublicChat(): ExtendedPublicChat? = this as? ExtendedPublicChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedPublicChat(): ExtendedPublicChat = this as ExtendedPublicChat
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Chat.whenExtendedSupergroupChat(block: (ExtendedSupergroupChat) -> T) =
asExtendedSupergroupChat()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Chat.asExtendedSupergroupChat(): ExtendedSupergroupChat? = this as? ExtendedSupergroupChat
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Chat.requireExtendedSupergroupChat(): ExtendedSupergroupChat = this as ExtendedSupergroupChat
2021-05-29 09:34:14 +00:00
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun <T> Chat.whenPossiblyPremiumChat(block: (PossiblyPremiumChat) -> T) = asPossiblyPremiumChat()?.let(block)
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun Chat.asPossiblyPremiumChat(): PossiblyPremiumChat? = this as? PossiblyPremiumChat
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun Chat.requirePossiblyPremiumChat(): PossiblyPremiumChat = this as PossiblyPremiumChat
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun <T> Chat.whenAbleToAddInAttachmentMenuChat(block: (AbleToAddInAttachmentMenuChat) -> T) =
asAbleToAddInAttachmentMenuChat()?.let(block)
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun Chat.asAbleToAddInAttachmentMenuChat(): AbleToAddInAttachmentMenuChat? =
this as? AbleToAddInAttachmentMenuChat
2022-06-21 12:30:31 +00:00
@PreviewFeature
inline fun Chat.requireAbleToAddInAttachmentMenuChat(): AbleToAddInAttachmentMenuChat =
this as AbleToAddInAttachmentMenuChat
2022-06-21 12:30:31 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenDataCallbackQuery(block: (DataCallbackQuery) -> T) = asDataCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun CallbackQuery.asDataCallbackQuery(): DataCallbackQuery? = this as? DataCallbackQuery
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun CallbackQuery.requireDataCallbackQuery(): DataCallbackQuery = this as DataCallbackQuery
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenGameShortNameCallbackQuery(block: (GameShortNameCallbackQuery) -> T) =
asGameShortNameCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.asGameShortNameCallbackQuery(): GameShortNameCallbackQuery? =
this as? GameShortNameCallbackQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.requireGameShortNameCallbackQuery(): GameShortNameCallbackQuery =
this as GameShortNameCallbackQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenInlineMessageIdCallbackQuery(block: (InlineMessageIdCallbackQuery) -> T) =
asInlineMessageIdCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.asInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery? =
this as? InlineMessageIdCallbackQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.requireInlineMessageIdCallbackQuery(): InlineMessageIdCallbackQuery =
this as InlineMessageIdCallbackQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenInlineMessageIdDataCallbackQuery(block: (InlineMessageIdDataCallbackQuery) -> T) =
asInlineMessageIdDataCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.asInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery? =
this as? InlineMessageIdDataCallbackQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.requireInlineMessageIdDataCallbackQuery(): InlineMessageIdDataCallbackQuery =
this as InlineMessageIdDataCallbackQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenInlineMessageIdGameShortNameCallbackQuery(block: (InlineMessageIdGameShortNameCallbackQuery) -> T) =
asInlineMessageIdGameShortNameCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.asInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery? =
this as? InlineMessageIdGameShortNameCallbackQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.requireInlineMessageIdGameShortNameCallbackQuery(): InlineMessageIdGameShortNameCallbackQuery =
this as InlineMessageIdGameShortNameCallbackQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenMessageCallbackQuery(block: (MessageCallbackQuery) -> T) =
asMessageCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun CallbackQuery.asMessageCallbackQuery(): MessageCallbackQuery? = this as? MessageCallbackQuery
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun CallbackQuery.requireMessageCallbackQuery(): MessageCallbackQuery = this as MessageCallbackQuery
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenMessageDataCallbackQuery(block: (MessageDataCallbackQuery) -> T) =
asMessageDataCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun CallbackQuery.asMessageDataCallbackQuery(): MessageDataCallbackQuery? = this as? MessageDataCallbackQuery
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun CallbackQuery.requireMessageDataCallbackQuery(): MessageDataCallbackQuery = this as MessageDataCallbackQuery
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenMessageGameShortNameCallbackQuery(block: (MessageGameShortNameCallbackQuery) -> T) =
asMessageGameShortNameCallbackQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.asMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery? =
this as? MessageGameShortNameCallbackQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CallbackQuery.requireMessageGameShortNameCallbackQuery(): MessageGameShortNameCallbackQuery =
this as MessageGameShortNameCallbackQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CallbackQuery.whenUnknownCallbackQueryType(block: (UnknownCallbackQueryType) -> T) =
asUnknownCallbackQueryType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun CallbackQuery.asUnknownCallbackQueryType(): UnknownCallbackQueryType? = this as? UnknownCallbackQueryType
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun CallbackQuery.requireUnknownCallbackQueryType(): UnknownCallbackQueryType = this as UnknownCallbackQueryType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorDataField(block: (PassportElementErrorDataField) -> T) =
asPassportElementErrorDataField()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorDataField(): PassportElementErrorDataField? =
this as? PassportElementErrorDataField
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorDataField(): PassportElementErrorDataField =
this as PassportElementErrorDataField
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorFile(block: (PassportElementErrorFile) -> T) =
asPassportElementErrorFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorFile(): PassportElementErrorFile? =
this as? PassportElementErrorFile
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorFile(): PassportElementErrorFile =
this as PassportElementErrorFile
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorFiles(block: (PassportElementErrorFiles) -> T) =
asPassportElementErrorFiles()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorFiles(): PassportElementErrorFiles? =
this as? PassportElementErrorFiles
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorFiles(): PassportElementErrorFiles =
this as PassportElementErrorFiles
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorFrontSide(block: (PassportElementErrorFrontSide) -> T) =
asPassportElementErrorFrontSide()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorFrontSide(): PassportElementErrorFrontSide? =
this as? PassportElementErrorFrontSide
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorFrontSide(): PassportElementErrorFrontSide =
this as PassportElementErrorFrontSide
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorReverseSide(block: (PassportElementErrorReverseSide) -> T) =
asPassportElementErrorReverseSide()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorReverseSide(): PassportElementErrorReverseSide? =
this as? PassportElementErrorReverseSide
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorReverseSide(): PassportElementErrorReverseSide =
this as PassportElementErrorReverseSide
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorSelfie(block: (PassportElementErrorSelfie) -> T) =
asPassportElementErrorSelfie()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorSelfie(): PassportElementErrorSelfie? =
this as? PassportElementErrorSelfie
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorSelfie(): PassportElementErrorSelfie =
this as PassportElementErrorSelfie
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorTranslationFile(block: (PassportElementErrorTranslationFile) -> T) =
asPassportElementErrorTranslationFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorTranslationFile(): PassportElementErrorTranslationFile? =
this as? PassportElementErrorTranslationFile
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorTranslationFile(): PassportElementErrorTranslationFile =
this as PassportElementErrorTranslationFile
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorTranslationFiles(block: (PassportElementErrorTranslationFiles) -> T) =
asPassportElementErrorTranslationFiles()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles? =
this as? PassportElementErrorTranslationFiles
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorTranslationFiles(): PassportElementErrorTranslationFiles =
this as PassportElementErrorTranslationFiles
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementErrorUnspecified(block: (PassportElementErrorUnspecified) -> T) =
asPassportElementErrorUnspecified()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementErrorUnspecified(): PassportElementErrorUnspecified? =
this as? PassportElementErrorUnspecified
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementErrorUnspecified(): PassportElementErrorUnspecified =
this as PassportElementErrorUnspecified
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementFileError(block: (PassportElementFileError) -> T) =
asPassportElementFileError()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementFileError(): PassportElementFileError? =
this as? PassportElementFileError
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementFileError(): PassportElementFileError =
this as PassportElementFileError
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportElementFilesError(block: (PassportElementFilesError) -> T) =
asPassportElementFilesError()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportElementFilesError(): PassportElementFilesError? =
this as? PassportElementFilesError
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportElementFilesError(): PassportElementFilesError =
this as PassportElementFilesError
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportMultipleElementsError(block: (PassportMultipleElementsError) -> T) =
asPassportMultipleElementsError()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportMultipleElementsError(): PassportMultipleElementsError? =
this as? PassportMultipleElementsError
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportMultipleElementsError(): PassportMultipleElementsError =
this as PassportMultipleElementsError
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenPassportSingleElementError(block: (PassportSingleElementError) -> T) =
asPassportSingleElementError()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asPassportSingleElementError(): PassportSingleElementError? =
this as? PassportSingleElementError
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requirePassportSingleElementError(): PassportSingleElementError =
this as PassportSingleElementError
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> PassportElementError.whenUnknownPassportElementError(block: (UnknownPassportElementError) -> T) =
asUnknownPassportElementError()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.asUnknownPassportElementError(): UnknownPassportElementError? =
this as? UnknownPassportElementError
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun PassportElementError.requireUnknownPassportElementError(): UnknownPassportElementError =
this as UnknownPassportElementError
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenBankStatement(block: (BankStatement) -> T) = asBankStatement()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asBankStatement(): BankStatement? = this as? BankStatement
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireBankStatement(): BankStatement = this as BankStatement
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenCommonPassport(block: (CommonPassport) -> T) =
asCommonPassport()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asCommonPassport(): CommonPassport? = this as? CommonPassport
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireCommonPassport(): CommonPassport = this as CommonPassport
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenDriverLicense(block: (DriverLicense) -> T) = asDriverLicense()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asDriverLicense(): DriverLicense? = this as? DriverLicense
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireDriverLicense(): DriverLicense = this as DriverLicense
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEmail(block: (Email) -> T) = asEmail()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asEmail(): Email? = this as? Email
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireEmail(): Email = this as Email
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedAddress(block: (EncryptedAddress) -> T) =
asEncryptedAddress()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asEncryptedAddress(): EncryptedAddress? = this as? EncryptedAddress
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireEncryptedAddress(): EncryptedAddress = this as EncryptedAddress
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPersonalDetails(block: (EncryptedPersonalDetails) -> T) =
asEncryptedPersonalDetails()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPersonalDetails(): EncryptedPersonalDetails? =
this as? EncryptedPersonalDetails
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPersonalDetails(): EncryptedPersonalDetails =
this as EncryptedPersonalDetails
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenIdentityCard(block: (IdentityCard) -> T) = asIdentityCard()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asIdentityCard(): IdentityCard? = this as? IdentityCard
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireIdentityCard(): IdentityCard = this as IdentityCard
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenInternalPassport(block: (InternalPassport) -> T) =
asInternalPassport()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asInternalPassport(): InternalPassport? = this as? InternalPassport
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireInternalPassport(): InternalPassport = this as InternalPassport
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenPassport(block: (Passport) -> T) = asPassport()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asPassport(): Passport? = this as? Passport
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requirePassport(): Passport = this as Passport
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenPassportRegistration(block: (PassportRegistration) -> T) =
asPassportRegistration()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asPassportRegistration(): PassportRegistration? = this as? PassportRegistration
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requirePassportRegistration(): PassportRegistration = this as PassportRegistration
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenPhoneNumber(block: (PhoneNumber) -> T) = asPhoneNumber()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asPhoneNumber(): PhoneNumber? = this as? PhoneNumber
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requirePhoneNumber(): PhoneNumber = this as PhoneNumber
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenRentalAgreement(block: (RentalAgreement) -> T) =
asRentalAgreement()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asRentalAgreement(): RentalAgreement? = this as? RentalAgreement
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireRentalAgreement(): RentalAgreement = this as RentalAgreement
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenTemporaryRegistration(block: (TemporaryRegistration) -> T) =
asTemporaryRegistration()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asTemporaryRegistration(): TemporaryRegistration? = this as? TemporaryRegistration
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireTemporaryRegistration(): TemporaryRegistration =
this as TemporaryRegistration
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithTranslatableFilesCollection(block: (EncryptedPassportElementWithTranslatableFilesCollection) -> T) =
asEncryptedPassportElementWithTranslatableFilesCollection()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection? =
this as? EncryptedPassportElementWithTranslatableFilesCollection
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableFilesCollection(): EncryptedPassportElementWithTranslatableFilesCollection =
this as EncryptedPassportElementWithTranslatableFilesCollection
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithTranslatableIDDocument(block: (EncryptedPassportElementWithTranslatableIDDocument) -> T) =
asEncryptedPassportElementWithTranslatableIDDocument()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument? =
this as? EncryptedPassportElementWithTranslatableIDDocument
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithTranslatableIDDocument(): EncryptedPassportElementWithTranslatableIDDocument =
this as EncryptedPassportElementWithTranslatableIDDocument
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenUtilityBill(block: (UtilityBill) -> T) = asUtilityBill()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.asUtilityBill(): UtilityBill? = this as? UtilityBill
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun EncryptedPassportElement.requireUtilityBill(): UtilityBill = this as UtilityBill
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithFilesCollection(block: (EncryptedPassportElementWithFilesCollection) -> T) =
asEncryptedPassportElementWithFilesCollection()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection? =
this as? EncryptedPassportElementWithFilesCollection
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFilesCollection(): EncryptedPassportElementWithFilesCollection =
this as EncryptedPassportElementWithFilesCollection
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementTranslatable(block: (EncryptedPassportElementTranslatable) -> T) =
asEncryptedPassportElementTranslatable()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable? =
this as? EncryptedPassportElementTranslatable
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementTranslatable(): EncryptedPassportElementTranslatable =
this as EncryptedPassportElementTranslatable
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenUnknownEncryptedPassportElement(block: (UnknownEncryptedPassportElement) -> T) =
asUnknownEncryptedPassportElement()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement? =
this as? UnknownEncryptedPassportElement
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireUnknownEncryptedPassportElement(): UnknownEncryptedPassportElement =
this as UnknownEncryptedPassportElement
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithData(block: (EncryptedPassportElementWithData) -> T) =
asEncryptedPassportElementWithData()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithData(): EncryptedPassportElementWithData? =
this as? EncryptedPassportElementWithData
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithData(): EncryptedPassportElementWithData =
this as EncryptedPassportElementWithData
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithEmail(block: (EncryptedPassportElementWithEmail) -> T) =
asEncryptedPassportElementWithEmail()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail? =
this as? EncryptedPassportElementWithEmail
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithEmail(): EncryptedPassportElementWithEmail =
this as EncryptedPassportElementWithEmail
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithFrontSide(block: (EncryptedPassportElementWithFrontSide) -> T) =
asEncryptedPassportElementWithFrontSide()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide? =
this as? EncryptedPassportElementWithFrontSide
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithFrontSide(): EncryptedPassportElementWithFrontSide =
this as EncryptedPassportElementWithFrontSide
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithPhoneNumber(block: (EncryptedPassportElementWithPhoneNumber) -> T) =
asEncryptedPassportElementWithPhoneNumber()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber? =
this as? EncryptedPassportElementWithPhoneNumber
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithPhoneNumber(): EncryptedPassportElementWithPhoneNumber =
this as EncryptedPassportElementWithPhoneNumber
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithReverseSide(block: (EncryptedPassportElementWithReverseSide) -> T) =
asEncryptedPassportElementWithReverseSide()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide? =
this as? EncryptedPassportElementWithReverseSide
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithReverseSide(): EncryptedPassportElementWithReverseSide =
this as EncryptedPassportElementWithReverseSide
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> EncryptedPassportElement.whenEncryptedPassportElementWithSelfie(block: (EncryptedPassportElementWithSelfie) -> T) =
asEncryptedPassportElementWithSelfie()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.asEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie? =
this as? EncryptedPassportElementWithSelfie
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun EncryptedPassportElement.requireEncryptedPassportElementWithSelfie(): EncryptedPassportElementWithSelfie =
this as EncryptedPassportElementWithSelfie
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenAddressSecureValue(block: (AddressSecureValue) -> T) = asAddressSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-01-28 16:21:21 +00:00
inline fun SecureValue.asAddressSecureValue(): AddressSecureValue? = this as? AddressSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireAddressSecureValue(): AddressSecureValue = this as AddressSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenBankStatementSecureValue(block: (BankStatementSecureValue) -> T) =
asBankStatementSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asBankStatementSecureValue(): BankStatementSecureValue? = this as? BankStatementSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireBankStatementSecureValue(): BankStatementSecureValue = this as BankStatementSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenCommonPassportSecureValue(block: (CommonPassportSecureValue) -> T) =
asCommonPassportSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asCommonPassportSecureValue(): CommonPassportSecureValue? = this as? CommonPassportSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireCommonPassportSecureValue(): CommonPassportSecureValue = this as CommonPassportSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenDriverLicenseSecureValue(block: (DriverLicenseSecureValue) -> T) =
asDriverLicenseSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asDriverLicenseSecureValue(): DriverLicenseSecureValue? = this as? DriverLicenseSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireDriverLicenseSecureValue(): DriverLicenseSecureValue = this as DriverLicenseSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenIdentityCardSecureValue(block: (IdentityCardSecureValue) -> T) =
asIdentityCardSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asIdentityCardSecureValue(): IdentityCardSecureValue? = this as? IdentityCardSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireIdentityCardSecureValue(): IdentityCardSecureValue = this as IdentityCardSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenIdentityWithReverseSideSecureValue(block: (IdentityWithReverseSideSecureValue) -> T) =
asIdentityWithReverseSideSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.asIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue? =
this as? IdentityWithReverseSideSecureValue
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireIdentityWithReverseSideSecureValue(): IdentityWithReverseSideSecureValue =
this as IdentityWithReverseSideSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenInternalPassportSecureValue(block: (InternalPassportSecureValue) -> T) =
asInternalPassportSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.asInternalPassportSecureValue(): InternalPassportSecureValue? =
this as? InternalPassportSecureValue
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireInternalPassportSecureValue(): InternalPassportSecureValue =
this as InternalPassportSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenOtherDocumentsSecureValue(block: (OtherDocumentsSecureValue) -> T) =
asOtherDocumentsSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asOtherDocumentsSecureValue(): OtherDocumentsSecureValue? = this as? OtherDocumentsSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireOtherDocumentsSecureValue(): OtherDocumentsSecureValue = this as OtherDocumentsSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenPassportRegistrationSecureValue(block: (PassportRegistrationSecureValue) -> T) =
asPassportRegistrationSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.asPassportRegistrationSecureValue(): PassportRegistrationSecureValue? =
this as? PassportRegistrationSecureValue
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requirePassportRegistrationSecureValue(): PassportRegistrationSecureValue =
this as PassportRegistrationSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenPassportSecureValue(block: (PassportSecureValue) -> T) =
asPassportSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asPassportSecureValue(): PassportSecureValue? = this as? PassportSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requirePassportSecureValue(): PassportSecureValue = this as PassportSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenPersonalDetailsSecureValue(block: (PersonalDetailsSecureValue) -> T) =
asPersonalDetailsSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asPersonalDetailsSecureValue(): PersonalDetailsSecureValue? = this as? PersonalDetailsSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requirePersonalDetailsSecureValue(): PersonalDetailsSecureValue =
this as PersonalDetailsSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenRentalAgreementSecureValue(block: (RentalAgreementSecureValue) -> T) =
asRentalAgreementSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asRentalAgreementSecureValue(): RentalAgreementSecureValue? = this as? RentalAgreementSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireRentalAgreementSecureValue(): RentalAgreementSecureValue =
this as RentalAgreementSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenTemporalRegistrationSecureValue(block: (TemporalRegistrationSecureValue) -> T) =
asTemporalRegistrationSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.asTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue? =
this as? TemporalRegistrationSecureValue
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireTemporalRegistrationSecureValue(): TemporalRegistrationSecureValue =
this as TemporalRegistrationSecureValue
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenUtilityBillSecureValue(block: (UtilityBillSecureValue) -> T) =
asUtilityBillSecureValue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asUtilityBillSecureValue(): UtilityBillSecureValue? = this as? UtilityBillSecureValue
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireUtilityBillSecureValue(): UtilityBillSecureValue = this as UtilityBillSecureValue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenSecureValueIdentity(block: (SecureValueIdentity) -> T) =
asSecureValueIdentity()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asSecureValueIdentity(): SecureValueIdentity? = this as? SecureValueIdentity
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireSecureValueIdentity(): SecureValueIdentity = this as SecureValueIdentity
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenSecureValueWithData(block: (SecureValueWithData) -> T) =
asSecureValueWithData()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asSecureValueWithData(): SecureValueWithData? = this as? SecureValueWithData
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireSecureValueWithData(): SecureValueWithData = this as SecureValueWithData
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenSecureValueWithFiles(block: (SecureValueWithFiles) -> T) =
asSecureValueWithFiles()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asSecureValueWithFiles(): SecureValueWithFiles? = this as? SecureValueWithFiles
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.requireSecureValueWithFiles(): SecureValueWithFiles = this as SecureValueWithFiles
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenSecureValueWithReverseSide(block: (SecureValueWithReverseSide) -> T) =
asSecureValueWithReverseSide()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
inline fun SecureValue.asSecureValueWithReverseSide(): SecureValueWithReverseSide? = this as? SecureValueWithReverseSide
2021-05-29 09:34:14 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireSecureValueWithReverseSide(): SecureValueWithReverseSide =
this as SecureValueWithReverseSide
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> SecureValue.whenSecureValueWithTranslations(block: (SecureValueWithTranslations) -> T) =
asSecureValueWithTranslations()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.asSecureValueWithTranslations(): SecureValueWithTranslations? =
this as? SecureValueWithTranslations
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun SecureValue.requireSecureValueWithTranslations(): SecureValueWithTranslations =
this as SecureValueWithTranslations
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenAnonymousGroupContentMessageImpl(block: (AnonymousGroupContentMessageImpl<MessageContent>) -> T) =
asAnonymousGroupContentMessageImpl()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-28 16:21:21 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent>? =
this as? AnonymousGroupContentMessageImpl<MessageContent>
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireAnonymousGroupContentMessageImpl(): AnonymousGroupContentMessageImpl<MessageContent> =
this as AnonymousGroupContentMessageImpl<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenChannelContentMessageImpl(block: (UnconnectedFromChannelGroupContentMessageImpl<MessageContent>) -> T) =
asChannelContentMessageImpl()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.asChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent>? =
this as? UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.requireChannelContentMessageImpl(): UnconnectedFromChannelGroupContentMessageImpl<MessageContent> =
this as UnconnectedFromChannelGroupContentMessageImpl<MessageContent>
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPassportMessage(block: (PassportMessage) -> T) = asPassportMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun Message.asPassportMessage(): PassportMessage? = this as? PassportMessage
2021-05-29 09:34:14 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
inline fun Message.requirePassportMessage(): PassportMessage = this as PassportMessage
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPrivateContentMessageImpl(block: (PrivateContentMessageImpl<MessageContent>) -> T) =
asPrivateContentMessageImpl()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asPrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent>? =
this as? PrivateContentMessageImpl<MessageContent>
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requirePrivateContentMessageImpl(): PrivateContentMessageImpl<MessageContent> =
this as PrivateContentMessageImpl<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenChannelEventMessage(block: (ChannelEventMessage<ChannelEvent>) -> T) =
asChannelEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-23 15:10:57 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asChannelEventMessage(): ChannelEventMessage<ChannelEvent>? =
this as? ChannelEventMessage<ChannelEvent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireChannelEventMessage(): ChannelEventMessage<ChannelEvent> =
this as ChannelEventMessage<ChannelEvent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenChannelMediaGroupMessage(block: (ChannelMediaGroupMessage<MediaGroupContent>) -> T) =
asChannelMediaGroupMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asChannelMediaGroupMessage(): ChannelMediaGroupMessage<MediaGroupContent>? =
this as? ChannelMediaGroupMessage<MediaGroupContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireChannelMediaGroupMessage(): ChannelMediaGroupMessage<MediaGroupContent> =
this as ChannelMediaGroupMessage<MediaGroupContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenCommonGroupEventMessage(block: (CommonGroupEventMessage<GroupEvent>) -> T) =
asCommonGroupEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent>? =
this as? CommonGroupEventMessage<GroupEvent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireCommonGroupEventMessage(): CommonGroupEventMessage<GroupEvent> =
this as CommonGroupEventMessage<GroupEvent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenCommonMediaGroupMessage(block: (CommonMediaGroupMessage<MediaGroupContent>) -> T) =
asCommonMediaGroupMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asCommonMediaGroupMessage(): CommonMediaGroupMessage<MediaGroupContent>? =
this as? CommonMediaGroupMessage<MediaGroupContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireCommonMediaGroupMessage(): CommonMediaGroupMessage<MediaGroupContent> =
this as CommonMediaGroupMessage<MediaGroupContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenCommonSupergroupEventMessage(block: (CommonSupergroupEventMessage<SupergroupEvent>) -> T) =
asCommonSupergroupEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent>? =
this as? CommonSupergroupEventMessage<SupergroupEvent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireCommonSupergroupEventMessage(): CommonSupergroupEventMessage<SupergroupEvent> =
this as CommonSupergroupEventMessage<SupergroupEvent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenAnonymousGroupContentMessage(block: (AnonymousGroupContentMessage<MessageContent>) -> T) =
asAnonymousGroupContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent>? =
this as? AnonymousGroupContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireAnonymousGroupContentMessage(): AnonymousGroupContentMessage<MessageContent> =
this as AnonymousGroupContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
inline fun <T> Message.whenChannelContentMessage(block: (ChannelContentMessage<MessageContent>) -> T) =
asChannelContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun Message.asChannelContentMessage(): ChannelContentMessage<MessageContent>? =
2021-12-18 16:28:01 +00:00
this as? ChannelContentMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-12-18 16:28:01 +00:00
inline fun Message.requireChannelContentMessage(): ChannelContentMessage<MessageContent> =
this as ChannelContentMessage<MessageContent>
@PreviewFeature
inline fun <T> Message.whenConnectedFromChannelGroupContentMessage(block: (ConnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
asConnectedFromChannelGroupContentMessage()?.let(block)
2021-12-18 16:28:01 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.asConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent>? =
2022-01-01 20:00:22 +00:00
this as? ConnectedFromChannelGroupContentMessage<MessageContent>
2021-12-18 16:28:01 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.requireConnectedFromChannelGroupContentMessage(): ConnectedFromChannelGroupContentMessage<MessageContent> =
this as ConnectedFromChannelGroupContentMessage<MessageContent>
2021-12-18 16:28:01 +00:00
@PreviewFeature
inline fun <T> Message.whenUnconnectedFromChannelGroupContentMessage(block: (UnconnectedFromChannelGroupContentMessage<MessageContent>) -> T) =
asUnconnectedFromChannelGroupContentMessage()?.let(block)
2021-12-18 16:28:01 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.asUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent>? =
this as? UnconnectedFromChannelGroupContentMessage<MessageContent>
2021-12-18 16:28:01 +00:00
@PreviewFeature
2021-12-20 08:07:45 +00:00
inline fun Message.requireUnconnectedFromChannelGroupContentMessage(): UnconnectedFromChannelGroupContentMessage<MessageContent> =
this as UnconnectedFromChannelGroupContentMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenChatEventMessage(block: (ChatEventMessage<ChatEvent>) -> T) =
asChatEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.asChatEventMessage(): ChatEventMessage<ChatEvent>? = this as? ChatEventMessage<ChatEvent>
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireChatEventMessage(): ChatEventMessage<ChatEvent> = this as ChatEventMessage<ChatEvent>
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenCommonGroupContentMessage(block: (CommonGroupContentMessage<MessageContent>) -> T) =
asCommonGroupContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent>? =
this as? CommonGroupContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireCommonGroupContentMessage(): CommonGroupContentMessage<MessageContent> =
this as CommonGroupContentMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenCommonMessage(block: (CommonMessage<MessageContent>) -> T) = asCommonMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.asCommonMessage(): CommonMessage<MessageContent>? = this as? CommonMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireCommonMessage(): CommonMessage<MessageContent> = this as CommonMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenContentMessage(block: (ContentMessage<MessageContent>) -> T) = asContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.asContentMessage(): ContentMessage<MessageContent>? = this as? ContentMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireContentMessage(): ContentMessage<MessageContent> = this as ContentMessage<MessageContent>
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenFromChannelGroupContentMessage(block: (FromChannelGroupContentMessage<MessageContent>) -> T) =
asFromChannelGroupContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent>? =
this as? FromChannelGroupContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireFromChannelGroupContentMessage(): FromChannelGroupContentMessage<MessageContent> =
this as FromChannelGroupContentMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenGroupEventMessage(block: (GroupEventMessage<GroupEvent>) -> T) =
asGroupEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.asGroupEventMessage(): GroupEventMessage<GroupEvent>? = this as? GroupEventMessage<GroupEvent>
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireGroupEventMessage(): GroupEventMessage<GroupEvent> = this as GroupEventMessage<GroupEvent>
2021-05-29 09:34:14 +00:00
2021-10-03 05:43:15 +00:00
@PreviewFeature
inline fun <T> Message.whenPrivateEventMessage(block: (PrivateEventMessage<PrivateEvent>) -> T) =
asPrivateEventMessage()?.let(block)
2021-10-03 05:43:15 +00:00
@PreviewFeature
inline fun Message.asPrivateEventMessage(): PrivateEventMessage<PrivateEvent>? =
this as? PrivateEventMessage<PrivateEvent>
2021-10-03 05:43:15 +00:00
@PreviewFeature
inline fun Message.requirePrivateEventMessage(): PrivateEventMessage<PrivateEvent> =
this as PrivateEventMessage<PrivateEvent>
2021-10-03 05:43:15 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenGroupContentMessage(block: (GroupContentMessage<MessageContent>) -> T) =
asGroupContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asGroupContentMessage(): GroupContentMessage<MessageContent>? =
this as? GroupContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireGroupContentMessage(): GroupContentMessage<MessageContent> =
this as GroupContentMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenMediaGroupMessage(block: (MediaGroupMessage<MediaGroupContent>) -> T) =
asMediaGroupMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asMediaGroupMessage(): MediaGroupMessage<MediaGroupContent>? =
this as? MediaGroupMessage<MediaGroupContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireMediaGroupMessage(): MediaGroupMessage<MediaGroupContent> =
this as MediaGroupMessage<MediaGroupContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPossiblyEditedMessage(block: (PossiblyEditedMessage) -> T) =
asPossiblyEditedMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Message.asPossiblyEditedMessage(): PossiblyEditedMessage? = this as? PossiblyEditedMessage
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requirePossiblyEditedMessage(): PossiblyEditedMessage = this as PossiblyEditedMessage
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> Message.whenPossiblyReplyMessage(block: (PossiblyReplyMessage) -> T) =
asPossiblyReplyMessage()?.let(block)
@PreviewFeature
inline fun Message.asPossiblyReplyMessage(): PossiblyReplyMessage? = this as? PossiblyReplyMessage
@PreviewFeature
inline fun Message.requirePossiblyReplyMessage(): PossiblyReplyMessage = this as PossiblyReplyMessage
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPossiblyForwardedMessage(block: (PossiblyForwardedMessage) -> T) =
asPossiblyForwardedMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Message.asPossiblyForwardedMessage(): PossiblyForwardedMessage? = this as? PossiblyForwardedMessage
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requirePossiblyForwardedMessage(): PossiblyForwardedMessage = this as PossiblyForwardedMessage
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPossiblyPaymentMessage(block: (PossiblyPaymentMessage) -> T) =
asPossiblyPaymentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Message.asPossiblyPaymentMessage(): PossiblyPaymentMessage? = this as? PossiblyPaymentMessage
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requirePossiblyPaymentMessage(): PossiblyPaymentMessage = this as PossiblyPaymentMessage
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPrivateContentMessage(block: (PrivateContentMessage<MessageContent>) -> T) =
asPrivateContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asPrivateContentMessage(): PrivateContentMessage<MessageContent>? =
this as? PrivateContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requirePrivateContentMessage(): PrivateContentMessage<MessageContent> =
this as PrivateContentMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPublicContentMessage(block: (PublicContentMessage<MessageContent>) -> T) =
asPublicContentMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asPublicContentMessage(): PublicContentMessage<MessageContent>? =
this as? PublicContentMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requirePublicContentMessage(): PublicContentMessage<MessageContent> =
this as PublicContentMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenSignedMessage(block: (SignedMessage) -> T) = asSignedMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Message.asSignedMessage(): SignedMessage? = this as? SignedMessage
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireSignedMessage(): SignedMessage = this as SignedMessage
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenSupergroupEventMessage(block: (SupergroupEventMessage<SupergroupEvent>) -> T) =
asSupergroupEventMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent>? =
this as? SupergroupEventMessage<SupergroupEvent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requireSupergroupEventMessage(): SupergroupEventMessage<SupergroupEvent> =
this as SupergroupEventMessage<SupergroupEvent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenUnknownMessageType(block: (UnknownMessageType) -> T) = asUnknownMessageType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Message.asUnknownMessageType(): UnknownMessageType? = this as? UnknownMessageType
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Message.requireUnknownMessageType(): UnknownMessageType = this as UnknownMessageType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenPossiblySentViaBotCommonMessage(block: (PossiblySentViaBotCommonMessage<MessageContent>) -> T) =
asPossiblySentViaBotCommonMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.asPossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent>? =
this as? PossiblySentViaBotCommonMessage<MessageContent>
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Message.requirePossiblySentViaBotCommonMessage(): PossiblySentViaBotCommonMessage<MessageContent> =
this as PossiblySentViaBotCommonMessage<MessageContent>
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Message.whenFromUserMessage(block: (FromUserMessage) -> T) = asFromUserMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-04-16 16:00:45 +00:00
inline fun Message.asFromUserMessage(): FromUserMessage? = this as? FromUserMessage
2021-05-29 09:34:14 +00:00
2021-04-16 16:00:45 +00:00
@PreviewFeature
inline fun Message.requireFromUserMessage(): FromUserMessage = this as FromUserMessage
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenFindLocationAction(block: (FindLocationAction) -> T) = asFindLocationAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-16 16:00:45 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asFindLocationAction(): FindLocationAction? = this as? FindLocationAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireFindLocationAction(): FindLocationAction = this as FindLocationAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenRecordVoiceAction(block: (RecordVoiceAction) -> T) = asRecordVoiceAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-04-26 14:52:20 +00:00
inline fun BotAction.asRecordVoiceAction(): RecordVoiceAction? = this as? RecordVoiceAction
2021-05-29 09:34:14 +00:00
2021-04-26 14:52:20 +00:00
@PreviewFeature
inline fun BotAction.requireRecordVoiceAction(): RecordVoiceAction = this as RecordVoiceAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenRecordVideoAction(block: (RecordVideoAction) -> T) = asRecordVideoAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-26 14:52:20 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asRecordVideoAction(): RecordVideoAction? = this as? RecordVideoAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireRecordVideoAction(): RecordVideoAction = this as RecordVideoAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenRecordVideoNoteAction(block: (RecordVideoNoteAction) -> T) =
asRecordVideoNoteAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asRecordVideoNoteAction(): RecordVideoNoteAction? = this as? RecordVideoNoteAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireRecordVideoNoteAction(): RecordVideoNoteAction = this as RecordVideoNoteAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenTypingAction(block: (TypingAction) -> T) = asTypingAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asTypingAction(): TypingAction? = this as? TypingAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireTypingAction(): TypingAction = this as TypingAction
2021-05-29 09:34:14 +00:00
2021-11-08 12:36:17 +00:00
@PreviewFeature
inline fun <T> BotAction.whenChooseStickerAction(block: (ChooseStickerAction) -> T) =
asChooseStickerAction()?.let(block)
2021-11-08 12:36:17 +00:00
@PreviewFeature
inline fun BotAction.asChooseStickerAction(): ChooseStickerAction? = this as? ChooseStickerAction
@PreviewFeature
inline fun BotAction.requireChooseStickerAction(): ChooseStickerAction = this as ChooseStickerAction
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenUploadVoiceAction(block: (UploadVoiceAction) -> T) = asUploadVoiceAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-04-26 14:52:20 +00:00
inline fun BotAction.asUploadVoiceAction(): UploadVoiceAction? = this as? UploadVoiceAction
2021-05-29 09:34:14 +00:00
2021-04-26 14:52:20 +00:00
@PreviewFeature
inline fun BotAction.requireUploadVoiceAction(): UploadVoiceAction = this as UploadVoiceAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenUploadDocumentAction(block: (UploadDocumentAction) -> T) =
asUploadDocumentAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-26 14:52:20 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asUploadDocumentAction(): UploadDocumentAction? = this as? UploadDocumentAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireUploadDocumentAction(): UploadDocumentAction = this as UploadDocumentAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenUploadPhotoAction(block: (UploadPhotoAction) -> T) = asUploadPhotoAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asUploadPhotoAction(): UploadPhotoAction? = this as? UploadPhotoAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireUploadPhotoAction(): UploadPhotoAction = this as UploadPhotoAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenUploadVideoAction(block: (UploadVideoAction) -> T) = asUploadVideoAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asUploadVideoAction(): UploadVideoAction? = this as? UploadVideoAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireUploadVideoAction(): UploadVideoAction = this as UploadVideoAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> BotAction.whenUploadVideoNoteAction(block: (UploadVideoNoteAction) -> T) =
asUploadVideoNoteAction()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun BotAction.asUploadVideoNoteAction(): UploadVideoNoteAction? = this as? UploadVideoNoteAction
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun BotAction.requireUploadVideoNoteAction(): UploadVideoNoteAction = this as UploadVideoNoteAction
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQuery.whenBaseInlineQuery(block: (BaseInlineQuery) -> T) = asBaseInlineQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-06-03 17:34:11 +00:00
inline fun InlineQuery.asBaseInlineQuery(): BaseInlineQuery? =
2021-05-29 09:34:14 +00:00
this as? BaseInlineQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-06-03 17:34:11 +00:00
inline fun InlineQuery.requireBaseInlineQuery(): BaseInlineQuery =
2021-05-29 09:34:14 +00:00
this as BaseInlineQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQuery.whenLocationInlineQuery(block: (LocationInlineQuery) -> T) =
asLocationInlineQuery()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-06-03 17:34:11 +00:00
inline fun InlineQuery.asLocationInlineQuery(): LocationInlineQuery? =
2021-05-29 09:34:14 +00:00
this as? LocationInlineQuery
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-06-03 17:34:11 +00:00
inline fun InlineQuery.requireLocationInlineQuery(): LocationInlineQuery =
2021-05-29 09:34:14 +00:00
this as LocationInlineQuery
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InputMessageContent.whenInputContactMessageContent(block: (InputContactMessageContent) -> T) =
asInputContactMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.asInputContactMessageContent(): InputContactMessageContent? =
this as? InputContactMessageContent
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.requireInputContactMessageContent(): InputContactMessageContent =
this as InputContactMessageContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InputMessageContent.whenInputLocationMessageContent(block: (InputLocationMessageContent) -> T) =
asInputLocationMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.asInputLocationMessageContent(): InputLocationMessageContent? =
this as? InputLocationMessageContent
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.requireInputLocationMessageContent(): InputLocationMessageContent =
this as InputLocationMessageContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InputMessageContent.whenInputTextMessageContent(block: (InputTextMessageContent) -> T) =
asInputTextMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InputMessageContent.asInputTextMessageContent(): InputTextMessageContent? = this as? InputTextMessageContent
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.requireInputTextMessageContent(): InputTextMessageContent =
this as InputTextMessageContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InputMessageContent.whenInputVenueMessageContent(block: (InputVenueMessageContent) -> T) =
asInputVenueMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.asInputVenueMessageContent(): InputVenueMessageContent? =
this as? InputVenueMessageContent
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.requireInputVenueMessageContent(): InputVenueMessageContent =
this as InputVenueMessageContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InputMessageContent.whenInputInvoiceMessageContent(block: (InputInvoiceMessageContent) -> T) =
asInputInvoiceMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.asInputInvoiceMessageContent(): InputInvoiceMessageContent? =
this as? InputInvoiceMessageContent
2021-04-28 14:08:02 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InputMessageContent.requireInputInvoiceMessageContent(): InputInvoiceMessageContent =
this as InputInvoiceMessageContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultArticle(block: (InlineQueryResultArticle) -> T) =
asInlineQueryResultArticle()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-28 14:08:02 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultArticle(): InlineQueryResultArticle? = this as? InlineQueryResultArticle
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultArticle(): InlineQueryResultArticle =
this as InlineQueryResultArticle
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultContact(block: (InlineQueryResultContact) -> T) =
asInlineQueryResultContact()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultContact(): InlineQueryResultContact? = this as? InlineQueryResultContact
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultContact(): InlineQueryResultContact =
this as InlineQueryResultContact
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultGame(block: (InlineQueryResultGame) -> T) =
asInlineQueryResultGame()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultGame(): InlineQueryResultGame? = this as? InlineQueryResultGame
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultGame(): InlineQueryResultGame = this as InlineQueryResultGame
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultLocation(block: (InlineQueryResultLocation) -> T) =
asInlineQueryResultLocation()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultLocation(): InlineQueryResultLocation? =
this as? InlineQueryResultLocation
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultLocation(): InlineQueryResultLocation =
this as InlineQueryResultLocation
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultStickerCached(block: (InlineQueryResultStickerCached) -> T) =
asInlineQueryResultStickerCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultStickerCached(): InlineQueryResultStickerCached? =
this as? InlineQueryResultStickerCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultStickerCached(): InlineQueryResultStickerCached =
this as InlineQueryResultStickerCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVenue(block: (InlineQueryResultVenue) -> T) =
asInlineQueryResultVenue()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultVenue(): InlineQueryResultVenue? = this as? InlineQueryResultVenue
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVenue(): InlineQueryResultVenue = this as InlineQueryResultVenue
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenDescribedInlineQueryResult(block: (DescribedInlineQueryResult) -> T) =
asDescribedInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asDescribedInlineQueryResult(): DescribedInlineQueryResult? =
this as? DescribedInlineQueryResult
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireDescribedInlineQueryResult(): DescribedInlineQueryResult =
this as DescribedInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenFileInlineQueryResult(block: (FileInlineQueryResult) -> T) =
asFileInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asFileInlineQueryResult(): FileInlineQueryResult? = this as? FileInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireFileInlineQueryResult(): FileInlineQueryResult = this as FileInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenOptionallyTitledInlineQueryResult(block: (OptionallyTitledInlineQueryResult) -> T) =
asOptionallyTitledInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult? =
this as? OptionallyTitledInlineQueryResult
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireOptionallyTitledInlineQueryResult(): OptionallyTitledInlineQueryResult =
this as OptionallyTitledInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenSizedInlineQueryResult(block: (SizedInlineQueryResult) -> T) =
asSizedInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asSizedInlineQueryResult(): SizedInlineQueryResult? = this as? SizedInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireSizedInlineQueryResult(): SizedInlineQueryResult = this as SizedInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenThumbSizedInlineQueryResult(block: (ThumbSizedInlineQueryResult) -> T) =
asThumbSizedInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult? =
this as? ThumbSizedInlineQueryResult
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireThumbSizedInlineQueryResult(): ThumbSizedInlineQueryResult =
this as ThumbSizedInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenThumbedInlineQueryResult(block: (ThumbedInlineQueryResult) -> T) =
asThumbedInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asThumbedInlineQueryResult(): ThumbedInlineQueryResult? = this as? ThumbedInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireThumbedInlineQueryResult(): ThumbedInlineQueryResult =
this as ThumbedInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenThumbedWithMimeTypeInlineQueryResult(block: (ThumbedWithMimeTypeInlineQueryResult) -> T) =
asThumbedWithMimeTypeInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult? =
this as? ThumbedWithMimeTypeInlineQueryResult
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireThumbedWithMimeTypeInlineQueryResult(): ThumbedWithMimeTypeInlineQueryResult =
this as ThumbedWithMimeTypeInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenTitledInlineQueryResult(block: (TitledInlineQueryResult) -> T) =
asTitledInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asTitledInlineQueryResult(): TitledInlineQueryResult? = this as? TitledInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireTitledInlineQueryResult(): TitledInlineQueryResult = this as TitledInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenUrlInlineQueryResult(block: (UrlInlineQueryResult) -> T) =
asUrlInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asUrlInlineQueryResult(): UrlInlineQueryResult? = this as? UrlInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireUrlInlineQueryResult(): UrlInlineQueryResult = this as UrlInlineQueryResult
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenWithInputMessageContentInlineQueryResult(block: (WithInputMessageContentInlineQueryResult) -> T) =
asWithInputMessageContentInlineQueryResult()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult? =
this as? WithInputMessageContentInlineQueryResult
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireWithInputMessageContentInlineQueryResult(): WithInputMessageContentInlineQueryResult =
this as WithInputMessageContentInlineQueryResult
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultAudio(block: (InlineQueryResultAudio) -> T) =
asInlineQueryResultAudio()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultAudio(): InlineQueryResultAudio? = this as? InlineQueryResultAudio
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultAudio(): InlineQueryResultAudio = this as InlineQueryResultAudio
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultAudioCached(block: (InlineQueryResultAudioCached) -> T) =
asInlineQueryResultAudioCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultAudioCached(): InlineQueryResultAudioCached? =
this as? InlineQueryResultAudioCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultAudioCached(): InlineQueryResultAudioCached =
this as InlineQueryResultAudioCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultAudioCommon(block: (InlineQueryResultAudioCommon) -> T) =
asInlineQueryResultAudioCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon? =
this as? InlineQueryResultAudioCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultAudioCommon(): InlineQueryResultAudioCommon =
this as InlineQueryResultAudioCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultDocument(block: (InlineQueryResultDocument) -> T) =
asInlineQueryResultDocument()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultDocument(): InlineQueryResultDocument? =
this as? InlineQueryResultDocument
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultDocument(): InlineQueryResultDocument =
this as InlineQueryResultDocument
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultDocumentCached(block: (InlineQueryResultDocumentCached) -> T) =
asInlineQueryResultDocumentCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached? =
this as? InlineQueryResultDocumentCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultDocumentCached(): InlineQueryResultDocumentCached =
this as InlineQueryResultDocumentCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultDocumentCommon(block: (InlineQueryResultDocumentCommon) -> T) =
asInlineQueryResultDocumentCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon? =
this as? InlineQueryResultDocumentCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultDocumentCommon(): InlineQueryResultDocumentCommon =
this as InlineQueryResultDocumentCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultGif(block: (InlineQueryResultGif) -> T) =
asInlineQueryResultGif()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultGif(): InlineQueryResultGif? = this as? InlineQueryResultGif
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultGif(): InlineQueryResultGif = this as InlineQueryResultGif
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultGifCached(block: (InlineQueryResultGifCached) -> T) =
asInlineQueryResultGifCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultGifCached(): InlineQueryResultGifCached? =
this as? InlineQueryResultGifCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultGifCached(): InlineQueryResultGifCached =
this as InlineQueryResultGifCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultGifCommon(block: (InlineQueryResultGifCommon) -> T) =
asInlineQueryResultGifCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultGifCommon(): InlineQueryResultGifCommon? =
this as? InlineQueryResultGifCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultGifCommon(): InlineQueryResultGifCommon =
this as InlineQueryResultGifCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultMpeg4Gif(block: (InlineQueryResultMpeg4Gif) -> T) =
asInlineQueryResultMpeg4Gif()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif? =
this as? InlineQueryResultMpeg4Gif
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultMpeg4Gif(): InlineQueryResultMpeg4Gif =
this as InlineQueryResultMpeg4Gif
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultMpeg4GifCached(block: (InlineQueryResultMpeg4GifCached) -> T) =
asInlineQueryResultMpeg4GifCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached? =
this as? InlineQueryResultMpeg4GifCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCached(): InlineQueryResultMpeg4GifCached =
this as InlineQueryResultMpeg4GifCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultMpeg4GifCommon(block: (InlineQueryResultMpeg4GifCommon) -> T) =
asInlineQueryResultMpeg4GifCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon? =
this as? InlineQueryResultMpeg4GifCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultMpeg4GifCommon(): InlineQueryResultMpeg4GifCommon =
this as InlineQueryResultMpeg4GifCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultPhoto(block: (InlineQueryResultPhoto) -> T) =
asInlineQueryResultPhoto()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultPhoto(): InlineQueryResultPhoto? = this as? InlineQueryResultPhoto
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultPhoto(): InlineQueryResultPhoto = this as InlineQueryResultPhoto
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultPhotoCached(block: (InlineQueryResultPhotoCached) -> T) =
asInlineQueryResultPhotoCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached? =
this as? InlineQueryResultPhotoCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultPhotoCached(): InlineQueryResultPhotoCached =
this as InlineQueryResultPhotoCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultPhotoCommon(block: (InlineQueryResultPhotoCommon) -> T) =
asInlineQueryResultPhotoCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon? =
this as? InlineQueryResultPhotoCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultPhotoCommon(): InlineQueryResultPhotoCommon =
this as InlineQueryResultPhotoCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVideo(block: (InlineQueryResultVideo) -> T) =
asInlineQueryResultVideo()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultVideo(): InlineQueryResultVideo? = this as? InlineQueryResultVideo
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVideo(): InlineQueryResultVideo = this as InlineQueryResultVideo
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVideoCached(block: (InlineQueryResultVideoCached) -> T) =
asInlineQueryResultVideoCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultVideoCached(): InlineQueryResultVideoCached? =
this as? InlineQueryResultVideoCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVideoCached(): InlineQueryResultVideoCached =
this as InlineQueryResultVideoCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVideoCommon(block: (InlineQueryResultVideoCommon) -> T) =
asInlineQueryResultVideoCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon? =
this as? InlineQueryResultVideoCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVideoCommon(): InlineQueryResultVideoCommon =
this as InlineQueryResultVideoCommon
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVoice(block: (InlineQueryResultVoice) -> T) =
asInlineQueryResultVoice()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineQueryResult.asInlineQueryResultVoice(): InlineQueryResultVoice? = this as? InlineQueryResultVoice
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVoice(): InlineQueryResultVoice = this as InlineQueryResultVoice
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVoiceCached(block: (InlineQueryResultVoiceCached) -> T) =
asInlineQueryResultVoiceCached()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached? =
this as? InlineQueryResultVoiceCached
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVoiceCached(): InlineQueryResultVoiceCached =
this as InlineQueryResultVoiceCached
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineQueryResult.whenInlineQueryResultVoiceCommon(block: (InlineQueryResultVoiceCommon) -> T) =
asInlineQueryResultVoiceCommon()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.asInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon? =
this as? InlineQueryResultVoiceCommon
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineQueryResult.requireInlineQueryResultVoiceCommon(): InlineQueryResultVoiceCommon =
this as InlineQueryResultVoiceCommon
2022-07-10 20:05:10 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenOwnerChatMember(block: (OwnerChatMember) -> T) = asOwnerChatMember()?.let(block)
2022-07-10 20:05:10 +00:00
@PreviewFeature
inline fun ChatMember.asOwnerChatMember(): OwnerChatMember? = this as? OwnerChatMember
@PreviewFeature
inline fun ChatMember.requireOwnerChatMember(): OwnerChatMember = this as OwnerChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenKickedChatMember(block: (KickedChatMember) -> T) = asKickedChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asKickedChatMember(): KickedChatMember? = this as? KickedChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireKickedChatMember(): KickedChatMember = this as KickedChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenLeftChatMember(block: (LeftChatMember) -> T) = asLeftChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asLeftChatMember(): LeftChatMember? = this as? LeftChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireLeftChatMember(): LeftChatMember = this as LeftChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenMemberChatMember(block: (MemberChatMember) -> T) = asMemberChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asMemberChatMember(): MemberChatMember? = this as? MemberChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireMemberChatMember(): MemberChatMember = this as MemberChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenRestrictedChatMember(block: (RestrictedChatMember) -> T) =
asRestrictedChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asRestrictedChatMember(): RestrictedChatMember? = this as? RestrictedChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireRestrictedChatMember(): RestrictedChatMember = this as RestrictedChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenAdministratorChatMember(block: (AdministratorChatMember) -> T) =
asAdministratorChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asAdministratorChatMember(): AdministratorChatMember? = this as? AdministratorChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireAdministratorChatMember(): AdministratorChatMember = this as AdministratorChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenBannedChatMember(block: (BannedChatMember) -> T) = asBannedChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asBannedChatMember(): BannedChatMember? = this as? BannedChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireBannedChatMember(): BannedChatMember = this as BannedChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatMember.whenSpecialRightsChatMember(block: (SpecialRightsChatMember) -> T) =
asSpecialRightsChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun ChatMember.asSpecialRightsChatMember(): SpecialRightsChatMember? = this as? SpecialRightsChatMember
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun ChatMember.requireSpecialRightsChatMember(): SpecialRightsChatMember = this as SpecialRightsChatMember
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> TelegramMedia.whenAudioMediaGroupMemberTelegramMedia(block: (AudioMediaGroupMemberTelegramMedia) -> T) =
asAudioMediaGroupMemberTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asAudioMediaGroupMemberTelegramMedia(): AudioMediaGroupMemberTelegramMedia? =
this as? AudioMediaGroupMemberTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireAudioMediaGroupMemberTelegramMedia(): AudioMediaGroupMemberTelegramMedia =
this as AudioMediaGroupMemberTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenDocumentMediaGroupMemberTelegramMedia(block: (DocumentMediaGroupMemberTelegramMedia) -> T) =
asDocumentMediaGroupMemberTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asDocumentMediaGroupMemberTelegramMedia(): DocumentMediaGroupMemberTelegramMedia? =
this as? DocumentMediaGroupMemberTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireDocumentMediaGroupMemberTelegramMedia(): DocumentMediaGroupMemberTelegramMedia =
this as DocumentMediaGroupMemberTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenDuratedTelegramMedia(block: (DuratedTelegramMedia) -> T) =
asDuratedTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asDuratedTelegramMedia(): DuratedTelegramMedia? = this as? DuratedTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireDuratedTelegramMedia(): DuratedTelegramMedia = this as DuratedTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenTelegramMediaAnimation(block: (TelegramMediaAnimation) -> T) =
asTelegramMediaAnimation()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTelegramMediaAnimation(): TelegramMediaAnimation? = this as? TelegramMediaAnimation
@PreviewFeature
inline fun TelegramMedia.requireTelegramMediaAnimation(): TelegramMediaAnimation = this as TelegramMediaAnimation
@PreviewFeature
inline fun <T> TelegramMedia.whenTelegramMediaAudio(block: (TelegramMediaAudio) -> T) =
asTelegramMediaAudio()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTelegramMediaAudio(): TelegramMediaAudio? = this as? TelegramMediaAudio
@PreviewFeature
inline fun TelegramMedia.requireTelegramMediaAudio(): TelegramMediaAudio = this as TelegramMediaAudio
@PreviewFeature
inline fun <T> TelegramMedia.whenTelegramMediaDocument(block: (TelegramMediaDocument) -> T) =
asTelegramMediaDocument()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTelegramMediaDocument(): TelegramMediaDocument? = this as? TelegramMediaDocument
@PreviewFeature
inline fun TelegramMedia.requireTelegramMediaDocument(): TelegramMediaDocument = this as TelegramMediaDocument
@PreviewFeature
inline fun <T> TelegramMedia.whenTelegramMediaPhoto(block: (TelegramMediaPhoto) -> T) =
asTelegramMediaPhoto()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTelegramMediaPhoto(): TelegramMediaPhoto? = this as? TelegramMediaPhoto
@PreviewFeature
inline fun TelegramMedia.requireTelegramMediaPhoto(): TelegramMediaPhoto = this as TelegramMediaPhoto
@PreviewFeature
inline fun <T> TelegramMedia.whenTelegramMediaVideo(block: (TelegramMediaVideo) -> T) =
asTelegramMediaVideo()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTelegramMediaVideo(): TelegramMediaVideo? = this as? TelegramMediaVideo
@PreviewFeature
inline fun TelegramMedia.requireTelegramMediaVideo(): TelegramMediaVideo = this as TelegramMediaVideo
@PreviewFeature
inline fun <T> TelegramMedia.whenMediaGroupMemberTelegramMedia(block: (MediaGroupMemberTelegramMedia) -> T) =
asMediaGroupMemberTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asMediaGroupMemberTelegramMedia(): MediaGroupMemberTelegramMedia? =
this as? MediaGroupMemberTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireMediaGroupMemberTelegramMedia(): MediaGroupMemberTelegramMedia =
this as MediaGroupMemberTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenSizedTelegramMedia(block: (SizedTelegramMedia) -> T) =
asSizedTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asSizedTelegramMedia(): SizedTelegramMedia? = this as? SizedTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireSizedTelegramMedia(): SizedTelegramMedia = this as SizedTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenThumbedTelegramMedia(block: (ThumbedTelegramMedia) -> T) =
asThumbedTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asThumbedTelegramMedia(): ThumbedTelegramMedia? = this as? ThumbedTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireThumbedTelegramMedia(): ThumbedTelegramMedia = this as ThumbedTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenTitledTelegramMedia(block: (TitledTelegramMedia) -> T) =
asTitledTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asTitledTelegramMedia(): TitledTelegramMedia? = this as? TitledTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireTitledTelegramMedia(): TitledTelegramMedia = this as TitledTelegramMedia
@PreviewFeature
inline fun <T> TelegramMedia.whenVisualMediaGroupMemberTelegramMedia(block: (VisualMediaGroupMemberTelegramMedia) -> T) =
asVisualMediaGroupMemberTelegramMedia()?.let(block)
@PreviewFeature
inline fun TelegramMedia.asVisualMediaGroupMemberTelegramMedia(): VisualMediaGroupMemberTelegramMedia? =
this as? VisualMediaGroupMemberTelegramMedia
@PreviewFeature
inline fun TelegramMedia.requireVisualMediaGroupMemberTelegramMedia(): VisualMediaGroupMemberTelegramMedia =
this as VisualMediaGroupMemberTelegramMedia
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenCallbackQueryUpdate(block: (CallbackQueryUpdate) -> T) = asCallbackQueryUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asCallbackQueryUpdate(): CallbackQueryUpdate? = this as? CallbackQueryUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireCallbackQueryUpdate(): CallbackQueryUpdate = this as CallbackQueryUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenChannelPostUpdate(block: (ChannelPostUpdate) -> T) = asChannelPostUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asChannelPostUpdate(): ChannelPostUpdate? = this as? ChannelPostUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireChannelPostUpdate(): ChannelPostUpdate = this as ChannelPostUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenChosenInlineResultUpdate(block: (ChosenInlineResultUpdate) -> T) =
asChosenInlineResultUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asChosenInlineResultUpdate(): ChosenInlineResultUpdate? = this as? ChosenInlineResultUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireChosenInlineResultUpdate(): ChosenInlineResultUpdate = this as ChosenInlineResultUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenEditChannelPostUpdate(block: (EditChannelPostUpdate) -> T) =
asEditChannelPostUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asEditChannelPostUpdate(): EditChannelPostUpdate? = this as? EditChannelPostUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireEditChannelPostUpdate(): EditChannelPostUpdate = this as EditChannelPostUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenEditMessageUpdate(block: (EditMessageUpdate) -> T) = asEditMessageUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asEditMessageUpdate(): EditMessageUpdate? = this as? EditMessageUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireEditMessageUpdate(): EditMessageUpdate = this as EditMessageUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenInlineQueryUpdate(block: (InlineQueryUpdate) -> T) = asInlineQueryUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asInlineQueryUpdate(): InlineQueryUpdate? = this as? InlineQueryUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireInlineQueryUpdate(): InlineQueryUpdate = this as InlineQueryUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenChannelPostMediaGroupUpdate(block: (ChannelPostMediaGroupUpdate) -> T) =
asChannelPostMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asChannelPostMediaGroupUpdate(): ChannelPostMediaGroupUpdate? = this as? ChannelPostMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.requireChannelPostMediaGroupUpdate(): ChannelPostMediaGroupUpdate =
this as ChannelPostMediaGroupUpdate
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenEditChannelPostMediaGroupUpdate(block: (EditChannelPostMediaGroupUpdate) -> T) =
asEditChannelPostMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.asEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate? =
this as? EditChannelPostMediaGroupUpdate
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.requireEditChannelPostMediaGroupUpdate(): EditChannelPostMediaGroupUpdate =
this as EditChannelPostMediaGroupUpdate
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenEditMediaGroupUpdate(block: (EditMediaGroupUpdate) -> T) =
asEditMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asEditMediaGroupUpdate(): EditMediaGroupUpdate? = this as? EditMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireEditMediaGroupUpdate(): EditMediaGroupUpdate = this as EditMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenEditMessageMediaGroupUpdate(block: (EditMessageMediaGroupUpdate) -> T) =
asEditMessageMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asEditMessageMediaGroupUpdate(): EditMessageMediaGroupUpdate? = this as? EditMessageMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.requireEditMessageMediaGroupUpdate(): EditMessageMediaGroupUpdate =
this as EditMessageMediaGroupUpdate
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenMediaGroupUpdate(block: (MediaGroupUpdate) -> T) = asMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asMediaGroupUpdate(): MediaGroupUpdate? = this as? MediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireMediaGroupUpdate(): MediaGroupUpdate = this as MediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenMessageMediaGroupUpdate(block: (MessageMediaGroupUpdate) -> T) =
asMessageMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asMessageMediaGroupUpdate(): MessageMediaGroupUpdate? = this as? MessageMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireMessageMediaGroupUpdate(): MessageMediaGroupUpdate = this as MessageMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenSentMediaGroupUpdate(block: (SentMediaGroupUpdate) -> T) =
asSentMediaGroupUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asSentMediaGroupUpdate(): SentMediaGroupUpdate? = this as? SentMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireSentMediaGroupUpdate(): SentMediaGroupUpdate = this as SentMediaGroupUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenMessageUpdate(block: (MessageUpdate) -> T) = asMessageUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asMessageUpdate(): MessageUpdate? = this as? MessageUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireMessageUpdate(): MessageUpdate = this as MessageUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenPollAnswerUpdate(block: (PollAnswerUpdate) -> T) = asPollAnswerUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asPollAnswerUpdate(): PollAnswerUpdate? = this as? PollAnswerUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requirePollAnswerUpdate(): PollAnswerUpdate = this as PollAnswerUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenPollUpdate(block: (PollUpdate) -> T) = asPollUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asPollUpdate(): PollUpdate? = this as? PollUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requirePollUpdate(): PollUpdate = this as PollUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenPreCheckoutQueryUpdate(block: (PreCheckoutQueryUpdate) -> T) =
asPreCheckoutQueryUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asPreCheckoutQueryUpdate(): PreCheckoutQueryUpdate? = this as? PreCheckoutQueryUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requirePreCheckoutQueryUpdate(): PreCheckoutQueryUpdate = this as PreCheckoutQueryUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenShippingQueryUpdate(block: (ShippingQueryUpdate) -> T) = asShippingQueryUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asShippingQueryUpdate(): ShippingQueryUpdate? = this as? ShippingQueryUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireShippingQueryUpdate(): ShippingQueryUpdate = this as ShippingQueryUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenBaseEditMessageUpdate(block: (BaseEditMessageUpdate) -> T) =
asBaseEditMessageUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asBaseEditMessageUpdate(): BaseEditMessageUpdate? = this as? BaseEditMessageUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireBaseEditMessageUpdate(): BaseEditMessageUpdate = this as BaseEditMessageUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenBaseMessageUpdate(block: (BaseMessageUpdate) -> T) = asBaseMessageUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asBaseMessageUpdate(): BaseMessageUpdate? = this as? BaseMessageUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireBaseMessageUpdate(): BaseMessageUpdate = this as BaseMessageUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenBaseSentMessageUpdate(block: (BaseSentMessageUpdate) -> T) =
asBaseSentMessageUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asBaseSentMessageUpdate(): BaseSentMessageUpdate? = this as? BaseSentMessageUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireBaseSentMessageUpdate(): BaseSentMessageUpdate = this as BaseSentMessageUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenUnknownUpdate(block: (UnknownUpdate) -> T) = asUnknownUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Update.asUnknownUpdate(): UnknownUpdate? = this as? UnknownUpdate
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Update.requireUnknownUpdate(): UnknownUpdate = this as UnknownUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenCommonChatMemberUpdatedUpdate(block: (CommonChatMemberUpdatedUpdate) -> T) =
asCommonChatMemberUpdatedUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.asCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate? =
this as? CommonChatMemberUpdatedUpdate
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun Update.requireCommonChatMemberUpdatedUpdate(): CommonChatMemberUpdatedUpdate =
this as CommonChatMemberUpdatedUpdate
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenMyChatMemberUpdatedUpdate(block: (MyChatMemberUpdatedUpdate) -> T) =
asMyChatMemberUpdatedUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun Update.asMyChatMemberUpdatedUpdate(): MyChatMemberUpdatedUpdate? = this as? MyChatMemberUpdatedUpdate
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun Update.requireMyChatMemberUpdatedUpdate(): MyChatMemberUpdatedUpdate = this as MyChatMemberUpdatedUpdate
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Update.whenChatMemberUpdatedUpdate(block: (ChatMemberUpdatedUpdate) -> T) =
asChatMemberUpdatedUpdate()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun Update.asChatMemberUpdatedUpdate(): ChatMemberUpdatedUpdate? = this as? ChatMemberUpdatedUpdate
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun Update.requireChatMemberUpdatedUpdate(): ChatMemberUpdatedUpdate = this as ChatMemberUpdatedUpdate
2021-05-29 09:34:14 +00:00
2021-11-08 12:21:55 +00:00
@PreviewFeature
inline fun <T> Update.whenChatJoinRequestUpdate(block: (ChatJoinRequestUpdate) -> T) =
asChatJoinRequestUpdate()?.let(block)
2021-11-08 12:21:55 +00:00
@PreviewFeature
inline fun Update.asChatJoinRequestUpdate(): ChatJoinRequestUpdate? = this as? ChatJoinRequestUpdate
@PreviewFeature
inline fun Update.requireChatJoinRequestUpdate(): ChatJoinRequestUpdate = this as ChatJoinRequestUpdate
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenAnimationFile(block: (AnimationFile) -> T) = asAnimationFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asAnimationFile(): AnimationFile? = this as? AnimationFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireAnimationFile(): AnimationFile = this as AnimationFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenAudioFile(block: (AudioFile) -> T) = asAudioFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asAudioFile(): AudioFile? = this as? AudioFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireAudioFile(): AudioFile = this as AudioFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenDocumentFile(block: (DocumentFile) -> T) = asDocumentFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asDocumentFile(): DocumentFile? = this as? DocumentFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireDocumentFile(): DocumentFile = this as DocumentFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenFile(block: (File) -> T) = asFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asFile(): File? = this as? File
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireFile(): File = this as File
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenPathedFile(block: (PathedFile) -> T) = asPathedFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asPathedFile(): PathedFile? = this as? PathedFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requirePathedFile(): PathedFile = this as PathedFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenPhotoSize(block: (PhotoSize) -> T) = asPhotoSize()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asPhotoSize(): PhotoSize? = this as? PhotoSize
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requirePhotoSize(): PhotoSize = this as PhotoSize
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenSticker(block: (Sticker) -> T) = asSticker()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asSticker(): Sticker? = this as? Sticker
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireSticker(): Sticker = this as Sticker
2021-05-29 09:34:14 +00:00
2022-02-01 17:25:22 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenSimpleSticker(block: (SimpleSticker) -> T) = asSimpleSticker()?.let(block)
2022-02-01 17:25:22 +00:00
@PreviewFeature
inline fun TelegramMediaFile.asSimpleSticker(): SimpleSticker? = this as? SimpleSticker
@PreviewFeature
inline fun TelegramMediaFile.requireSimpleSticker(): SimpleSticker = this as SimpleSticker
@PreviewFeature
inline fun <T> TelegramMediaFile.whenAnimatedSticker(block: (AnimatedSticker) -> T) = asAnimatedSticker()?.let(block)
2022-02-01 17:25:22 +00:00
@PreviewFeature
inline fun TelegramMediaFile.asAnimatedSticker(): AnimatedSticker? = this as? AnimatedSticker
@PreviewFeature
inline fun TelegramMediaFile.requireAnimatedSticker(): AnimatedSticker = this as AnimatedSticker
@PreviewFeature
inline fun <T> TelegramMediaFile.whenVideoSticker(block: (VideoSticker) -> T) = asVideoSticker()?.let(block)
2022-02-01 17:25:22 +00:00
@PreviewFeature
inline fun TelegramMediaFile.asVideoSticker(): VideoSticker? = this as? VideoSticker
@PreviewFeature
inline fun TelegramMediaFile.requireVideoSticker(): VideoSticker = this as VideoSticker
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenVideoFile(block: (VideoFile) -> T) = asVideoFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asVideoFile(): VideoFile? = this as? VideoFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireVideoFile(): VideoFile = this as VideoFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenVideoNoteFile(block: (VideoNoteFile) -> T) = asVideoNoteFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asVideoNoteFile(): VideoNoteFile? = this as? VideoNoteFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireVideoNoteFile(): VideoNoteFile = this as VideoNoteFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenVoiceFile(block: (VoiceFile) -> T) = asVoiceFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asVoiceFile(): VoiceFile? = this as? VoiceFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireVoiceFile(): VoiceFile = this as VoiceFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenMimedMediaFile(block: (MimedMediaFile) -> T) = asMimedMediaFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asMimedMediaFile(): MimedMediaFile? = this as? MimedMediaFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireMimedMediaFile(): MimedMediaFile = this as MimedMediaFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenPlayableMediaFile(block: (PlayableMediaFile) -> T) =
asPlayableMediaFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asPlayableMediaFile(): PlayableMediaFile? = this as? PlayableMediaFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requirePlayableMediaFile(): PlayableMediaFile = this as PlayableMediaFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenSizedMediaFile(block: (SizedMediaFile) -> T) = asSizedMediaFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asSizedMediaFile(): SizedMediaFile? = this as? SizedMediaFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireSizedMediaFile(): SizedMediaFile = this as SizedMediaFile
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TelegramMediaFile.whenThumbedMediaFile(block: (ThumbedMediaFile) -> T) = asThumbedMediaFile()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun TelegramMediaFile.asThumbedMediaFile(): ThumbedMediaFile? = this as? ThumbedMediaFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun TelegramMediaFile.requireThumbedMediaFile(): ThumbedMediaFile = this as ThumbedMediaFile
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
inline fun <T> KeyboardMarkup.whenForceReply(block: (ReplyForce) -> T) = asForceReply()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
2021-10-01 18:52:29 +00:00
inline fun KeyboardMarkup.asForceReply(): ReplyForce? = this as? ReplyForce
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
inline fun KeyboardMarkup.requireForceReply(): ReplyForce = this as ReplyForce
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> KeyboardMarkup.whenInlineKeyboardMarkup(block: (InlineKeyboardMarkup) -> T) =
asInlineKeyboardMarkup()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun KeyboardMarkup.asInlineKeyboardMarkup(): InlineKeyboardMarkup? = this as? InlineKeyboardMarkup
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun KeyboardMarkup.requireInlineKeyboardMarkup(): InlineKeyboardMarkup = this as InlineKeyboardMarkup
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> KeyboardMarkup.whenReplyKeyboardMarkup(block: (ReplyKeyboardMarkup) -> T) =
asReplyKeyboardMarkup()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun KeyboardMarkup.asReplyKeyboardMarkup(): ReplyKeyboardMarkup? = this as? ReplyKeyboardMarkup
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun KeyboardMarkup.requireReplyKeyboardMarkup(): ReplyKeyboardMarkup = this as ReplyKeyboardMarkup
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> KeyboardMarkup.whenReplyKeyboardRemove(block: (ReplyKeyboardRemove) -> T) =
asReplyKeyboardRemove()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun KeyboardMarkup.asReplyKeyboardRemove(): ReplyKeyboardRemove? = this as? ReplyKeyboardRemove
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun KeyboardMarkup.requireReplyKeyboardRemove(): ReplyKeyboardRemove = this as ReplyKeyboardRemove
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenCallbackDataInlineKeyboardButton(block: (CallbackDataInlineKeyboardButton) -> T) =
asCallbackDataInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton? =
this as? CallbackDataInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireCallbackDataInlineKeyboardButton(): CallbackDataInlineKeyboardButton =
this as CallbackDataInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenCallbackGameInlineKeyboardButton(block: (CallbackGameInlineKeyboardButton) -> T) =
asCallbackGameInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton? =
this as? CallbackGameInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireCallbackGameInlineKeyboardButton(): CallbackGameInlineKeyboardButton =
this as CallbackGameInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenLoginURLInlineKeyboardButton(block: (LoginURLInlineKeyboardButton) -> T) =
asLoginURLInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton? =
this as? LoginURLInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireLoginURLInlineKeyboardButton(): LoginURLInlineKeyboardButton =
this as LoginURLInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenPayInlineKeyboardButton(block: (PayInlineKeyboardButton) -> T) =
asPayInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineKeyboardButton.asPayInlineKeyboardButton(): PayInlineKeyboardButton? = this as? PayInlineKeyboardButton
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requirePayInlineKeyboardButton(): PayInlineKeyboardButton =
this as PayInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenSwitchInlineQueryCurrentChatInlineKeyboardButton(block: (SwitchInlineQueryCurrentChatInlineKeyboardButton) -> T) =
asSwitchInlineQueryCurrentChatInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton? =
this as? SwitchInlineQueryCurrentChatInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireSwitchInlineQueryCurrentChatInlineKeyboardButton(): SwitchInlineQueryCurrentChatInlineKeyboardButton =
this as SwitchInlineQueryCurrentChatInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenSwitchInlineQueryInlineKeyboardButton(block: (SwitchInlineQueryInlineKeyboardButton) -> T) =
asSwitchInlineQueryInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton? =
this as? SwitchInlineQueryInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireSwitchInlineQueryInlineKeyboardButton(): SwitchInlineQueryInlineKeyboardButton =
this as SwitchInlineQueryInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenURLInlineKeyboardButton(block: (URLInlineKeyboardButton) -> T) =
asURLInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun InlineKeyboardButton.asURLInlineKeyboardButton(): URLInlineKeyboardButton? = this as? URLInlineKeyboardButton
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireURLInlineKeyboardButton(): URLInlineKeyboardButton =
this as URLInlineKeyboardButton
2022-04-17 14:18:09 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenWebAppKeyboardButton(block: (WebAppKeyboardButton) -> T) =
asWebAppKeyboardButton()?.let(block)
2022-04-17 14:18:09 +00:00
@PreviewFeature
inline fun InlineKeyboardButton.asWebAppKeyboardButton(): WebAppKeyboardButton? = this as? WebAppKeyboardButton
@PreviewFeature
inline fun InlineKeyboardButton.requireWebAppKeyboardButton(): WebAppKeyboardButton =
this as WebAppKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> InlineKeyboardButton.whenUnknownInlineKeyboardButton(block: (UnknownInlineKeyboardButton) -> T) =
asUnknownInlineKeyboardButton()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.asUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton? =
this as? UnknownInlineKeyboardButton
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun InlineKeyboardButton.requireUnknownInlineKeyboardButton(): UnknownInlineKeyboardButton =
this as UnknownInlineKeyboardButton
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Poll.whenMultipleAnswersPoll(block: (MultipleAnswersPoll) -> T) = asMultipleAnswersPoll()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Poll.asMultipleAnswersPoll(): MultipleAnswersPoll? = this as? MultipleAnswersPoll
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Poll.requireMultipleAnswersPoll(): MultipleAnswersPoll = this as MultipleAnswersPoll
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Poll.whenQuizPoll(block: (QuizPoll) -> T) = asQuizPoll()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Poll.asQuizPoll(): QuizPoll? = this as? QuizPoll
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Poll.requireQuizPoll(): QuizPoll = this as QuizPoll
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Poll.whenRegularPoll(block: (RegularPoll) -> T) = asRegularPoll()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Poll.asRegularPoll(): RegularPoll? = this as? RegularPoll
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Poll.requireRegularPoll(): RegularPoll = this as RegularPoll
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> Poll.whenUnknownPollType(block: (UnknownPollType) -> T) = asUnknownPollType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 05:54:02 +00:00
inline fun Poll.asUnknownPollType(): UnknownPollType? = this as? UnknownPollType
2021-05-29 09:34:14 +00:00
2021-01-05 17:02:00 +00:00
@PreviewFeature
2021-01-05 16:27:42 +00:00
inline fun Poll.requireUnknownPollType(): UnknownPollType = this as UnknownPollType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenContactContent(block: (ContactContent) -> T) = asContactContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asContactContent(): ContactContent? = this as? ContactContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireContactContent(): ContactContent = this as ContactContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenDiceContent(block: (DiceContent) -> T) = asDiceContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asDiceContent(): DiceContent? = this as? DiceContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireDiceContent(): DiceContent = this as DiceContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenGameContent(block: (GameContent) -> T) = asGameContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asGameContent(): GameContent? = this as? GameContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireGameContent(): GameContent = this as GameContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenLocationContent(block: (LocationContent) -> T) = asLocationContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asLocationContent(): LocationContent? = this as? LocationContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireLocationContent(): LocationContent = this as LocationContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenLiveLocationContent(block: (LiveLocationContent) -> T) =
asLiveLocationContent()?.let(block)
@PreviewFeature
inline fun ResendableContent.asLiveLocationContent(): LiveLocationContent? = this as? LiveLocationContent
@PreviewFeature
inline fun ResendableContent.requireLiveLocationContent(): LiveLocationContent = this as LiveLocationContent
@PreviewFeature
inline fun <T> ResendableContent.whenStaticLocationContent(block: (StaticLocationContent) -> T) =
asStaticLocationContent()?.let(block)
@PreviewFeature
inline fun ResendableContent.asStaticLocationContent(): StaticLocationContent? = this as? StaticLocationContent
@PreviewFeature
inline fun ResendableContent.requireStaticLocationContent(): StaticLocationContent = this as StaticLocationContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenPollContent(block: (PollContent) -> T) = asPollContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asPollContent(): PollContent? = this as? PollContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requirePollContent(): PollContent = this as PollContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenTextContent(block: (TextContent) -> T) = asTextContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asTextContent(): TextContent? = this as? TextContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireTextContent(): TextContent = this as TextContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenVenueContent(block: (VenueContent) -> T) = asVenueContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asVenueContent(): VenueContent? = this as? VenueContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireVenueContent(): VenueContent = this as VenueContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenAudioMediaGroupContent(block: (AudioMediaGroupContent) -> T) =
asAudioMediaGroupContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asAudioMediaGroupContent(): AudioMediaGroupContent? = this as? AudioMediaGroupContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireAudioMediaGroupContent(): AudioMediaGroupContent = this as AudioMediaGroupContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenDocumentMediaGroupContent(block: (DocumentMediaGroupContent) -> T) =
asDocumentMediaGroupContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ResendableContent.asDocumentMediaGroupContent(): DocumentMediaGroupContent? =
this as? DocumentMediaGroupContent
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ResendableContent.requireDocumentMediaGroupContent(): DocumentMediaGroupContent =
this as DocumentMediaGroupContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenMediaCollectionContent(block: (MediaCollectionContent<TelegramMediaFile>) -> T) =
asMediaCollectionContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ResendableContent.asMediaCollectionContent(): MediaCollectionContent<TelegramMediaFile>? =
this as? MediaCollectionContent<TelegramMediaFile>
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ResendableContent.requireMediaCollectionContent(): MediaCollectionContent<TelegramMediaFile> =
this as MediaCollectionContent<TelegramMediaFile>
2022-04-03 13:29:48 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenTextedMediaContent(block: (TextedMediaContent) -> T) =
asTextedMediaContent()?.let(block)
2022-04-03 13:29:48 +00:00
@PreviewFeature
inline fun ResendableContent.asTextedMediaContent(): TextedMediaContent? =
this as? TextedMediaContent
@PreviewFeature
inline fun ResendableContent.requireTextedMediaContent(): TextedMediaContent =
this as TextedMediaContent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenMediaContent(block: (MediaContent) -> T) = asMediaContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asMediaContent(): MediaContent? = this as? MediaContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireMediaContent(): MediaContent = this as MediaContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenMediaGroupContent(block: (MediaGroupContent) -> T) =
asMediaGroupContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asMediaGroupContent(): MediaGroupContent? = this as? MediaGroupContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireMediaGroupContent(): MediaGroupContent = this as MediaGroupContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenMessageContent(block: (MessageContent) -> T) = asMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asMessageContent(): MessageContent? = this as? MessageContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireMessageContent(): MessageContent = this as MessageContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenVisualMediaGroupContent(block: (VisualMediaGroupContent) -> T) =
asVisualMediaGroupContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asVisualMediaGroupContent(): VisualMediaGroupContent? = this as? VisualMediaGroupContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireVisualMediaGroupContent(): VisualMediaGroupContent = this as VisualMediaGroupContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenAnimationContent(block: (AnimationContent) -> T) = asAnimationContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asAnimationContent(): AnimationContent? = this as? AnimationContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireAnimationContent(): AnimationContent = this as AnimationContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenAudioContent(block: (AudioContent) -> T) = asAudioContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asAudioContent(): AudioContent? = this as? AudioContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireAudioContent(): AudioContent = this as AudioContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenDocumentContent(block: (DocumentContent) -> T) = asDocumentContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asDocumentContent(): DocumentContent? = this as? DocumentContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireDocumentContent(): DocumentContent = this as DocumentContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenPhotoContent(block: (PhotoContent) -> T) = asPhotoContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asPhotoContent(): PhotoContent? = this as? PhotoContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requirePhotoContent(): PhotoContent = this as PhotoContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenStickerContent(block: (StickerContent) -> T) = asStickerContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asStickerContent(): StickerContent? = this as? StickerContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireStickerContent(): StickerContent = this as StickerContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenVideoContent(block: (VideoContent) -> T) = asVideoContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asVideoContent(): VideoContent? = this as? VideoContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireVideoContent(): VideoContent = this as VideoContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenVideoNoteContent(block: (VideoNoteContent) -> T) = asVideoNoteContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asVideoNoteContent(): VideoNoteContent? = this as? VideoNoteContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireVideoNoteContent(): VideoNoteContent = this as VideoNoteContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenVoiceContent(block: (VoiceContent) -> T) = asVoiceContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asVoiceContent(): VoiceContent? = this as? VoiceContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireVoiceContent(): VoiceContent = this as VoiceContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ResendableContent.whenInvoiceContent(block: (InvoiceContent) -> T) = asInvoiceContent()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun ResendableContent.asInvoiceContent(): InvoiceContent? = this as? InvoiceContent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun ResendableContent.requireInvoiceContent(): InvoiceContent = this as InvoiceContent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenMultilevelTextSource(block: (MultilevelTextSource) -> T) =
asMultilevelTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asMultilevelTextSource(): MultilevelTextSource? = this as? MultilevelTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireMultilevelTextSource(): MultilevelTextSource = this as MultilevelTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenBoldTextSource(block: (BoldTextSource) -> T) = asBoldTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asBoldTextSource(): BoldTextSource? = this as? BoldTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireBoldTextSource(): BoldTextSource = this as BoldTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenBotCommandTextSource(block: (BotCommandTextSource) -> T) =
asBotCommandTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asBotCommandTextSource(): BotCommandTextSource? = this as? BotCommandTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireBotCommandTextSource(): BotCommandTextSource = this as BotCommandTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenCashTagTextSource(block: (CashTagTextSource) -> T) = asCashTagTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asCashTagTextSource(): CashTagTextSource? = this as? CashTagTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireCashTagTextSource(): CashTagTextSource = this as CashTagTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenCodeTextSource(block: (CodeTextSource) -> T) = asCodeTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asCodeTextSource(): CodeTextSource? = this as? CodeTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireCodeTextSource(): CodeTextSource = this as CodeTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenEMailTextSource(block: (EMailTextSource) -> T) = asEMailTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asEMailTextSource(): EMailTextSource? = this as? EMailTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireEMailTextSource(): EMailTextSource = this as EMailTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenHashTagTextSource(block: (HashTagTextSource) -> T) = asHashTagTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asHashTagTextSource(): HashTagTextSource? = this as? HashTagTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireHashTagTextSource(): HashTagTextSource = this as HashTagTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenItalicTextSource(block: (ItalicTextSource) -> T) = asItalicTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asItalicTextSource(): ItalicTextSource? = this as? ItalicTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireItalicTextSource(): ItalicTextSource = this as ItalicTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenMentionTextSource(block: (MentionTextSource) -> T) = asMentionTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asMentionTextSource(): MentionTextSource? = this as? MentionTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireMentionTextSource(): MentionTextSource = this as MentionTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenPhoneNumberTextSource(block: (PhoneNumberTextSource) -> T) =
asPhoneNumberTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asPhoneNumberTextSource(): PhoneNumberTextSource? = this as? PhoneNumberTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requirePhoneNumberTextSource(): PhoneNumberTextSource = this as PhoneNumberTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenPreTextSource(block: (PreTextSource) -> T) = asPreTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asPreTextSource(): PreTextSource? = this as? PreTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requirePreTextSource(): PreTextSource = this as PreTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenRegularTextSource(block: (RegularTextSource) -> T) = asRegularTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asRegularTextSource(): RegularTextSource? = this as? RegularTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireRegularTextSource(): RegularTextSource = this as RegularTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenStrikethroughTextSource(block: (StrikethroughTextSource) -> T) =
asStrikethroughTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asStrikethroughTextSource(): StrikethroughTextSource? = this as? StrikethroughTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireStrikethroughTextSource(): StrikethroughTextSource = this as StrikethroughTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenTextLinkTextSource(block: (TextLinkTextSource) -> T) = asTextLinkTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asTextLinkTextSource(): TextLinkTextSource? = this as? TextLinkTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireTextLinkTextSource(): TextLinkTextSource = this as TextLinkTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenTextMentionTextSource(block: (TextMentionTextSource) -> T) =
asTextMentionTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asTextMentionTextSource(): TextMentionTextSource? = this as? TextMentionTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireTextMentionTextSource(): TextMentionTextSource = this as TextMentionTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenURLTextSource(block: (URLTextSource) -> T) = asURLTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asURLTextSource(): URLTextSource? = this as? URLTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireURLTextSource(): URLTextSource = this as URLTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> TextSource.whenUnderlineTextSource(block: (UnderlineTextSource) -> T) =
asUnderlineTextSource()?.let(block)
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun TextSource.asUnderlineTextSource(): UnderlineTextSource? = this as? UnderlineTextSource
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun TextSource.requireUnderlineTextSource(): UnderlineTextSource = this as UnderlineTextSource
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenBasketballDiceAnimationType(block: (BasketballDiceAnimationType) -> T) =
asBasketballDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.asBasketballDiceAnimationType(): BasketballDiceAnimationType? =
this as? BasketballDiceAnimationType
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.requireBasketballDiceAnimationType(): BasketballDiceAnimationType =
this as BasketballDiceAnimationType
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenBowlingDiceAnimationType(block: (BowlingDiceAnimationType) -> T) =
asBowlingDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.asBowlingDiceAnimationType(): BowlingDiceAnimationType? = this as? BowlingDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.requireBowlingDiceAnimationType(): BowlingDiceAnimationType =
this as BowlingDiceAnimationType
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenCubeDiceAnimationType(block: (CubeDiceAnimationType) -> T) =
asCubeDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.asCubeDiceAnimationType(): CubeDiceAnimationType? = this as? CubeDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.requireCubeDiceAnimationType(): CubeDiceAnimationType = this as CubeDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenCustomDiceAnimationType(block: (CustomDiceAnimationType) -> T) =
asCustomDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.asCustomDiceAnimationType(): CustomDiceAnimationType? = this as? CustomDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.requireCustomDiceAnimationType(): CustomDiceAnimationType = this as CustomDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenDartsDiceAnimationType(block: (DartsDiceAnimationType) -> T) =
asDartsDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.asDartsDiceAnimationType(): DartsDiceAnimationType? = this as? DartsDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
inline fun DiceAnimationType.requireDartsDiceAnimationType(): DartsDiceAnimationType = this as DartsDiceAnimationType
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenFootballDiceAnimationType(block: (FootballDiceAnimationType) -> T) =
asFootballDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.asFootballDiceAnimationType(): FootballDiceAnimationType? =
this as? FootballDiceAnimationType
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.requireFootballDiceAnimationType(): FootballDiceAnimationType =
this as FootballDiceAnimationType
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> DiceAnimationType.whenSlotMachineDiceAnimationType(block: (SlotMachineDiceAnimationType) -> T) =
asSlotMachineDiceAnimationType()?.let(block)
2021-06-23 16:14:45 +00:00
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.asSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType? =
this as? SlotMachineDiceAnimationType
2021-02-17 16:29:29 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun DiceAnimationType.requireSlotMachineDiceAnimationType(): SlotMachineDiceAnimationType =
this as SlotMachineDiceAnimationType
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenChannelChatCreated(block: (ChannelChatCreated) -> T) = asChannelChatCreated()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asChannelChatCreated(): ChannelChatCreated? = this as? ChannelChatCreated
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireChannelChatCreated(): ChannelChatCreated = this as ChannelChatCreated
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenDeleteChatPhoto(block: (DeleteChatPhoto) -> T) = asDeleteChatPhoto()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asDeleteChatPhoto(): DeleteChatPhoto? = this as? DeleteChatPhoto
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireDeleteChatPhoto(): DeleteChatPhoto = this as DeleteChatPhoto
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenGroupChatCreated(block: (GroupChatCreated) -> T) = asGroupChatCreated()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asGroupChatCreated(): GroupChatCreated? = this as? GroupChatCreated
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireGroupChatCreated(): GroupChatCreated = this as GroupChatCreated
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenLeftChatMember(block: (LeftChatMember) -> T) = asLeftChatMember()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asLeftChatMember(): LeftChatMember? = this as? LeftChatMember
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireLeftChatMember(): LeftChatMember = this as LeftChatMember
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenMessageAutoDeleteTimerChanged(block: (MessageAutoDeleteTimerChanged) -> T) =
asMessageAutoDeleteTimerChanged()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ChatEvent.asMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged? =
this as? MessageAutoDeleteTimerChanged
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun ChatEvent.requireMessageAutoDeleteTimerChanged(): MessageAutoDeleteTimerChanged =
this as MessageAutoDeleteTimerChanged
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenNewChatMembers(block: (NewChatMembers) -> T) = asNewChatMembers()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asNewChatMembers(): NewChatMembers? = this as? NewChatMembers
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireNewChatMembers(): NewChatMembers = this as NewChatMembers
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenNewChatPhoto(block: (NewChatPhoto) -> T) = asNewChatPhoto()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asNewChatPhoto(): NewChatPhoto? = this as? NewChatPhoto
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireNewChatPhoto(): NewChatPhoto = this as NewChatPhoto
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenNewChatTitle(block: (NewChatTitle) -> T) = asNewChatTitle()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asNewChatTitle(): NewChatTitle? = this as? NewChatTitle
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireNewChatTitle(): NewChatTitle = this as NewChatTitle
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenPinnedMessage(block: (PinnedMessage) -> T) = asPinnedMessage()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asPinnedMessage(): PinnedMessage? = this as? PinnedMessage
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requirePinnedMessage(): PinnedMessage = this as PinnedMessage
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenSuccessfulPaymentEvent(block: (SuccessfulPaymentEvent) -> T) =
asSuccessfulPaymentEvent()?.let(block)
@PreviewFeature
inline fun ChatEvent.asSuccessfulPaymentEvent(): SuccessfulPaymentEvent? = this as? SuccessfulPaymentEvent
@PreviewFeature
inline fun ChatEvent.requireSuccessfulPaymentEvent(): SuccessfulPaymentEvent = this as SuccessfulPaymentEvent
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenProximityAlertTriggered(block: (ProximityAlertTriggered) -> T) =
asProximityAlertTriggered()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asProximityAlertTriggered(): ProximityAlertTriggered? = this as? ProximityAlertTriggered
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireProximityAlertTriggered(): ProximityAlertTriggered = this as ProximityAlertTriggered
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenSupergroupChatCreated(block: (SupergroupChatCreated) -> T) =
asSupergroupChatCreated()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asSupergroupChatCreated(): SupergroupChatCreated? = this as? SupergroupChatCreated
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireSupergroupChatCreated(): SupergroupChatCreated = this as SupergroupChatCreated
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenMigratedToSupergroup(block: (MigratedToSupergroup) -> T) =
asMigratedToSupergroup()?.let(block)
@PreviewFeature
inline fun ChatEvent.asMigratedToSupergroup(): MigratedToSupergroup? = this as? MigratedToSupergroup
@PreviewFeature
inline fun ChatEvent.requireMigratedToSupergroup(): MigratedToSupergroup = this as MigratedToSupergroup
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenChannelEvent(block: (ChannelEvent) -> T) = asChannelEvent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asChannelEvent(): ChannelEvent? = this as? ChannelEvent
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireChannelEvent(): ChannelEvent = this as ChannelEvent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenPublicChatEvent(block: (PublicChatEvent) -> T) = asPublicChatEvent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-10-03 12:44:29 +00:00
inline fun ChatEvent.asPublicChatEvent(): PublicChatEvent? = this as? PublicChatEvent
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
2021-10-03 12:44:29 +00:00
inline fun ChatEvent.requirePublicChatEvent(): PublicChatEvent = this as PublicChatEvent
@PreviewFeature
inline fun <T> ChatEvent.whenCommonEvent(block: (CommonEvent) -> T) = asCommonEvent()?.let(block)
2021-10-03 12:44:29 +00:00
@PreviewFeature
inline fun ChatEvent.asCommonEvent(): CommonEvent? = this as? CommonEvent
@PreviewFeature
inline fun ChatEvent.requireCommonEvent(): CommonEvent = this as CommonEvent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenGroupEvent(block: (GroupEvent) -> T) = asGroupEvent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asGroupEvent(): GroupEvent? = this as? GroupEvent
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireGroupEvent(): GroupEvent = this as GroupEvent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenSupergroupEvent(block: (SupergroupEvent) -> T) = asSupergroupEvent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asSupergroupEvent(): SupergroupEvent? = this as? SupergroupEvent
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireSupergroupEvent(): SupergroupEvent = this as SupergroupEvent
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatEvent(block: (VideoChatEvent) -> T) = asVideoChatEvent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asVideoChatEvent(): VideoChatEvent? = this as? VideoChatEvent
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireVideoChatEvent(): VideoChatEvent = this as VideoChatEvent
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatEnded(block: (VideoChatEnded) -> T) = asVideoChatEnded()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asVideoChatEnded(): VideoChatEnded? = this as? VideoChatEnded
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireVideoChatEnded(): VideoChatEnded = this as VideoChatEnded
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatParticipantsInvited(block: (VideoChatParticipantsInvited) -> T) =
asVideoChatParticipantsInvited()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asVideoChatParticipantsInvited(): VideoChatParticipantsInvited? =
this as? VideoChatParticipantsInvited
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireVideoChatParticipantsInvited(): VideoChatParticipantsInvited =
this as VideoChatParticipantsInvited
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatStarted(block: (VideoChatStarted) -> T) = asVideoChatStarted()?.let(block)
2021-06-23 16:14:45 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.asVideoChatStarted(): VideoChatStarted? = this as? VideoChatStarted
2021-05-29 09:34:14 +00:00
2021-03-11 15:06:25 +00:00
@PreviewFeature
inline fun ChatEvent.requireVideoChatStarted(): VideoChatStarted = this as VideoChatStarted
2021-05-29 09:34:14 +00:00
@PreviewFeature
inline fun <T> ChatEvent.whenVideoChatScheduled(block: (VideoChatScheduled) -> T) = asVideoChatScheduled()?.let(block)
@PreviewFeature
inline fun ChatEvent.asVideoChatScheduled(): VideoChatScheduled? = this as? VideoChatScheduled
@PreviewFeature
inline fun ChatEvent.requireVideoChatScheduled(): VideoChatScheduled = this as VideoChatScheduled
@PreviewFeature
inline fun <T> ChatEvent.whenUserLoggedIn(block: (UserLoggedIn) -> T) = asUserLoggedIn()?.let(block)
@PreviewFeature
inline fun ChatEvent.asUserLoggedIn(): UserLoggedIn? = this as? UserLoggedIn
@PreviewFeature
inline fun ChatEvent.requireUserLoggedIn(): UserLoggedIn = this as UserLoggedIn
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CommonSendInvoiceData.whenSendInvoice(block: (SendInvoice) -> T) = asSendInvoice()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-28 14:08:02 +00:00
@PreviewFeature
inline fun CommonSendInvoiceData.asSendInvoice(): SendInvoice? = this as? SendInvoice
2021-05-29 09:34:14 +00:00
2021-04-28 14:08:02 +00:00
@PreviewFeature
2022-06-21 12:52:55 +00:00
inline fun CommonSendInvoiceData.requireSendInvoice(): SendInvoice = this as SendInvoice
@PreviewFeature
inline fun <T> CommonSendInvoiceData.whenCreateInvoiceLink(block: (CreateInvoiceLink) -> T) =
asCreateInvoiceLink()?.let(block)
2022-06-21 12:52:55 +00:00
@PreviewFeature
inline fun CommonSendInvoiceData.asCreateInvoiceLink(): CreateInvoiceLink? = this as? CreateInvoiceLink
@PreviewFeature
inline fun CommonSendInvoiceData.requireCreateInvoiceLink(): CreateInvoiceLink = this as CreateInvoiceLink
2021-05-29 09:34:14 +00:00
2021-06-23 16:14:45 +00:00
@PreviewFeature
inline fun <T> CommonSendInvoiceData.whenInputInvoiceMessageContent(block: (InputInvoiceMessageContent) -> T) =
asInputInvoiceMessageContent()?.let(block)
2021-06-23 16:14:45 +00:00
2021-04-28 14:08:02 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CommonSendInvoiceData.asInputInvoiceMessageContent(): InputInvoiceMessageContent? =
this as? InputInvoiceMessageContent
2021-04-28 14:08:02 +00:00
@PreviewFeature
2021-05-29 09:34:14 +00:00
inline fun CommonSendInvoiceData.requireInputInvoiceMessageContent(): InputInvoiceMessageContent =
this as InputInvoiceMessageContent
@PreviewFeature
inline fun <T> Any.whenFromUser(block: (FromUser) -> T) = asFromUser()?.let(block)
@PreviewFeature
inline fun Any.asFromUser(): FromUser? = this as? FromUser
@PreviewFeature
inline fun Any.requireFromUser(): FromUser = this as FromUser
@PreviewFeature
inline fun <T> Any.whenWithUser(block: (WithUser) -> T) = asWithUser()?.let(block)
2021-10-18 08:45:57 +00:00
@PreviewFeature
inline fun Any.asWithUser(): WithUser? = this as? WithUser
@PreviewFeature
inline fun Any.requireWithUser(): WithUser = this as WithUser
@PreviewFeature
inline fun <T> Any.whenWithOptionalLanguageCode(block: (WithOptionalLanguageCode) -> T) =
asWithOptionalLanguageCode()?.let(block)
@PreviewFeature
inline fun Any.asWithOptionalLanguageCode(): WithOptionalLanguageCode? = this as? WithOptionalLanguageCode
@PreviewFeature
inline fun Any.requireWithOptionalLanguageCode(): WithOptionalLanguageCode = this as WithOptionalLanguageCode
@PreviewFeature
inline fun <T> Location.whenStaticLocation(block: (StaticLocation) -> T) = asStaticLocation()?.let(block)
@PreviewFeature
inline fun Location.asStaticLocation(): StaticLocation? = this as? StaticLocation
@PreviewFeature
inline fun Location.requireStaticLocation(): StaticLocation = this as StaticLocation
@PreviewFeature
inline fun <T> Location.whenLiveLocation(block: (LiveLocation) -> T) = asLiveLocation()?.let(block)
@PreviewFeature
inline fun Location.asLiveLocation(): LiveLocation? = this as? LiveLocation
@PreviewFeature
inline fun Location.requireLiveLocation(): LiveLocation = this as LiveLocation
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun <T> ChatInviteLink.whenPrimaryInviteLink(block: (PrimaryInviteLink) -> T) = asPrimaryInviteLink()?.let(block)
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.asPrimaryInviteLink(): PrimaryInviteLink? = this as? PrimaryInviteLink
@PreviewFeature
inline fun ChatInviteLink.requirePrimaryInviteLink(): PrimaryInviteLink = this as PrimaryInviteLink
@PreviewFeature
inline fun <T> ChatInviteLink.whenSecondaryChatInviteLink(block: (SecondaryChatInviteLink) -> T) =
asSecondaryChatInviteLink()?.let(block)
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.asSecondaryChatInviteLink(): SecondaryChatInviteLink? = this as? SecondaryChatInviteLink
@PreviewFeature
inline fun ChatInviteLink.requireSecondaryChatInviteLink(): SecondaryChatInviteLink = this as SecondaryChatInviteLink
@PreviewFeature
inline fun <T> ChatInviteLink.whenChatInviteLinkWithJoinRequest(block: (ChatInviteLinkWithJoinRequest) -> T) =
asChatInviteLinkWithJoinRequest()?.let(block)
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.asChatInviteLinkWithJoinRequest(): ChatInviteLinkWithJoinRequest? =
this as? ChatInviteLinkWithJoinRequest
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.requireChatInviteLinkWithJoinRequest(): ChatInviteLinkWithJoinRequest =
this as ChatInviteLinkWithJoinRequest
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun <T> ChatInviteLink.whenChatInviteLinkWithLimitedMembers(block: (ChatInviteLinkWithLimitedMembers) -> T) =
asChatInviteLinkWithLimitedMembers()?.let(block)
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.asChatInviteLinkWithLimitedMembers(): ChatInviteLinkWithLimitedMembers? =
this as? ChatInviteLinkWithLimitedMembers
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.requireChatInviteLinkWithLimitedMembers(): ChatInviteLinkWithLimitedMembers =
this as ChatInviteLinkWithLimitedMembers
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun <T> ChatInviteLink.whenChatInviteLinkUnlimited(block: (ChatInviteLinkUnlimited) -> T) =
asChatInviteLinkUnlimited()?.let(block)
2021-11-08 13:15:58 +00:00
@PreviewFeature
inline fun ChatInviteLink.asChatInviteLinkUnlimited(): ChatInviteLinkUnlimited? = this as? ChatInviteLinkUnlimited
@PreviewFeature
inline fun ChatInviteLink.requireChatInviteLinkUnlimited(): ChatInviteLinkUnlimited = this as ChatInviteLinkUnlimited
@PreviewFeature
inline fun <T> ForwardInfo.whenAnonymousForwardInfo(block: (ForwardInfo.ByAnonymous) -> T) =
asAnonymousForwardInfo()?.let(block)
@PreviewFeature
inline fun ForwardInfo.asAnonymousForwardInfo(): ForwardInfo.ByAnonymous? = this as? ForwardInfo.ByAnonymous
@PreviewFeature
inline fun ForwardInfo.requireAnonymousForwardInfo(): ForwardInfo.ByAnonymous = this as ForwardInfo.ByAnonymous
@PreviewFeature
inline fun <T> ForwardInfo.whenUserForwardInfo(block: (ForwardInfo.ByUser) -> T) = asUserForwardInfo()?.let(block)
@PreviewFeature
inline fun ForwardInfo.asUserForwardInfo(): ForwardInfo.ByUser? = this as? ForwardInfo.ByUser
@PreviewFeature
inline fun ForwardInfo.requireUserForwardInfo(): ForwardInfo.ByUser = this as ForwardInfo.ByUser
@PreviewFeature
inline fun <T> ForwardInfo.whenForwardFromPublicChatInfo(block: (ForwardInfo.PublicChat) -> T) =
asForwardFromPublicChatInfo()?.let(block)
@PreviewFeature
inline fun ForwardInfo.asForwardFromPublicChatInfo(): ForwardInfo.PublicChat? = this as? ForwardInfo.PublicChat
@PreviewFeature
inline fun ForwardInfo.requireForwardFromPublicChatInfo(): ForwardInfo.PublicChat = this as ForwardInfo.PublicChat
@PreviewFeature
inline fun <T> ForwardInfo.whenForwardFromChannelInfo(block: (ForwardFromChannelInfo) -> T) =
asForwardFromChannelInfo()?.let(block)
@PreviewFeature
inline fun ForwardInfo.asForwardFromChannelInfo(): ForwardFromChannelInfo? = this as? ForwardFromChannelInfo
@PreviewFeature
inline fun ForwardInfo.requireForwardFromChannelInfo(): ForwardFromChannelInfo = this as ForwardFromChannelInfo
@PreviewFeature
inline fun <T> ForwardInfo.whenForwardFromSupergroupInfo(block: (ForwardFromSupergroupInfo) -> T) =
asForwardFromSupergroupInfo()?.let(block)
@PreviewFeature
inline fun ForwardInfo.asForwardFromSupergroupInfo(): ForwardFromSupergroupInfo? = this as? ForwardFromSupergroupInfo
@PreviewFeature
inline fun ForwardInfo.requireForwardFromSupergroupInfo(): ForwardFromSupergroupInfo = this as ForwardFromSupergroupInfo
@PreviewFeature
inline fun <T> MessageContent.whenTextedInput(block: (TextedInput) -> T) = asTextedInput()?.let(block)
@PreviewFeature
inline fun MessageContent.asTextedInput(): TextedInput? = this as? TextedInput
@PreviewFeature
inline fun MessageContent.requireTextedInput(): TextedInput = this as TextedInput
2022-01-06 10:42:19 +00:00
@PreviewFeature
inline fun <T> ScheduledCloseInfo.whenExactScheduledCloseInfo(block: (ExactScheduledCloseInfo) -> T) =
asExactScheduledCloseInfo()?.let(block)
2022-01-06 10:42:19 +00:00
@PreviewFeature
inline fun ScheduledCloseInfo.asExactScheduledCloseInfo(): ExactScheduledCloseInfo? = this as? ExactScheduledCloseInfo
@PreviewFeature
inline fun ScheduledCloseInfo.requireExactScheduledCloseInfo(): ExactScheduledCloseInfo =
this as ExactScheduledCloseInfo
2022-01-06 10:42:19 +00:00
@PreviewFeature
inline fun <T> ScheduledCloseInfo.whenApproximateScheduledCloseInfo(block: (ApproximateScheduledCloseInfo) -> T) =
asApproximateScheduledCloseInfo()?.let(block)
2022-01-06 10:42:19 +00:00
@PreviewFeature
inline fun ScheduledCloseInfo.asApproximateScheduledCloseInfo(): ApproximateScheduledCloseInfo? =
this as? ApproximateScheduledCloseInfo
2022-01-06 10:42:19 +00:00
@PreviewFeature
inline fun ScheduledCloseInfo.requireApproximateScheduledCloseInfo(): ApproximateScheduledCloseInfo =
this as ApproximateScheduledCloseInfo
2022-01-06 10:52:28 +00:00
@PreviewFeature
inline fun <T> ChosenInlineResult.whenLocationChosenInlineResult(block: (LocationChosenInlineResult) -> T) =
asLocationChosenInlineResult()?.let(block)
2022-01-06 10:52:28 +00:00
@PreviewFeature
inline fun ChosenInlineResult.asLocationChosenInlineResult(): LocationChosenInlineResult? =
this as? LocationChosenInlineResult
2022-01-06 10:52:28 +00:00
@PreviewFeature
inline fun ChosenInlineResult.requireLocationChosenInlineResult(): LocationChosenInlineResult =
this as LocationChosenInlineResult
2022-01-06 10:52:28 +00:00
@PreviewFeature
inline fun <T> ChosenInlineResult.whenBaseChosenInlineResult(block: (BaseChosenInlineResult) -> T) =
asBaseChosenInlineResult()?.let(block)
2022-01-06 10:52:28 +00:00
@PreviewFeature
inline fun ChosenInlineResult.asBaseChosenInlineResult(): BaseChosenInlineResult? = this as? BaseChosenInlineResult
@PreviewFeature
inline fun ChosenInlineResult.requireBaseChosenInlineResult(): BaseChosenInlineResult = this as BaseChosenInlineResult