mirror of
https://github.com/InsanusMokrassar/TelegramBotAPI.git
synced 2026-03-03 09:22:22 +00:00
add OwnedGifts sealed interface
This commit is contained in:
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.business_connection.GetBusinessAccountGifts
|
||||
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
|
||||
import dev.inmo.tgbotapi.types.OwnedGifts
|
||||
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||
import dev.inmo.tgbotapi.types.gifts.OwnedGift
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
import kotlin.runCatching
|
||||
@@ -21,7 +22,7 @@ public suspend fun TelegramBot.getBusinessAccountGifts(
|
||||
sortByPrice: Boolean = false,
|
||||
offset: String? = null,
|
||||
limit: Int? = null
|
||||
): OwnedGifts<GiftSentOrReceivedEvent.ReceivedInBusinessAccount> = execute(
|
||||
): OwnedGifts<OwnedGift.OwnedByBusinessAccount> = execute(
|
||||
GetBusinessAccountGifts(
|
||||
businessConnectionId,
|
||||
excludeUnsaved,
|
||||
@@ -71,7 +72,7 @@ public fun TelegramBot.getBusinessAccountGiftsFlow(
|
||||
initialOffset: String? = null,
|
||||
limit: Int? = null,
|
||||
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
|
||||
): Flow<OwnedGifts<GiftSentOrReceivedEvent.ReceivedInBusinessAccount>> = flow {
|
||||
): Flow<OwnedGifts<OwnedGift.OwnedByBusinessAccount>> = flow {
|
||||
var currentOffset = initialOffset
|
||||
do {
|
||||
val response = runCatching {
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.gifts.GetChatGifts
|
||||
import dev.inmo.tgbotapi.types.ChatIdentifier
|
||||
import dev.inmo.tgbotapi.types.OwnedGifts
|
||||
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||
import dev.inmo.tgbotapi.types.gifts.OwnedGift
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
@@ -20,7 +21,7 @@ public suspend fun TelegramBot.getChatGifts(
|
||||
sortByPrice: Boolean = false,
|
||||
offset: String? = null,
|
||||
limit: Int? = null
|
||||
): OwnedGifts<GiftSentOrReceivedEvent> = execute(
|
||||
): OwnedGifts<OwnedGift.Common> = execute(
|
||||
GetChatGifts(
|
||||
chatId,
|
||||
excludeUnsaved,
|
||||
@@ -49,7 +50,7 @@ public fun TelegramBot.getChatGiftsFlow(
|
||||
initialOffset: String? = null,
|
||||
limit: Int? = null,
|
||||
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
|
||||
): Flow<OwnedGifts<GiftSentOrReceivedEvent>> = flow {
|
||||
): Flow<OwnedGifts<OwnedGift.Common>> = flow {
|
||||
var currentOffset = initialOffset
|
||||
do {
|
||||
val response = runCatching {
|
||||
|
||||
@@ -5,6 +5,7 @@ import dev.inmo.tgbotapi.requests.gifts.GetUserGifts
|
||||
import dev.inmo.tgbotapi.types.OwnedGifts
|
||||
import dev.inmo.tgbotapi.types.UserId
|
||||
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceivedEvent
|
||||
import dev.inmo.tgbotapi.types.gifts.OwnedGift
|
||||
import kotlinx.coroutines.flow.Flow
|
||||
import kotlinx.coroutines.flow.flow
|
||||
|
||||
@@ -18,7 +19,7 @@ public suspend fun TelegramBot.getUserGifts(
|
||||
sortByPrice: Boolean = false,
|
||||
offset: String? = null,
|
||||
limit: Int? = null
|
||||
): OwnedGifts<GiftSentOrReceivedEvent> = execute(
|
||||
): OwnedGifts<OwnedGift.Common> = execute(
|
||||
GetUserGifts(
|
||||
userId,
|
||||
excludeUnlimited,
|
||||
@@ -43,7 +44,7 @@ public fun TelegramBot.getUserGiftsFlow(
|
||||
initialOffset: String? = null,
|
||||
limit: Int? = null,
|
||||
onErrorContinueChecker: suspend (Throwable?) -> Boolean = { false }
|
||||
): Flow<OwnedGifts<GiftSentOrReceivedEvent>> = flow {
|
||||
): Flow<OwnedGifts<OwnedGift.Common>> = flow {
|
||||
var currentOffset = initialOffset
|
||||
do {
|
||||
val response = runCatching {
|
||||
|
||||
Reference in New Issue
Block a user