1
0
mirror of https://github.com/InsanusMokrassar/TelegramBotAPI.git synced 2024-11-18 06:13:47 +00:00

remove redundant includes of business connection id in send requests

This commit is contained in:
InsanusMokrassar 2024-04-17 13:55:37 +06:00
parent e4a3acdd68
commit 170747741f
20 changed files with 26 additions and 33 deletions

View File

@ -29,7 +29,6 @@ fun CopyMessage(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
@ -42,7 +41,6 @@ fun CopyMessage(
parseMode,
null,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
@ -55,7 +53,6 @@ fun CopyMessage(
messageId: MessageId,
entities: List<TextSource>,
threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
@ -68,7 +65,6 @@ fun CopyMessage(
null,
entities.toRawMessageEntities(),
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
@ -82,7 +78,6 @@ fun CopyMessage(
text: String? = null,
parseMode: ParseMode? = null,
threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
@ -95,7 +90,6 @@ fun CopyMessage(
parseMode,
null,
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
@ -108,7 +102,6 @@ fun CopyMessage(
toChatId: ChatIdentifier,
entities: List<TextSource>,
threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
replyParameters: ReplyParameters? = null,
@ -121,7 +114,6 @@ fun CopyMessage(
null,
entities.toRawMessageEntities(),
threadId,
businessConnectionId,
disableNotification,
protectContent,
replyParameters,
@ -144,8 +136,6 @@ data class CopyMessage internal constructor(
private val rawEntities: List<RawMessageEntity>? = null,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = toChatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)

View File

@ -22,7 +22,6 @@ fun CopyMessages(
fromChatId: ChatIdentifier,
messageIds: Array<MessageId>,
threadId: MessageThreadId? = toChatId.threadId,
businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
disableNotification: Boolean = false,
protectContent: Boolean = false,
removeCaption: Boolean = false
@ -46,8 +45,6 @@ data class CopyMessages (
override val messageIds: List<MessageId>,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = toChatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = toChatId.businessConnectionId,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)
@ -58,7 +55,6 @@ data class CopyMessages (
MessagesAction,
ProtectContent,
OptionallyMessageThreadRequest,
OptionallyBusinessConnectionRequest,
DisableNotification {
override val chatId: ChatIdentifier
get() = fromChatId

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.requests.send
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@ -35,7 +36,7 @@ data class SendContact(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<ContactContent>>,
) : SendContentMessageRequest<ContentMessage<ContactContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<ContactContent>>
{
constructor(

View File

@ -111,7 +111,7 @@ data class SendLocation internal constructor(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<LocationContent>>,
) : SendContentMessageRequest<ContentMessage<LocationContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<LocationContent>>,
PositionedSendMessageRequest<ContentMessage<LocationContent>>,
HorizontallyAccured,

View File

@ -94,7 +94,7 @@ data class SendTextMessage internal constructor(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<TextContent>>,
) : SendContentMessageRequest<ContentMessage<TextContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<TextContent>>,
TextableSendMessageRequest<ContentMessage<TextContent>>,
LinkPreviewOptionsContainer

View File

@ -45,7 +45,7 @@ data class SendVenue(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<VenueContent>>,
) : SendContentMessageRequest<ContentMessage<VenueContent>>,
PositionedSendMessageRequest<ContentMessage<VenueContent>>,
TitledSendMessageRequest<ContentMessage<VenueContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<VenueContent>>

View File

@ -0,0 +1,5 @@
package dev.inmo.tgbotapi.requests.send.abstracts
import dev.inmo.tgbotapi.abstracts.types.OptionallyBusinessConnectionRequest
interface SendContentMessageRequest<T: Any> : SendMessageRequest<T>, OptionallyBusinessConnectionRequest

View File

@ -6,5 +6,4 @@ interface SendMessageRequest<T: Any> : SendChatMessageRequest<T>,
WithReplyParameters,
DisableNotification,
ProtectContent,
OptionallyMessageThreadRequest,
OptionallyBusinessConnectionRequest
OptionallyMessageThreadRequest

View File

@ -1,6 +1,7 @@
package dev.inmo.tgbotapi.requests.send.games
import dev.inmo.tgbotapi.abstracts.types.WithReplyMarkup
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@ -31,7 +32,7 @@ data class SendGame (
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<GameContent>>,
) : SendContentMessageRequest<ContentMessage<GameContent>>,
WithReplyMarkup {
override fun method(): String = "sendGame"
override val resultDeserializer: DeserializationStrategy<ContentMessage<GameContent>>

View File

@ -156,7 +156,7 @@ data class SendAnimationData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AnimationContent>>,
SendMessageRequest<ContentMessage<AnimationContent>>,
SendContentMessageRequest<ContentMessage<AnimationContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<AnimationContent>>,
TextableSendMessageRequest<ContentMessage<AnimationContent>>,
ThumbedSendMessageRequest<ContentMessage<AnimationContent>>,

View File

@ -151,7 +151,7 @@ data class SendAudioData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<AudioContent>>,
SendMessageRequest<ContentMessage<AudioContent>>,
SendContentMessageRequest<ContentMessage<AudioContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<AudioContent>>,
TextableSendMessageRequest<ContentMessage<AudioContent>>,
ThumbedSendMessageRequest<ContentMessage<AudioContent>>,

View File

@ -165,7 +165,7 @@ data class SendDocumentData internal constructor(
@SerialName(disableContentTypeDetectionField)
val disableContentTypeDetection: Boolean? = null
) : DataRequest<ContentMessage<DocumentContent>>,
SendMessageRequest<ContentMessage<DocumentContent>>,
SendContentMessageRequest<ContentMessage<DocumentContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<DocumentContent>>,
TextableSendMessageRequest<ContentMessage<DocumentContent>>,
ThumbedSendMessageRequest<ContentMessage<DocumentContent>>

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send.media
import dev.inmo.tgbotapi.requests.abstracts.MultipartFile
import dev.inmo.tgbotapi.requests.abstracts.Request
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.requests.send.media.base.*
import dev.inmo.tgbotapi.types.*
@ -157,7 +158,7 @@ data class SendMediaGroupData internal constructor(
@SerialName(replyParametersField)
override val replyParameters: ReplyParameters? = null,
) : DataRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>>,
SendMessageRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
SendContentMessageRequest<PossiblySentViaBotCommonMessage<MediaGroupContent<MediaGroupPartContent>>> {
@SerialName(mediaField)
private val convertedMedia: String
get() = buildJsonArray {

View File

@ -124,7 +124,7 @@ data class SendPhotoData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<PhotoContent>>,
SendMessageRequest<ContentMessage<PhotoContent>>,
SendContentMessageRequest<ContentMessage<PhotoContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<PhotoContent>>,
TextableSendMessageRequest<ContentMessage<PhotoContent>>,
OptionallyWithSpoilerRequest

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send.media
import dev.inmo.tgbotapi.requests.abstracts.*
import dev.inmo.tgbotapi.requests.common.CommonMultipartFileRequest
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@ -62,7 +63,7 @@ data class SendStickerByFileId internal constructor(
override val replyParameters: ReplyParameters? = null,
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : SendMessageRequest<ContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<StickerContent>> {
) : SendContentMessageRequest<ContentMessage<StickerContent>>, ReplyingMarkupSendMessageRequest<ContentMessage<StickerContent>> {
override fun method(): String = "sendSticker"
override val resultDeserializer: DeserializationStrategy<ContentMessage<StickerContent>>
get() = commonResultDeserializer

View File

@ -162,7 +162,7 @@ data class SendVideoData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoContent>>,
SendMessageRequest<ContentMessage<VideoContent>>,
SendContentMessageRequest<ContentMessage<VideoContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<VideoContent>>,
TextableSendMessageRequest<ContentMessage<VideoContent>>,
ThumbedSendMessageRequest<ContentMessage<VideoContent>>,

View File

@ -81,7 +81,7 @@ data class SendVideoNoteData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VideoNoteContent>>,
SendMessageRequest<ContentMessage<VideoNoteContent>>,
SendContentMessageRequest<ContentMessage<VideoNoteContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<VideoNoteContent>>,
ThumbedSendMessageRequest<ContentMessage<VideoNoteContent>>,
DuratedSendMessageRequest<ContentMessage<VideoNoteContent>>,

View File

@ -130,7 +130,7 @@ data class SendVoiceData internal constructor(
@SerialName(replyMarkupField)
override val replyMarkup: KeyboardMarkup? = null
) : DataRequest<ContentMessage<VoiceContent>>,
SendMessageRequest<ContentMessage<VoiceContent>>,
SendContentMessageRequest<ContentMessage<VoiceContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<VoiceContent>>,
TextableSendMessageRequest<ContentMessage<VoiceContent>>,
DuratedSendMessageRequest<ContentMessage<VoiceContent>>

View File

@ -61,8 +61,6 @@ data class SendInvoice(
override val priceDependOnShipAddress: Boolean = false,
@SerialName(messageThreadIdField)
override val threadId: MessageThreadId? = chatId.threadId,
@SerialName(businessConnectionIdField)
override val businessConnectionId: BusinessConnectionId? = chatId.businessConnectionId,
@SerialName(disableNotificationField)
override val disableNotification: Boolean = false,
@SerialName(protectContentField)

View File

@ -3,6 +3,7 @@ package dev.inmo.tgbotapi.requests.send.polls
import korlibs.time.DateTime
import dev.inmo.tgbotapi.abstracts.TextedOutput
import dev.inmo.tgbotapi.requests.send.abstracts.ReplyingMarkupSendMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendContentMessageRequest
import dev.inmo.tgbotapi.requests.send.abstracts.SendMessageRequest
import dev.inmo.tgbotapi.types.*
import dev.inmo.tgbotapi.types.business_connection.BusinessConnectionId
@ -156,7 +157,7 @@ private fun ScheduledCloseInfo.checkSendData() {
}
}
sealed class SendPoll : SendMessageRequest<ContentMessage<PollContent>>,
sealed class SendPoll : SendContentMessageRequest<ContentMessage<PollContent>>,
ReplyingMarkupSendMessageRequest<ContentMessage<PollContent>> {
abstract val question: String
abstract val options: List<String>