1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-12-23 00:57:13 +00:00

fixes in business connections

This commit is contained in:
InsanusMokrassar 2024-04-19 17:36:38 +06:00
parent 0a9235bcd9
commit ab9718b7c6
7 changed files with 24 additions and 67 deletions

View File

@ -7,7 +7,7 @@ import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
suspend fun TelegramBot.getBusinessConnection( suspend fun TelegramBot.getBusinessConnection(
id: BusinessConnectionId id: BusinessConnectionId
) = execute(GetBusinessConnection(id = id)) ) = execute(GetBusinessConnection(businessConnectionId = id))
@Warning("This method may lead to error due to raw String type usage") @Warning("This method may lead to error due to raw String type usage")
suspend fun TelegramBot.getBusinessConnection( suspend fun TelegramBot.getBusinessConnection(

View File

@ -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 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 static final field Companion Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection$Companion;
public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun <init> (Ljava/lang/String;Lkotlin/jvm/internal/DefaultConstructorMarker;)V
public final fun component1-T-_HSQI ()Ljava/lang/String; public final fun component1-T-_HSQI ()Ljava/lang/String;
public final fun copy-SYn5crI (Ljava/lang/String;)Ldev/inmo/tgbotapi/requests/get/GetBusinessConnection; 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 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 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 getRequestSerializer ()Lkotlinx/serialization/SerializationStrategy;
public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy; public fun getResultDeserializer ()Lkotlinx/serialization/DeserializationStrategy;
public fun hashCode ()I 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 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 static final field Companion Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted$Companion;
public synthetic fun <init> (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;JLkotlin/jvm/internal/DefaultConstructorMarker;)V public synthetic fun <init> (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 component1-T-_HSQI ()Ljava/lang/String;
public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewChat; public final fun component2 ()Ldev/inmo/tgbotapi/types/chat/PreviewChat;
public final fun component3-APLFQys ()J public final fun component3 ()Ljava/util/List;
public final fun copy-BHBJ6J4 (Ljava/lang/String;Ldev/inmo/tgbotapi/types/chat/PreviewChat;J)Ldev/inmo/tgbotapi/types/business_connection/BusinessMessagesDeleted; 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-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 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 equals (Ljava/lang/Object;)Z
public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String; public fun getBusinessConnectionId-T-_HSQI ()Ljava/lang/String;
public synthetic fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String; public synthetic fun getBusinessConnectionId-nXr5wdE ()Ljava/lang/String;
public final fun getChat ()Ldev/inmo/tgbotapi/types/chat/PreviewChat; 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 hashCode ()I
public fun toString ()Ljava/lang/String; 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 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 <init> (Ldev/inmo/tgbotapi/types/business_connection/BusinessConnection;)V
public synthetic fun <init> (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 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 static final field Companion Ldev/inmo/tgbotapi/types/buttons/InlineKeyboardButtons/CallbackDataInlineKeyboardButton$Companion;
public fun <init> (Ljava/lang/String;Ljava/lang/String;)V public fun <init> (Ljava/lang/String;Ljava/lang/String;)V

View File

@ -1,10 +1,10 @@
package dev.inmo.tgbotapi.requests.get package dev.inmo.tgbotapi.requests.get
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.requests.abstracts.SimpleRequest 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.BusinessConnection
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId 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.DeserializationStrategy
import kotlinx.serialization.SerialName import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -12,15 +12,15 @@ import kotlinx.serialization.SerializationStrategy
@Serializable @Serializable
data class GetBusinessConnection( data class GetBusinessConnection(
@SerialName(idField) @SerialName(businessConnectionIdField)
val id: BusinessConnectionId override val businessConnectionId: BusinessConnectionId
) : SimpleRequest<BusinessConnection> { ) : SimpleRequest<BusinessConnection>, WithBusinessConnectionId {
override fun method(): String { override fun method(): String {
return "getBusinessConnection" return "getBusinessConnection"
} }
override val resultDeserializer: DeserializationStrategy<BusinessConnection> override val resultDeserializer: DeserializationStrategy<BusinessConnection>
get() = BusinessConnection.serializer() get() = BusinessConnection.Companion
override val requestSerializer: SerializationStrategy<*> override val requestSerializer: SerializationStrategy<*>
get() = serializer() get() = serializer()
} }

View File

@ -4,15 +4,12 @@ import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.types.* import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.chat.PreviewUser import dev.inmo.tgbotapi.types.chat.PreviewUser
import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded import dev.inmo.tgbotapi.utils.internal.ClassCastsIncluded
import kotlinx.serialization.EncodeDefault import kotlinx.serialization.*
import kotlinx.serialization.KSerializer
import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable
import kotlinx.serialization.descriptors.SerialDescriptor import kotlinx.serialization.descriptors.SerialDescriptor
import kotlinx.serialization.encoding.Decoder import kotlinx.serialization.encoding.Decoder
import kotlinx.serialization.encoding.Encoder import kotlinx.serialization.encoding.Encoder
@Serializable @Serializable(BusinessConnection.Companion::class)
@ClassCastsIncluded @ClassCastsIncluded
sealed interface BusinessConnection : WithBusinessConnectionId { sealed interface BusinessConnection : WithBusinessConnectionId {
val id: BusinessConnectionId val id: BusinessConnectionId
@ -59,6 +56,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
override val isEnabled: Boolean = false override val isEnabled: Boolean = false
} }
@Serializer(BusinessConnection::class)
companion object : KSerializer<BusinessConnection> { companion object : KSerializer<BusinessConnection> {
override val descriptor: SerialDescriptor override val descriptor: SerialDescriptor
get() = RawBusinessConnection.serializer().descriptor get() = RawBusinessConnection.serializer().descriptor
@ -69,8 +67,7 @@ sealed interface BusinessConnection : WithBusinessConnectionId {
} }
override fun serialize(encoder: Encoder, value: BusinessConnection) { override fun serialize(encoder: Encoder, value: BusinessConnection) {
RawBusinessConnection.serializer().serialize(encoder, RawBusinessConnection(value))
} }
} }
} }

View File

@ -2,11 +2,8 @@ package dev.inmo.tgbotapi.types.business_connection
import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId import dev.inmo.tgbotapi.abstracts.types.WithBusinessConnectionId
import dev.inmo.tgbotapi.abstracts.types.WithOptionalBusinessConnectionId import dev.inmo.tgbotapi.abstracts.types.WithOptionalBusinessConnectionId
import dev.inmo.tgbotapi.types.MessageId import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.businessConnectionIdField
import dev.inmo.tgbotapi.types.chat.PreviewChat 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.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@ -16,6 +13,6 @@ data class BusinessMessagesDeleted(
override val businessConnectionId: BusinessConnectionId, override val businessConnectionId: BusinessConnectionId,
@SerialName(chatField) @SerialName(chatField)
val chat: PreviewChat, val chat: PreviewChat,
@SerialName(messageIdField) @SerialName(messageIdsField)
val messageId: MessageId val messageIds: List<MessageId>
) : WithBusinessConnectionId ) : WithBusinessConnectionId

View File

@ -6,7 +6,7 @@ import kotlinx.serialization.SerialName
import kotlinx.serialization.Serializable import kotlinx.serialization.Serializable
@Serializable @Serializable
data class RawBusinessConnection( internal data class RawBusinessConnection(
@SerialName(idField) @SerialName(idField)
val id: BusinessConnectionId, val id: BusinessConnectionId,
@SerialName(userField) @SerialName(userField)

View File

@ -49,6 +49,7 @@ internal data class RawUpdate constructor(
private val message_reaction_count: ChatMessageReactionsCountUpdated? = null, private val message_reaction_count: ChatMessageReactionsCountUpdated? = null,
private val chat_boost: ChatBoostUpdated? = null, private val chat_boost: ChatBoostUpdated? = null,
private val removed_chat_boost: ChatBoostRemoved? = null, private val removed_chat_boost: ChatBoostRemoved? = null,
@Serializable(BusinessConnection.Companion::class)
private val business_connection: BusinessConnection? = null, private val business_connection: BusinessConnection? = null,
@Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class) @Serializable(TelegramBotAPIMessageDeserializeOnlySerializer::class)
private val business_message: BusinessContentMessage<*>? = null, private val business_message: BusinessContentMessage<*>? = null,