diff --git a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/PinChatMessage.swift b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/PinChatMessage.swift index 09abbe0..9f2f333 100644 --- a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/PinChatMessage.swift +++ b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/PinChatMessage.swift @@ -9,6 +9,9 @@ import Foundation /// Parameters container struct for `pinChatMessage` method public struct TGPinChatMessageParams: Encodable { + /// Unique identifier of the business connection on behalf of which the message will be pinned + public var businessConnectionId: String? + /// Unique identifier for the target chat or username of the target channel (in the format @channelusername) public var chatId: TGChatId @@ -20,12 +23,14 @@ public struct TGPinChatMessageParams: Encodable { /// Custom keys for coding/decoding `PinChatMessageParams` struct public enum CodingKeys: String, CodingKey { + case businessConnectionId = "business_connection_id" case chatId = "chat_id" case messageId = "message_id" case disableNotification = "disable_notification" } - public init(chatId: TGChatId, messageId: Int, disableNotification: Bool? = nil) { + public init(businessConnectionId: String? = nil, chatId: TGChatId, messageId: Int, disableNotification: Bool? = nil) { + self.businessConnectionId = businessConnectionId self.chatId = chatId self.messageId = messageId self.disableNotification = disableNotification diff --git a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/SetStickerSetThumbnail.swift b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/SetStickerSetThumbnail.swift index 258549b..8f74910 100644 --- a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/SetStickerSetThumbnail.swift +++ b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/SetStickerSetThumbnail.swift @@ -15,7 +15,7 @@ public struct TGSetStickerSetThumbnailParams: Encodable { /// User identifier of the sticker set owner public var userId: Int64 - /// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. + /// A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animation-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-requirements for video sticker technical requirements. Pass a file_id as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. More information on Sending Files ». Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail. public var thumbnail: TGFileInfo? /// Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video diff --git a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/UnpinChatMessage.swift b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/UnpinChatMessage.swift index b63443b..8609a2a 100644 --- a/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/UnpinChatMessage.swift +++ b/Sources/SwiftTelegramSdk/Bot/Telegram/Methods/UnpinChatMessage.swift @@ -9,19 +9,24 @@ import Foundation /// Parameters container struct for `unpinChatMessage` method public struct TGUnpinChatMessageParams: Encodable { + /// Unique identifier of the business connection on behalf of which the message will be unpinned + public var businessConnectionId: String? + /// Unique identifier for the target chat or username of the target channel (in the format @channelusername) public var chatId: TGChatId - /// Identifier of a message to unpin. If not specified, the most recent pinned message (by sending date) will be unpinned. + /// Identifier of the message to unpin. Required if business_connection_id is specified. If not specified, the most recent pinned message (by sending date) will be unpinned. public var messageId: Int? /// Custom keys for coding/decoding `UnpinChatMessageParams` struct public enum CodingKeys: String, CodingKey { + case businessConnectionId = "business_connection_id" case chatId = "chat_id" case messageId = "message_id" } - public init(chatId: TGChatId, messageId: Int? = nil) { + public init(businessConnectionId: String? = nil, chatId: TGChatId, messageId: Int? = nil) { + self.businessConnectionId = businessConnectionId self.chatId = chatId self.messageId = messageId } diff --git a/Sources/SwiftTelegramSdk/Bot/Telegram/Models/TGUser.swift b/Sources/SwiftTelegramSdk/Bot/Telegram/Models/TGUser.swift index c0038ea..420273f 100644 --- a/Sources/SwiftTelegramSdk/Bot/Telegram/Models/TGUser.swift +++ b/Sources/SwiftTelegramSdk/Bot/Telegram/Models/TGUser.swift @@ -22,6 +22,7 @@ public final class TGUser: Codable { case canReadAllGroupMessages = "can_read_all_group_messages" case supportsInlineQueries = "supports_inline_queries" case canConnectToBusiness = "can_connect_to_business" + case hasMainWebApp = "has_main_web_app" } /// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit integer or double-precision float type are safe for storing this identifier. @@ -60,7 +61,10 @@ public final class TGUser: Codable { /// Optional. True, if the bot can be connected to a Telegram Business account to receive its messages. Returned only in getMe. public var canConnectToBusiness: Bool? - public init (id: Int64, isBot: Bool, firstName: String, lastName: String? = nil, username: String? = nil, languageCode: String? = nil, isPremium: Bool? = nil, addedToAttachmentMenu: Bool? = nil, canJoinGroups: Bool? = nil, canReadAllGroupMessages: Bool? = nil, supportsInlineQueries: Bool? = nil, canConnectToBusiness: Bool? = nil) { + /// Optional. True, if the bot has a main Web App. Returned only in getMe. + public var hasMainWebApp: Bool? + + public init (id: Int64, isBot: Bool, firstName: String, lastName: String? = nil, username: String? = nil, languageCode: String? = nil, isPremium: Bool? = nil, addedToAttachmentMenu: Bool? = nil, canJoinGroups: Bool? = nil, canReadAllGroupMessages: Bool? = nil, supportsInlineQueries: Bool? = nil, canConnectToBusiness: Bool? = nil, hasMainWebApp: Bool? = nil) { self.id = id self.isBot = isBot self.firstName = firstName @@ -73,5 +77,6 @@ public final class TGUser: Codable { self.canReadAllGroupMessages = canReadAllGroupMessages self.supportsInlineQueries = supportsInlineQueries self.canConnectToBusiness = canConnectToBusiness + self.hasMainWebApp = hasMainWebApp } }