diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetBusinessConnection.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetBusinessConnection.kt index d6e6603bce..e7c3c3483b 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetBusinessConnection.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetBusinessConnection.kt @@ -3,15 +3,16 @@ package dev.inmo.tgbotapi.extensions.api.get import dev.inmo.micro_utils.common.Warning import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetBusinessConnection +import dev.inmo.tgbotapi.types.business_connection.BusinessConnection import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId -suspend fun TelegramBot.getBusinessConnection( +public suspend fun TelegramBot.getBusinessConnection( id: BusinessConnectionId -) = execute(GetBusinessConnection(businessConnectionId = id)) +): BusinessConnection = execute(GetBusinessConnection(businessConnectionId = id)) @Warning("This method may lead to error due to raw String type usage") -suspend fun TelegramBot.getBusinessConnection( +public suspend fun TelegramBot.getBusinessConnection( id: String -) = getBusinessConnection( +): BusinessConnection = getBusinessConnection( BusinessConnectionId(id) ) \ No newline at end of file diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetCustomEmojiStickers.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetCustomEmojiStickers.kt index 60e3784a8d..17f2642424 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetCustomEmojiStickers.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetCustomEmojiStickers.kt @@ -4,34 +4,35 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetCustomEmojiStickers import dev.inmo.tgbotapi.requests.get.GetStickerSet import dev.inmo.tgbotapi.types.CustomEmojiId +import dev.inmo.tgbotapi.types.files.CustomEmojiSticker import dev.inmo.tgbotapi.types.files.Sticker import kotlin.js.JsName import kotlin.jvm.JvmName -suspend fun TelegramBot.getCustomEmojiStickers( +public suspend fun TelegramBot.getCustomEmojiStickers( customEmojiIds: List -) = execute( +): List = execute( GetCustomEmojiStickers(customEmojiIds) ) @JvmName("getCustomEmojiStickersWithStringsList") @JsName("getCustomEmojiStickersWithStringsList") -suspend fun TelegramBot.getCustomEmojiStickers( +public suspend fun TelegramBot.getCustomEmojiStickers( customEmojiIds: List -) = getCustomEmojiStickers(customEmojiIds.map(::CustomEmojiId)) +): List = getCustomEmojiStickers(customEmojiIds.map(::CustomEmojiId)) -suspend fun TelegramBot.getCustomEmojiStickerOrNull( +public suspend fun TelegramBot.getCustomEmojiStickerOrNull( customEmojiId: CustomEmojiId -) = getCustomEmojiStickers(listOf(customEmojiId)).firstOrNull() +): CustomEmojiSticker? = getCustomEmojiStickers(listOf(customEmojiId)).firstOrNull() -suspend fun TelegramBot.getCustomEmojiStickerOrThrow( +public suspend fun TelegramBot.getCustomEmojiStickerOrThrow( customEmojiId: CustomEmojiId -) = getCustomEmojiStickers(listOf(customEmojiId)).first() +): CustomEmojiSticker = getCustomEmojiStickers(listOf(customEmojiId)).first() -suspend fun TelegramBot.getCustomEmojiStickerOrNull( +public suspend fun TelegramBot.getCustomEmojiStickerOrNull( customEmojiId: String -) = getCustomEmojiStickerOrNull(CustomEmojiId(customEmojiId)) +): CustomEmojiSticker? = getCustomEmojiStickerOrNull(CustomEmojiId(customEmojiId)) -suspend fun TelegramBot.getCustomEmojiStickerOrThrow( +public suspend fun TelegramBot.getCustomEmojiStickerOrThrow( customEmojiId: String -) = getCustomEmojiStickerOrThrow(CustomEmojiId(customEmojiId)) +): CustomEmojiSticker = getCustomEmojiStickerOrThrow(CustomEmojiId(customEmojiId)) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt index 807959644e..5af9b2fac3 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetFile.kt @@ -3,19 +3,20 @@ package dev.inmo.tgbotapi.extensions.api.get import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.abstracts.FileId import dev.inmo.tgbotapi.requests.get.GetFile +import dev.inmo.tgbotapi.types.files.PathedFile import dev.inmo.tgbotapi.types.files.TelegramMediaFile import dev.inmo.tgbotapi.types.message.content.MediaContent -suspend fun TelegramBot.getFileAdditionalInfo( +public suspend fun TelegramBot.getFileAdditionalInfo( fileId: FileId -) = execute( +): PathedFile = execute( GetFile(fileId) ) -suspend fun TelegramBot.getFileAdditionalInfo( +public suspend fun TelegramBot.getFileAdditionalInfo( file: TelegramMediaFile -) = getFileAdditionalInfo(file.fileId) +): PathedFile = getFileAdditionalInfo(file.fileId) -suspend fun TelegramBot.getFileAdditionalInfo( +public suspend fun TelegramBot.getFileAdditionalInfo( content: MediaContent -) = getFileAdditionalInfo(content.media) +): PathedFile = getFileAdditionalInfo(content.media) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStarTransactions.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStarTransactions.kt index 74e7504f22..348c4fcd8d 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStarTransactions.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStarTransactions.kt @@ -2,11 +2,12 @@ package dev.inmo.tgbotapi.extensions.api.get import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetStarTransactions +import dev.inmo.tgbotapi.types.payments.stars.StarTransactions -suspend fun TelegramBot.getStarTransactions( +public suspend fun TelegramBot.getStarTransactions( offset: Int? = null, limit: Int? = null, -) = execute( +): StarTransactions = execute( GetStarTransactions( offset = offset, limit = limit diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt index 997b84ccb7..df3ce8ce70 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetStickerSet.kt @@ -4,27 +4,28 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetStickerSet import dev.inmo.tgbotapi.types.StickerSetName import dev.inmo.tgbotapi.types.files.Sticker +import dev.inmo.tgbotapi.types.stickers.StickerSet -suspend fun TelegramBot.getStickerSet( +public suspend fun TelegramBot.getStickerSet( name: StickerSetName -) = execute( +): StickerSet = execute( GetStickerSet(name) ) -suspend fun TelegramBot.getStickerSet( +public suspend fun TelegramBot.getStickerSet( name: String -) = getStickerSet( +): StickerSet = getStickerSet( StickerSetName(name) ) -suspend fun TelegramBot.getStickerSetOrNull( +public suspend fun TelegramBot.getStickerSetOrNull( sticker: Sticker -) = sticker.stickerSetName ?.let { +): StickerSet? = sticker.stickerSetName ?.let { getStickerSet(it) } -suspend fun TelegramBot.getStickerSetOrThrow( +public suspend fun TelegramBot.getStickerSetOrThrow( sticker: Sticker -) = getStickerSet( +): StickerSet = getStickerSet( sticker.stickerSetName ?: error("Sticker must contains stickerSetName to be correctly used in getStickerSet method") ) diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserChatBoosts.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserChatBoosts.kt index 23b4d42111..ab18163eb9 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserChatBoosts.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserChatBoosts.kt @@ -4,16 +4,17 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetUserChatBoosts import dev.inmo.tgbotapi.types.ChatIdentifier import dev.inmo.tgbotapi.types.UserId +import dev.inmo.tgbotapi.types.boosts.UserChatBoosts import dev.inmo.tgbotapi.types.chat.Chat -suspend fun TelegramBot.getUserChatBoosts( +public suspend fun TelegramBot.getUserChatBoosts( chatId: ChatIdentifier, userId: UserId -) = execute( +): UserChatBoosts = execute( GetUserChatBoosts(chatId = chatId, userId = userId) ) -suspend fun TelegramBot.getUserChatBoosts( +public suspend fun TelegramBot.getUserChatBoosts( chat: Chat, userId: UserId -) = getUserChatBoosts(chatId = chat.id, userId = userId) \ No newline at end of file +): UserChatBoosts = getUserChatBoosts(chatId = chat.id, userId = userId) \ No newline at end of file diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserProfilePhotos.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserProfilePhotos.kt index 14fb14d019..ff51cd5a58 100644 --- a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserProfilePhotos.kt +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetUserProfilePhotos.kt @@ -4,19 +4,20 @@ import dev.inmo.tgbotapi.bot.TelegramBot import dev.inmo.tgbotapi.requests.get.GetUserProfilePhotos import dev.inmo.tgbotapi.types.chat.CommonUser import dev.inmo.tgbotapi.types.UserId +import dev.inmo.tgbotapi.types.UserProfilePhotos -suspend fun TelegramBot.getUserProfilePhotos( +public suspend fun TelegramBot.getUserProfilePhotos( userId: UserId, offset: Int? = null, limit: Int? = null -) = execute( +): UserProfilePhotos = execute( GetUserProfilePhotos( userId, offset, limit ) ) -suspend fun TelegramBot.getUserProfilePhotos( +public suspend fun TelegramBot.getUserProfilePhotos( user: CommonUser, offset: Int? = null, limit: Int? = null -) = getUserProfilePhotos(user.id, offset, limit) +): UserProfilePhotos = getUserProfilePhotos(user.id, offset, limit)