From f2e97df44c0659a7430a5d6f7ea93a2d007d7745 Mon Sep 17 00:00:00 2001 From: InsanusMokrassar Date: Sun, 23 Jun 2024 15:16:05 +0600 Subject: [PATCH] add support of getStarTransactions --- .../extensions/api/get/GetTransactions.kt | 14 +++++++++++ .../requests/get/GetStarTransactions.kt | 23 +++++++++++++++++++ 2 files changed, 37 insertions(+) create mode 100644 tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetTransactions.kt create mode 100644 tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetStarTransactions.kt diff --git a/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetTransactions.kt b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetTransactions.kt new file mode 100644 index 0000000000..74e7504f22 --- /dev/null +++ b/tgbotapi.api/src/commonMain/kotlin/dev/inmo/tgbotapi/extensions/api/get/GetTransactions.kt @@ -0,0 +1,14 @@ +package dev.inmo.tgbotapi.extensions.api.get + +import dev.inmo.tgbotapi.bot.TelegramBot +import dev.inmo.tgbotapi.requests.get.GetStarTransactions + +suspend fun TelegramBot.getStarTransactions( + offset: Int? = null, + limit: Int? = null, +) = execute( + GetStarTransactions( + offset = offset, + limit = limit + ) +) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetStarTransactions.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetStarTransactions.kt new file mode 100644 index 0000000000..78907c068a --- /dev/null +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetStarTransactions.kt @@ -0,0 +1,23 @@ +package dev.inmo.tgbotapi.requests.get + +import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.* +import dev.inmo.tgbotapi.types.payments.stars.StarTransactions +import kotlinx.serialization.DeserializationStrategy +import kotlinx.serialization.SerialName +import kotlinx.serialization.Serializable +import kotlinx.serialization.SerializationStrategy + +@Serializable +data class GetStarTransactions( + @SerialName(offsetField) + val offset: Int? = null, + @SerialName(limitField) + val limit: Int? = null, +) : SimpleRequest { + override fun method(): String = "getStarTransactions" + override val resultDeserializer: DeserializationStrategy + get() = StarTransactions.serializer() + override val requestSerializer: SerializationStrategy<*> + get() = serializer() +} \ No newline at end of file