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 e2e6344cb4..d6e6603bce 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 @@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId suspend fun TelegramBot.getBusinessConnection( id: BusinessConnectionId -) = execute(GetBusinessConnection(id = id)) +) = execute(GetBusinessConnection(businessConnectionId = id)) @Warning("This method may lead to error due to raw String type usage") suspend fun TelegramBot.getBusinessConnection( diff --git a/tgbotapi.core/api/tgbotapi.core.api b/tgbotapi.core/api/tgbotapi.core.api index d9dc787a13..997841651f 100644 --- a/tgbotapi.core/api/tgbotapi.core.api +++ b/tgbotapi.core/api/tgbotapi.core.api @@ -4158,14 +4158,15 @@ public final class dev/inmo/tgbotapi/requests/games/abstracts/SetGameScore$Defau public static fun method (Ldev/inmo/tgbotapi/requests/games/abstracts/SetGameScore;)Ljava/lang/String; } -public final class dev/inmo/tgbotapi/requests/get/GetBusinessConnection : dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { +public final class dev/inmo/tgbotapi/requests/get/GetBusinessConnection : dev/inmo/tgbotapi/abstracts/types/WithBusinessConnectionId, dev/inmo/tgbotapi/requests/abstracts/SimpleRequest { public static final field Companion Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection$Companion; public synthetic fun (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-T-_HSQI ()Ljava/lang/String; public final fun copy-SYn5crI (Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection; public static synthetic fun copy-SYn5crI$default (Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection;Ljava/lang/String;ILjava/lang/Object;)Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection; public fun equals (Ljava/lang/Object;)Z - public final fun getId-T-_HSQI ()Ljava/lang/String; + public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String; + public synthetic fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public fun getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy; public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; public fun hashCode ()I @@ -11879,17 +11880,17 @@ public final class dev/inmo/tgbotapi/types/business_connection/BusinessLocation$ public final class dev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted : dev/inmo/tgbotapi/abstracts/types/WithBusinessConnectionId { public static final field Companion Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted$Companion; - public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;JLkotlin/jvm/internal/DefaultConstructorMarker;)V + public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;Ljava/util/List;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public final fun component1-T-_HSQI ()Ljava/lang/String; public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewChat; - public final fun component3-APLFQys ()J - public final fun copy-BHBJ6J4 (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;J)Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted; - public static synthetic fun copy-BHBJ6J4$default (Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;JILjava/lang/Object;)Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted; + public final fun component3 ()Ljava/util/List; + public final fun copy-LpiUw8E (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;Ljava/util/List;)Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted; + public static synthetic fun copy-LpiUw8E$default (Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;Ljava/util/List;ILjava/lang/Object;)Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted; public fun equals (Ljava/lang/Object;)Z public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String; public synthetic fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public final fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewChat; - public final fun getMessageId-APLFQys ()J + public final fun getMessageIds ()Ljava/util/List; public fun hashCode ()I public fun toString ()Ljava/lang/String; } @@ -12000,45 +12001,6 @@ public final class dev/inmo/tgbotapi/types/business_connection/MinutesInterval$C public final fun serializer ()Lkotlinx/serialization/KSerializer; } -public final class dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection { - public static final field Companion Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection$Companion; - public fun (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;)V - public synthetic fun (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewUser;JLdev/inmo/tgbotapi/types/TelegramDate;ZZLkotlin/jvm/internal/DefaultConstructorMarker;)V - public final fun component1-T-_HSQI ()Ljava/lang/String; - public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewUser; - public final fun component3-tHkBKVM ()J - public final fun component4 ()Ldev/inmo/tgbotapi/types/TelegramDate; - public final fun component5 ()Z - public final fun component6 ()Z - public final fun copy-FubJ-Q0 (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewUser;JLdev/inmo/tgbotapi/types/TelegramDate;ZZ)Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection; - public static synthetic fun copy-FubJ-Q0$default (Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection;Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewUser;JLdev/inmo/tgbotapi/types/TelegramDate;ZZILjava/lang/Object;)Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection; - public fun equals (Ljava/lang/Object;)Z - public final fun getAsBusinessConnection ()Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection; - public final fun getCanReply ()Z - public final fun getDate ()Ldev/inmo/tgbotapi/types/TelegramDate; - public final fun getId-T-_HSQI ()Ljava/lang/String; - public final fun getUser ()Ldev/inmo/tgbotapi/types/chat/PreviewUser; - public final fun getUserChatId-tHkBKVM ()J - public fun hashCode ()I - public final fun isEnabled ()Z - public fun toString ()Ljava/lang/String; -} - -public final class dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection$$serializer : kotlinx/serialization/internal/GeneratedSerializer { - public static final field INSTANCE Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection$$serializer; - public fun childSerializers ()[Lkotlinx/serialization/KSerializer; - public fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection; - public synthetic fun deserialize (Lkotlinx/serialization/encoding/Decoder;)Ljava/lang/Object; - public fun getDescriptor ()Lkotlinx/serialization/descriptors/SerialDescriptor; - public fun serialize (Lkotlinx/serialization/encoding/Encoder;Ldev/inmo/tgbotapi/types/business_connection/RawBusinessConnection;)V - public synthetic fun serialize (Lkotlinx/serialization/encoding/Encoder;Ljava/lang/Object;)V - public fun typeParametersSerializers ()[Lkotlinx/serialization/KSerializer; -} - -public final class dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection$Companion { - public final fun serializer ()Lkotlinx/serialization/KSerializer; -} - public final class dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/CallbackDataInlineKeyboardButton : dev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/InlineKeyboardButton { public static final field Companion Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/CallbackDataInlineKeyboardButton$Companion; public fun (Ljava/lang/String;Ljava/lang/String;)V diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetBusinessConnection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetBusinessConnection.kt index db9d938c7f..08b4899fe8 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetBusinessConnection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/requests/get/GetBusinessConnection.kt @@ -1,10 +1,10 @@ package dev.inmo.tgbotapi.requests.get +import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest +import dev.inmo.tgbotapi.types.businessConnectionIdField import dev.inmo.tgbotapi.types.business_connection.BusinessConnection import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId -import dev.inmo.tgbotapi.types.files.PathedFile -import dev.inmo.tgbotapi.types.idField import kotlinx.serialization.DeserializationStrategy import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -12,15 +12,15 @@ import kotlinx.serialization.SerializationStrategy @Serializable data class GetBusinessConnection( - @SerialName(idField) - val id: BusinessConnectionId -) : SimpleRequest { + @SerialName(businessConnectionIdField) + override val businessConnectionId: BusinessConnectionId +) : SimpleRequest, WithBusinessConnectionId { override fun method(): String { return "getBusinessConnection" } override val resultDeserializer: DeserializationStrategy - get() = BusinessConnection.serializer() + get() = BusinessConnection.Companion override val requestSerializer: SerializationStrategy<*> get() = serializer() } \ No newline at end of file diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt index 54f079f597..7ef20b945c 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessConnection.kt @@ -4,15 +4,12 @@ import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewUser import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded -import kotlinx.serialization.EncodeDefault -import kotlinx.serialization.KSerializer -import kotlinx.serialization.SerialName -import kotlinx.serialization.Serializable +import kotlinx.serialization.* import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Encoder -@Serializable +@Serializable(BusinessConnection.Companion::class) @ClassCastsIncluded sealed interface BusinessConnection : WithBusinessConnectionId { val id: BusinessConnectionId @@ -59,6 +56,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId { override val isEnabled: Boolean = false } + @Serializer(BusinessConnection::class) companion object : KSerializer { override val descriptor: SerialDescriptor get() = RawBusinessConnection.serializer().descriptor @@ -69,8 +67,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId { } override fun serialize(encoder: Encoder, value: BusinessConnection) { - + RawBusinessConnection.serializer().serialize(encoder, RawBusinessConnection(value)) } - } } diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted.kt index dfba8de848..071267f5ca 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted.kt @@ -2,11 +2,8 @@ package dev.inmo.tgbotapi.types.business_connection import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId import dev.inmo.tgbotapi.abstracts.types.WithOptionalBusinessConnectionId -import dev.inmo.tgbotapi.types.MessageId -import dev.inmo.tgbotapi.types.businessConnectionIdField +import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.chat.PreviewChat -import dev.inmo.tgbotapi.types.chatField -import dev.inmo.tgbotapi.types.messageIdField import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @@ -16,6 +13,6 @@ data class BusinessMessagesDeleted( override val businessConnectionId: BusinessConnectionId, @SerialName(chatField) val chat: PreviewChat, - @SerialName(messageIdField) - val messageId: MessageId + @SerialName(messageIdsField) + val messageIds: List ) : WithBusinessConnectionId diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt index 5b14aaf187..f90c682fd0 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/business_connection/RawBusinessConnection.kt @@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName import kotlinx.serialization.Serializable @Serializable -data class RawBusinessConnection( +internal data class RawBusinessConnection( @SerialName(idField) val id: BusinessConnectionId, @SerialName(userField) diff --git a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt index 442e4c589d..18ef2010ce 100644 --- a/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt +++ b/tgbotapi.core/src/commonMain/kotlin/dev/inmo/tgbotapi/types/update/RawUpdate.kt @@ -49,6 +49,7 @@ internal data class RawUpdate constructor( private val message_reaction_count: ChatMessageReactionsCountUpdated? = null, private val chat_boost: ChatBoostUpdated? = null, private val removed_chat_boost: ChatBoostRemoved? = null, + @Serializable(BusinessConnection.Companion::class) private val business_connection: BusinessConnection? = null, @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) private val business_message: BusinessContentMessage<*>? = null,