1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2026-03-03 17:32:23 +00:00

add support of getChatGifts and getUserGifts

This commit is contained in:
2026-02-20 17:05:51 +06:00
parent 83b4d2155f
commit f10cfdbe1e
8 changed files with 258 additions and 650 deletions

View File

@@ -6,6 +6,14 @@ import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.ChatIdentifier
import dev.inmo.tgbotapi.types.OwnedGifts
import dev.inmo.tgbotapi.types.chatIdField
import dev.inmo.tgbotapi.types.excludeUnsavedField
import dev.inmo.tgbotapi.types.excludeSavedField
import dev.inmo.tgbotapi.types.excludeUnlimitedField
import dev.inmo.tgbotapi.types.excludeLimitedUpgradableField
import dev.inmo.tgbotapi.types.excludeLimitedNonUpgradableField
import dev.inmo.tgbotapi.types.excludeFromBlockchainField
import dev.inmo.tgbotapi.types.excludeUniqueField
import dev.inmo.tgbotapi.types.sortByPriceField
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived
import dev.inmo.tgbotapi.types.limitField
import dev.inmo.tgbotapi.types.offsetField
@@ -14,11 +22,26 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
// TODO::Fix
@Serializable
data class GetChatGifts(
@SerialName(chatIdField)
override val chatId: ChatIdentifier,
@SerialName(excludeUnsavedField)
val excludeUnsaved: Boolean = false,
@SerialName(excludeSavedField)
val excludeSaved: Boolean = false,
@SerialName(excludeUnlimitedField)
val excludeUnlimited: Boolean = false,
@SerialName(excludeLimitedUpgradableField)
val excludeLimitedUpgradable: Boolean = false,
@SerialName(excludeLimitedNonUpgradableField)
val excludeLimitedNonUpgradable: Boolean = false,
@SerialName(excludeFromBlockchainField)
val excludeFromBlockchain: Boolean = false,
@SerialName(excludeUniqueField)
val excludeUnique: Boolean = false,
@SerialName(sortByPriceField)
val sortByPrice: Boolean = false,
@SerialName(offsetField)
val offset: String? = null,
@SerialName(limitField)

View File

@@ -4,6 +4,12 @@ import dev.inmo.micro_utils.common.Warning
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest
import dev.inmo.tgbotapi.types.OwnedGifts
import dev.inmo.tgbotapi.types.UserId
import dev.inmo.tgbotapi.types.excludeUnlimitedField
import dev.inmo.tgbotapi.types.excludeLimitedUpgradableField
import dev.inmo.tgbotapi.types.excludeLimitedNonUpgradableField
import dev.inmo.tgbotapi.types.excludeFromBlockchainField
import dev.inmo.tgbotapi.types.excludeUniqueField
import dev.inmo.tgbotapi.types.sortByPriceField
import dev.inmo.tgbotapi.types.gifts.GiftSentOrReceived
import dev.inmo.tgbotapi.types.limitField
import dev.inmo.tgbotapi.types.offsetField
@@ -13,12 +19,23 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.SerializationStrategy
// TODO::Fix
@Serializable
data class GetUserGifts(
@Suppress("SERIALIZER_TYPE_INCOMPATIBLE")
@SerialName(userIdField)
val userId: UserId,
@SerialName(excludeUnlimitedField)
val excludeUnlimited: Boolean = false,
@SerialName(excludeLimitedUpgradableField)
val excludeLimitedUpgradable: Boolean = false,
@SerialName(excludeLimitedNonUpgradableField)
val excludeLimitedNonUpgradable: Boolean = false,
@SerialName(excludeFromBlockchainField)
val excludeFromBlockchain: Boolean = false,
@SerialName(excludeUniqueField)
val excludeUnique: Boolean = false,
@SerialName(sortByPriceField)
val sortByPrice: Boolean = false,
@SerialName(offsetField)
val offset: String? = null,
@SerialName(limitField)

View File

@@ -30,7 +30,7 @@ sealed interface Gift {
val personalRemainingCount: Int?
val isPremium: Boolean
val hasColors: Boolean
val background: dev.inmo.tgbotapi.types.gifts.GiftBackground?
val background: GiftBackground?
val uniqueGiftVariantCount: Int?
/**
@@ -57,7 +57,7 @@ sealed interface Gift {
@SerialName(hasColorsField)
override val hasColors: Boolean = false,
@SerialName(backgroundField)
override val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null,
override val background: GiftBackground? = null,
@SerialName(uniqueGiftVariantCountField)
override val uniqueGiftVariantCount: Int? = null,
) : Regular {
@@ -95,7 +95,7 @@ sealed interface Gift {
@SerialName(hasColorsField)
override val hasColors: Boolean = false,
@SerialName(backgroundField)
override val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null,
override val background: GiftBackground? = null,
@SerialName(uniqueGiftVariantCountField)
override val uniqueGiftVariantCount: Int? = null,
) : Regular
@@ -115,7 +115,7 @@ sealed interface Gift {
val personal_remaining_count: Int? = null,
val is_premium: Boolean = false,
val has_colors: Boolean = false,
val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null,
val background: GiftBackground? = null,
val unique_gift_variant_count: Int? = null,
)
@@ -225,7 +225,7 @@ sealed interface Gift {
val personal_remaining_count: Int? = null,
val is_premium: Boolean = false,
val has_colors: Boolean = false,
val background: dev.inmo.tgbotapi.types.gifts.GiftBackground? = null,
val background: GiftBackground? = null,
val unique_gift_variant_count: Int? = null,
// unique gift fields
val base_name: String? = null,
@@ -235,7 +235,7 @@ sealed interface Gift {
val symbol: UniqueGiftSymbol? = null,
val backdrop: UniqueGiftBackdrop? = null,
val is_from_blockchain: Boolean = false,
val colors: dev.inmo.tgbotapi.types.gifts.unique.UniqueGiftColors? = null,
val colors: UniqueGiftColors? = null,
val publisher_chat: PreviewChat? = null,
)