diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index ae1b5a7e68..ec029e5835 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -107,6 +107,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[894081801] = { return Api.BotInlineMessage.parse_botInlineMessageMediaInvoice($0) } dict[-1970903652] = { return Api.BotInlineMessage.parse_botInlineMessageMediaVenue($0) } dict[-2137335386] = { return Api.BotInlineMessage.parse_botInlineMessageMediaWebPage($0) } + dict[174161531] = { return Api.BotInlineMessage.parse_botInlineMessageRichMessage($0) } dict[-1937807902] = { return Api.BotInlineMessage.parse_botInlineMessageText($0) } dict[400266251] = { return Api.BotInlineResult.parse_botInlineMediaResult($0) } dict[295067450] = { return Api.BotInlineResult.parse_botInlineResult($0) } @@ -259,7 +260,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1815593308] = { return Api.DocumentAttribute.parse_documentAttributeImageSize($0) } dict[1662637586] = { return Api.DocumentAttribute.parse_documentAttributeSticker($0) } dict[1137015880] = { return Api.DocumentAttribute.parse_documentAttributeVideo($0) } - dict[-1743452271] = { return Api.DraftMessage.parse_draftMessage($0) } + dict[1627271828] = { return Api.DraftMessage.parse_draftMessage($0) } dict[453805082] = { return Api.DraftMessage.parse_draftMessageEmpty($0) } dict[-1764723459] = { return Api.EmailVerification.parse_emailVerificationApple($0) } dict[-1842457175] = { return Api.EmailVerification.parse_emailVerificationCode($0) } @@ -339,6 +340,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-672693723] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaInvoice($0) } dict[1098628881] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaVenue($0) } dict[-1109605104] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageMediaWebPage($0) } + dict[-1271007892] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageRichMessage($0) } dict[1036876423] = { return Api.InputBotInlineMessage.parse_inputBotInlineMessageText($0) } dict[-1995686519] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID($0) } dict[-1227287081] = { return Api.InputBotInlineMessageID.parse_inputBotInlineMessageID64($0) } @@ -443,8 +445,6 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1548122514] = { return Api.InputNotifyPeer.parse_inputNotifyForumTopic($0) } dict[-1195615476] = { return Api.InputNotifyPeer.parse_inputNotifyPeer($0) } dict[423314455] = { return Api.InputNotifyPeer.parse_inputNotifyUsers($0) } - dict[2105227266] = { return Api.InputPageListOrderedItem.parse_inputPageListOrderedItemBlocks($0) } - dict[-1682665696] = { return Api.InputPageListOrderedItem.parse_inputPageListOrderedItemText($0) } dict[1528613672] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialFirebasePNV($0) } dict[1009235855] = { return Api.InputPasskeyCredential.parse_inputPasskeyCredentialPublicKey($0) } dict[-1021329078] = { return Api.InputPasskeyResponse.parse_inputPasskeyResponseLogin($0) } @@ -756,11 +756,11 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1001931436] = { return Api.OutboxReadDate.parse_outboxReadDate($0) } dict[-1738178803] = { return Api.Page.parse_page($0) } dict[1464557951] = { return Api.PageBlock.parse_inputPageBlockMap($0) } - dict[-1186155733] = { return Api.PageBlock.parse_inputPageBlockOrderedList($0) } dict[-837994576] = { return Api.PageBlock.parse_pageBlockAnchor($0) } dict[-2143067670] = { return Api.PageBlock.parse_pageBlockAudio($0) } dict[-1162877472] = { return Api.PageBlock.parse_pageBlockAuthorDate($0) } dict[641563686] = { return Api.PageBlock.parse_pageBlockBlockquote($0) } + dict[242108356] = { return Api.PageBlock.parse_pageBlockBlockquoteBlocks($0) } dict[-283684427] = { return Api.PageBlock.parse_pageBlockChannel($0) } dict[1705048653] = { return Api.PageBlock.parse_pageBlockCollage($0) } dict[972174080] = { return Api.PageBlock.parse_pageBlockCover($0) } @@ -780,7 +780,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-454524911] = { return Api.PageBlock.parse_pageBlockList($0) } dict[-1538310410] = { return Api.PageBlock.parse_pageBlockMap($0) } dict[1493699616] = { return Api.PageBlock.parse_pageBlockMath($0) } - dict[-1702174239] = { return Api.PageBlock.parse_pageBlockOrderedList($0) } + dict[534181569] = { return Api.PageBlock.parse_pageBlockOrderedList($0) } dict[1182402406] = { return Api.PageBlock.parse_pageBlockParagraph($0) } dict[391759200] = { return Api.PageBlock.parse_pageBlockPhoto($0) } dict[-1066346178] = { return Api.PageBlock.parse_pageBlockPreformatted($0) } @@ -797,8 +797,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1869903447] = { return Api.PageCaption.parse_pageCaption($0) } dict[1674209194] = { return Api.PageListItem.parse_pageListItemBlocks($0) } dict[794323004] = { return Api.PageListItem.parse_pageListItemText($0) } - dict[1109995988] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } - dict[-851533770] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) } + dict[-1879910928] = { return Api.PageListOrderedItem.parse_pageListOrderedItemBlocks($0) } + dict[352522633] = { return Api.PageListOrderedItem.parse_pageListOrderedItemText($0) } dict[-1282352120] = { return Api.PageRelatedArticle.parse_pageRelatedArticle($0) } dict[878078826] = { return Api.PageTableCell.parse_pageTableCell($0) } dict[-524237339] = { return Api.PageTableRow.parse_pageTableRow($0) } @@ -1495,7 +1495,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-438840932] = { return Api.messages.ChatFull.parse_chatFull($0) } dict[-2118733814] = { return Api.messages.ChatInviteImporters.parse_chatInviteImporters($0) } dict[1146512295] = { return Api.messages.ChatInviteJoinResult.parse_chatInviteJoinResultOk($0) } - dict[2001452532] = { return Api.messages.ChatInviteJoinResult.parse_chatInviteJoinResultWebView($0) } + dict[793887543] = { return Api.messages.ChatInviteJoinResult.parse_chatInviteJoinResultWebView($0) } dict[1694474197] = { return Api.messages.Chats.parse_chats($0) } dict[-1663561404] = { return Api.messages.Chats.parse_chatsSlice($0) } dict[-1571952873] = { return Api.messages.CheckedHistoryImportPeer.parse_checkedHistoryImportPeer($0) } @@ -2042,8 +2042,6 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.InputNotifyPeer: _1.serialize(buffer, boxed) - case let _1 as Api.InputPageListOrderedItem: - _1.serialize(buffer, boxed) case let _1 as Api.InputPasskeyCredential: _1.serialize(buffer, boxed) case let _1 as Api.InputPasskeyResponse: diff --git a/submodules/TelegramApi/Sources/Api11.swift b/submodules/TelegramApi/Sources/Api11.swift index 2d6b640d41..dc425a13f2 100644 --- a/submodules/TelegramApi/Sources/Api11.swift +++ b/submodules/TelegramApi/Sources/Api11.swift @@ -1451,131 +1451,85 @@ public extension Api { } } public extension Api { - indirect enum InputPageListOrderedItem: TypeConstructorDescription { - public class Cons_inputPageListOrderedItemBlocks: TypeConstructorDescription { - public var flags: Int32 - public var blocks: [Api.PageBlock] - public var value: Int32? - public var type: String? - public init(flags: Int32, blocks: [Api.PageBlock], value: Int32?, type: String?) { - self.flags = flags - self.blocks = blocks - self.value = value - self.type = type + enum InputPasskeyCredential: TypeConstructorDescription { + public class Cons_inputPasskeyCredentialFirebasePNV: TypeConstructorDescription { + public var pnvToken: String + public init(pnvToken: String) { + self.pnvToken = pnvToken } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("blocks", ConstructorParameterDescription(self.blocks)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))]) + return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(self.pnvToken))]) } } - public class Cons_inputPageListOrderedItemText: TypeConstructorDescription { - public var flags: Int32 - public var text: Api.RichText - public var value: Int32? - public var type: String? - public init(flags: Int32, text: Api.RichText, value: Int32?, type: String?) { - self.flags = flags - self.text = text - self.value = value - self.type = type + public class Cons_inputPasskeyCredentialPublicKey: TypeConstructorDescription { + public var id: String + public var rawId: String + public var response: Api.InputPasskeyResponse + public init(id: String, rawId: String, response: Api.InputPasskeyResponse) { + self.id = id + self.rawId = rawId + self.response = response } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("text", ConstructorParameterDescription(self.text)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))]) + return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(self.id)), ("rawId", ConstructorParameterDescription(self.rawId)), ("response", ConstructorParameterDescription(self.response))]) } } - case inputPageListOrderedItemBlocks(Cons_inputPageListOrderedItemBlocks) - case inputPageListOrderedItemText(Cons_inputPageListOrderedItemText) + case inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV) + case inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .inputPageListOrderedItemBlocks(let _data): + case .inputPasskeyCredentialFirebasePNV(let _data): if boxed { - buffer.appendInt32(2105227266) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.blocks.count)) - for item in _data.blocks { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt32(_data.value!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeString(_data.type!, buffer: buffer, boxed: false) + buffer.appendInt32(1528613672) } + serializeString(_data.pnvToken, buffer: buffer, boxed: false) break - case .inputPageListOrderedItemText(let _data): + case .inputPasskeyCredentialPublicKey(let _data): if boxed { - buffer.appendInt32(-1682665696) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.text.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt32(_data.value!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeString(_data.type!, buffer: buffer, boxed: false) + buffer.appendInt32(1009235855) } + serializeString(_data.id, buffer: buffer, boxed: false) + serializeString(_data.rawId, buffer: buffer, boxed: false) + _data.response.serialize(buffer, true) break } } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { - case .inputPageListOrderedItemBlocks(let _data): - return ("inputPageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("blocks", ConstructorParameterDescription(_data.blocks)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))]) - case .inputPageListOrderedItemText(let _data): - return ("inputPageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("text", ConstructorParameterDescription(_data.text)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))]) + case .inputPasskeyCredentialFirebasePNV(let _data): + return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(_data.pnvToken))]) + case .inputPasskeyCredentialPublicKey(let _data): + return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(_data.id)), ("rawId", ConstructorParameterDescription(_data.rawId)), ("response", ConstructorParameterDescription(_data.response))]) } } - public static func parse_inputPageListOrderedItemBlocks(_ reader: BufferReader) -> InputPageListOrderedItem? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.PageBlock]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self) - } - var _3: Int32? - if Int(_1 ?? 0) & Int(1 << 2) != 0 { - _3 = reader.readInt32() - } - var _4: String? - if Int(_1 ?? 0) & Int(1 << 3) != 0 { - _4 = parseString(reader) - } + public static func parse_inputPasskeyCredentialFirebasePNV(_ reader: BufferReader) -> InputPasskeyCredential? { + var _1: String? + _1 = parseString(reader) let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil - let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.InputPageListOrderedItem.inputPageListOrderedItemBlocks(Cons_inputPageListOrderedItemBlocks(flags: _1!, blocks: _2!, value: _3, type: _4)) + if _c1 { + return Api.InputPasskeyCredential.inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV(pnvToken: _1!)) } else { return nil } } - public static func parse_inputPageListOrderedItemText(_ reader: BufferReader) -> InputPageListOrderedItem? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.RichText? + public static func parse_inputPasskeyCredentialPublicKey(_ reader: BufferReader) -> InputPasskeyCredential? { + var _1: String? + _1 = parseString(reader) + var _2: String? + _2 = parseString(reader) + var _3: Api.InputPasskeyResponse? if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.RichText - } - var _3: Int32? - if Int(_1 ?? 0) & Int(1 << 2) != 0 { - _3 = reader.readInt32() - } - var _4: String? - if Int(_1 ?? 0) & Int(1 << 3) != 0 { - _4 = parseString(reader) + _3 = Api.parse(reader, signature: signature) as? Api.InputPasskeyResponse } let _c1 = _1 != nil let _c2 = _2 != nil - let _c3 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _3 != nil - let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.InputPageListOrderedItem.inputPageListOrderedItemText(Cons_inputPageListOrderedItemText(flags: _1!, text: _2!, value: _3, type: _4)) + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api12.swift b/submodules/TelegramApi/Sources/Api12.swift index 952b136e13..89a9c99847 100644 --- a/submodules/TelegramApi/Sources/Api12.swift +++ b/submodules/TelegramApi/Sources/Api12.swift @@ -1,90 +1,3 @@ -public extension Api { - enum InputPasskeyCredential: TypeConstructorDescription { - public class Cons_inputPasskeyCredentialFirebasePNV: TypeConstructorDescription { - public var pnvToken: String - public init(pnvToken: String) { - self.pnvToken = pnvToken - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(self.pnvToken))]) - } - } - public class Cons_inputPasskeyCredentialPublicKey: TypeConstructorDescription { - public var id: String - public var rawId: String - public var response: Api.InputPasskeyResponse - public init(id: String, rawId: String, response: Api.InputPasskeyResponse) { - self.id = id - self.rawId = rawId - self.response = response - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(self.id)), ("rawId", ConstructorParameterDescription(self.rawId)), ("response", ConstructorParameterDescription(self.response))]) - } - } - case inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV) - case inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .inputPasskeyCredentialFirebasePNV(let _data): - if boxed { - buffer.appendInt32(1528613672) - } - serializeString(_data.pnvToken, buffer: buffer, boxed: false) - break - case .inputPasskeyCredentialPublicKey(let _data): - if boxed { - buffer.appendInt32(1009235855) - } - serializeString(_data.id, buffer: buffer, boxed: false) - serializeString(_data.rawId, buffer: buffer, boxed: false) - _data.response.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .inputPasskeyCredentialFirebasePNV(let _data): - return ("inputPasskeyCredentialFirebasePNV", [("pnvToken", ConstructorParameterDescription(_data.pnvToken))]) - case .inputPasskeyCredentialPublicKey(let _data): - return ("inputPasskeyCredentialPublicKey", [("id", ConstructorParameterDescription(_data.id)), ("rawId", ConstructorParameterDescription(_data.rawId)), ("response", ConstructorParameterDescription(_data.response))]) - } - } - - public static func parse_inputPasskeyCredentialFirebasePNV(_ reader: BufferReader) -> InputPasskeyCredential? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.InputPasskeyCredential.inputPasskeyCredentialFirebasePNV(Cons_inputPasskeyCredentialFirebasePNV(pnvToken: _1!)) - } - else { - return nil - } - } - public static func parse_inputPasskeyCredentialPublicKey(_ reader: BufferReader) -> InputPasskeyCredential? { - var _1: String? - _1 = parseString(reader) - var _2: String? - _2 = parseString(reader) - var _3: Api.InputPasskeyResponse? - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.InputPasskeyResponse - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.InputPasskeyCredential.inputPasskeyCredentialPublicKey(Cons_inputPasskeyCredentialPublicKey(id: _1!, rawId: _2!, response: _3!)) - } - else { - return nil - } - } - } -} public extension Api { enum InputPasskeyResponse: TypeConstructorDescription { public class Cons_inputPasskeyResponseLogin: TypeConstructorDescription { @@ -969,3 +882,246 @@ public extension Api { } } } +public extension Api { + enum InputPrivacyRule: TypeConstructorDescription { + public class Cons_inputPrivacyValueAllowChatParticipants: TypeConstructorDescription { + public var chats: [Int64] + public init(chats: [Int64]) { + self.chats = chats + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))]) + } + } + public class Cons_inputPrivacyValueAllowUsers: TypeConstructorDescription { + public var users: [Api.InputUser] + public init(users: [Api.InputUser]) { + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(self.users))]) + } + } + public class Cons_inputPrivacyValueDisallowChatParticipants: TypeConstructorDescription { + public var chats: [Int64] + public init(chats: [Int64]) { + self.chats = chats + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))]) + } + } + public class Cons_inputPrivacyValueDisallowUsers: TypeConstructorDescription { + public var users: [Api.InputUser] + public init(users: [Api.InputUser]) { + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(self.users))]) + } + } + case inputPrivacyValueAllowAll + case inputPrivacyValueAllowBots + case inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants) + case inputPrivacyValueAllowCloseFriends + case inputPrivacyValueAllowContacts + case inputPrivacyValueAllowPremium + case inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers) + case inputPrivacyValueDisallowAll + case inputPrivacyValueDisallowBots + case inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants) + case inputPrivacyValueDisallowContacts + case inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputPrivacyValueAllowAll: + if boxed { + buffer.appendInt32(407582158) + } + break + case .inputPrivacyValueAllowBots: + if boxed { + buffer.appendInt32(1515179237) + } + break + case .inputPrivacyValueAllowChatParticipants(let _data): + if boxed { + buffer.appendInt32(-2079962673) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + serializeInt64(item, buffer: buffer, boxed: false) + } + break + case .inputPrivacyValueAllowCloseFriends: + if boxed { + buffer.appendInt32(793067081) + } + break + case .inputPrivacyValueAllowContacts: + if boxed { + buffer.appendInt32(218751099) + } + break + case .inputPrivacyValueAllowPremium: + if boxed { + buffer.appendInt32(2009975281) + } + break + case .inputPrivacyValueAllowUsers(let _data): + if boxed { + buffer.appendInt32(320652927) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .inputPrivacyValueDisallowAll: + if boxed { + buffer.appendInt32(-697604407) + } + break + case .inputPrivacyValueDisallowBots: + if boxed { + buffer.appendInt32(-991594219) + } + break + case .inputPrivacyValueDisallowChatParticipants(let _data): + if boxed { + buffer.appendInt32(-380694650) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + serializeInt64(item, buffer: buffer, boxed: false) + } + break + case .inputPrivacyValueDisallowContacts: + if boxed { + buffer.appendInt32(195371015) + } + break + case .inputPrivacyValueDisallowUsers(let _data): + if boxed { + buffer.appendInt32(-1877932953) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .inputPrivacyValueAllowAll: + return ("inputPrivacyValueAllowAll", []) + case .inputPrivacyValueAllowBots: + return ("inputPrivacyValueAllowBots", []) + case .inputPrivacyValueAllowChatParticipants(let _data): + return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))]) + case .inputPrivacyValueAllowCloseFriends: + return ("inputPrivacyValueAllowCloseFriends", []) + case .inputPrivacyValueAllowContacts: + return ("inputPrivacyValueAllowContacts", []) + case .inputPrivacyValueAllowPremium: + return ("inputPrivacyValueAllowPremium", []) + case .inputPrivacyValueAllowUsers(let _data): + return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(_data.users))]) + case .inputPrivacyValueDisallowAll: + return ("inputPrivacyValueDisallowAll", []) + case .inputPrivacyValueDisallowBots: + return ("inputPrivacyValueDisallowBots", []) + case .inputPrivacyValueDisallowChatParticipants(let _data): + return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))]) + case .inputPrivacyValueDisallowContacts: + return ("inputPrivacyValueDisallowContacts", []) + case .inputPrivacyValueDisallowUsers(let _data): + return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_inputPrivacyValueAllowAll(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueAllowAll + } + public static func parse_inputPrivacyValueAllowBots(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueAllowBots + } + public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { + var _1: [Int64]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + let _c1 = _1 != nil + if _c1 { + return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants(chats: _1!)) + } + else { + return nil + } + } + public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends + } + public static func parse_inputPrivacyValueAllowContacts(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueAllowContacts + } + public static func parse_inputPrivacyValueAllowPremium(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueAllowPremium + } + public static func parse_inputPrivacyValueAllowUsers(_ reader: BufferReader) -> InputPrivacyRule? { + var _1: [Api.InputUser]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self) + } + let _c1 = _1 != nil + if _c1 { + return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers(users: _1!)) + } + else { + return nil + } + } + public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueDisallowAll + } + public static func parse_inputPrivacyValueDisallowBots(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueDisallowBots + } + public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { + var _1: [Int64]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + let _c1 = _1 != nil + if _c1 { + return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants(chats: _1!)) + } + else { + return nil + } + } + public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? { + return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts + } + public static func parse_inputPrivacyValueDisallowUsers(_ reader: BufferReader) -> InputPrivacyRule? { + var _1: [Api.InputUser]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self) + } + let _c1 = _1 != nil + if _c1 { + return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers(users: _1!)) + } + else { + return nil + } + } + } +} diff --git a/submodules/TelegramApi/Sources/Api13.swift b/submodules/TelegramApi/Sources/Api13.swift index d4296b5adb..2373270d99 100644 --- a/submodules/TelegramApi/Sources/Api13.swift +++ b/submodules/TelegramApi/Sources/Api13.swift @@ -1,246 +1,3 @@ -public extension Api { - enum InputPrivacyRule: TypeConstructorDescription { - public class Cons_inputPrivacyValueAllowChatParticipants: TypeConstructorDescription { - public var chats: [Int64] - public init(chats: [Int64]) { - self.chats = chats - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))]) - } - } - public class Cons_inputPrivacyValueAllowUsers: TypeConstructorDescription { - public var users: [Api.InputUser] - public init(users: [Api.InputUser]) { - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(self.users))]) - } - } - public class Cons_inputPrivacyValueDisallowChatParticipants: TypeConstructorDescription { - public var chats: [Int64] - public init(chats: [Int64]) { - self.chats = chats - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(self.chats))]) - } - } - public class Cons_inputPrivacyValueDisallowUsers: TypeConstructorDescription { - public var users: [Api.InputUser] - public init(users: [Api.InputUser]) { - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(self.users))]) - } - } - case inputPrivacyValueAllowAll - case inputPrivacyValueAllowBots - case inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants) - case inputPrivacyValueAllowCloseFriends - case inputPrivacyValueAllowContacts - case inputPrivacyValueAllowPremium - case inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers) - case inputPrivacyValueDisallowAll - case inputPrivacyValueDisallowBots - case inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants) - case inputPrivacyValueDisallowContacts - case inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .inputPrivacyValueAllowAll: - if boxed { - buffer.appendInt32(407582158) - } - break - case .inputPrivacyValueAllowBots: - if boxed { - buffer.appendInt32(1515179237) - } - break - case .inputPrivacyValueAllowChatParticipants(let _data): - if boxed { - buffer.appendInt32(-2079962673) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - serializeInt64(item, buffer: buffer, boxed: false) - } - break - case .inputPrivacyValueAllowCloseFriends: - if boxed { - buffer.appendInt32(793067081) - } - break - case .inputPrivacyValueAllowContacts: - if boxed { - buffer.appendInt32(218751099) - } - break - case .inputPrivacyValueAllowPremium: - if boxed { - buffer.appendInt32(2009975281) - } - break - case .inputPrivacyValueAllowUsers(let _data): - if boxed { - buffer.appendInt32(320652927) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .inputPrivacyValueDisallowAll: - if boxed { - buffer.appendInt32(-697604407) - } - break - case .inputPrivacyValueDisallowBots: - if boxed { - buffer.appendInt32(-991594219) - } - break - case .inputPrivacyValueDisallowChatParticipants(let _data): - if boxed { - buffer.appendInt32(-380694650) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - serializeInt64(item, buffer: buffer, boxed: false) - } - break - case .inputPrivacyValueDisallowContacts: - if boxed { - buffer.appendInt32(195371015) - } - break - case .inputPrivacyValueDisallowUsers(let _data): - if boxed { - buffer.appendInt32(-1877932953) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .inputPrivacyValueAllowAll: - return ("inputPrivacyValueAllowAll", []) - case .inputPrivacyValueAllowBots: - return ("inputPrivacyValueAllowBots", []) - case .inputPrivacyValueAllowChatParticipants(let _data): - return ("inputPrivacyValueAllowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))]) - case .inputPrivacyValueAllowCloseFriends: - return ("inputPrivacyValueAllowCloseFriends", []) - case .inputPrivacyValueAllowContacts: - return ("inputPrivacyValueAllowContacts", []) - case .inputPrivacyValueAllowPremium: - return ("inputPrivacyValueAllowPremium", []) - case .inputPrivacyValueAllowUsers(let _data): - return ("inputPrivacyValueAllowUsers", [("users", ConstructorParameterDescription(_data.users))]) - case .inputPrivacyValueDisallowAll: - return ("inputPrivacyValueDisallowAll", []) - case .inputPrivacyValueDisallowBots: - return ("inputPrivacyValueDisallowBots", []) - case .inputPrivacyValueDisallowChatParticipants(let _data): - return ("inputPrivacyValueDisallowChatParticipants", [("chats", ConstructorParameterDescription(_data.chats))]) - case .inputPrivacyValueDisallowContacts: - return ("inputPrivacyValueDisallowContacts", []) - case .inputPrivacyValueDisallowUsers(let _data): - return ("inputPrivacyValueDisallowUsers", [("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_inputPrivacyValueAllowAll(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueAllowAll - } - public static func parse_inputPrivacyValueAllowBots(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueAllowBots - } - public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int64]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) - } - let _c1 = _1 != nil - if _c1 { - return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(Cons_inputPrivacyValueAllowChatParticipants(chats: _1!)) - } - else { - return nil - } - } - public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends - } - public static func parse_inputPrivacyValueAllowContacts(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueAllowContacts - } - public static func parse_inputPrivacyValueAllowPremium(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueAllowPremium - } - public static func parse_inputPrivacyValueAllowUsers(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Api.InputUser]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self) - } - let _c1 = _1 != nil - if _c1 { - return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(Cons_inputPrivacyValueAllowUsers(users: _1!)) - } - else { - return nil - } - } - public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueDisallowAll - } - public static func parse_inputPrivacyValueDisallowBots(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueDisallowBots - } - public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Int64]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) - } - let _c1 = _1 != nil - if _c1 { - return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(Cons_inputPrivacyValueDisallowChatParticipants(chats: _1!)) - } - else { - return nil - } - } - public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? { - return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts - } - public static func parse_inputPrivacyValueDisallowUsers(_ reader: BufferReader) -> InputPrivacyRule? { - var _1: [Api.InputUser]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self) - } - let _c1 = _1 != nil - if _c1 { - return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(Cons_inputPrivacyValueDisallowUsers(users: _1!)) - } - else { - return nil - } - } - } -} public extension Api { enum InputQuickReplyShortcut: TypeConstructorDescription { public class Cons_inputQuickReplyShortcut: TypeConstructorDescription { @@ -1559,3 +1316,160 @@ public extension Api { } } } +public extension Api { + enum InputStickerSetItem: TypeConstructorDescription { + public class Cons_inputStickerSetItem: TypeConstructorDescription { + public var flags: Int32 + public var document: Api.InputDocument + public var emoji: String + public var maskCoords: Api.MaskCoords? + public var keywords: String? + public init(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?, keywords: String?) { + self.flags = flags + self.document = document + self.emoji = emoji + self.maskCoords = maskCoords + self.keywords = keywords + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(self.flags)), ("document", ConstructorParameterDescription(self.document)), ("emoji", ConstructorParameterDescription(self.emoji)), ("maskCoords", ConstructorParameterDescription(self.maskCoords)), ("keywords", ConstructorParameterDescription(self.keywords))]) + } + } + case inputStickerSetItem(Cons_inputStickerSetItem) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputStickerSetItem(let _data): + if boxed { + buffer.appendInt32(853188252) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.document.serialize(buffer, true) + serializeString(_data.emoji, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.maskCoords!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.keywords!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .inputStickerSetItem(let _data): + return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(_data.flags)), ("document", ConstructorParameterDescription(_data.document)), ("emoji", ConstructorParameterDescription(_data.emoji)), ("maskCoords", ConstructorParameterDescription(_data.maskCoords)), ("keywords", ConstructorParameterDescription(_data.keywords))]) + } + } + + public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.InputDocument? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.InputDocument + } + var _3: String? + _3 = parseString(reader) + var _4: Api.MaskCoords? + if Int(_1 ?? 0) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.MaskCoords + } + } + var _5: String? + if Int(_1 ?? 0) & Int(1 << 1) != 0 { + _5 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.InputStickerSetItem.inputStickerSetItem(Cons_inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5)) + } + else { + return nil + } + } + } +} +public extension Api { + enum InputStickeredMedia: TypeConstructorDescription { + public class Cons_inputStickeredMediaDocument: TypeConstructorDescription { + public var id: Api.InputDocument + public init(id: Api.InputDocument) { + self.id = id + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(self.id))]) + } + } + public class Cons_inputStickeredMediaPhoto: TypeConstructorDescription { + public var id: Api.InputPhoto + public init(id: Api.InputPhoto) { + self.id = id + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(self.id))]) + } + } + case inputStickeredMediaDocument(Cons_inputStickeredMediaDocument) + case inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputStickeredMediaDocument(let _data): + if boxed { + buffer.appendInt32(70813275) + } + _data.id.serialize(buffer, true) + break + case .inputStickeredMediaPhoto(let _data): + if boxed { + buffer.appendInt32(1251549527) + } + _data.id.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .inputStickeredMediaDocument(let _data): + return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(_data.id))]) + case .inputStickeredMediaPhoto(let _data): + return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(_data.id))]) + } + } + + public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? { + var _1: Api.InputDocument? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.InputDocument + } + let _c1 = _1 != nil + if _c1 { + return Api.InputStickeredMedia.inputStickeredMediaDocument(Cons_inputStickeredMediaDocument(id: _1!)) + } + else { + return nil + } + } + public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? { + var _1: Api.InputPhoto? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto + } + let _c1 = _1 != nil + if _c1 { + return Api.InputStickeredMedia.inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto(id: _1!)) + } + else { + return nil + } + } + } +} diff --git a/submodules/TelegramApi/Sources/Api14.swift b/submodules/TelegramApi/Sources/Api14.swift index 547478f81f..21323b5388 100644 --- a/submodules/TelegramApi/Sources/Api14.swift +++ b/submodules/TelegramApi/Sources/Api14.swift @@ -1,160 +1,3 @@ -public extension Api { - enum InputStickerSetItem: TypeConstructorDescription { - public class Cons_inputStickerSetItem: TypeConstructorDescription { - public var flags: Int32 - public var document: Api.InputDocument - public var emoji: String - public var maskCoords: Api.MaskCoords? - public var keywords: String? - public init(flags: Int32, document: Api.InputDocument, emoji: String, maskCoords: Api.MaskCoords?, keywords: String?) { - self.flags = flags - self.document = document - self.emoji = emoji - self.maskCoords = maskCoords - self.keywords = keywords - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(self.flags)), ("document", ConstructorParameterDescription(self.document)), ("emoji", ConstructorParameterDescription(self.emoji)), ("maskCoords", ConstructorParameterDescription(self.maskCoords)), ("keywords", ConstructorParameterDescription(self.keywords))]) - } - } - case inputStickerSetItem(Cons_inputStickerSetItem) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .inputStickerSetItem(let _data): - if boxed { - buffer.appendInt32(853188252) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.document.serialize(buffer, true) - serializeString(_data.emoji, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.maskCoords!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.keywords!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .inputStickerSetItem(let _data): - return ("inputStickerSetItem", [("flags", ConstructorParameterDescription(_data.flags)), ("document", ConstructorParameterDescription(_data.document)), ("emoji", ConstructorParameterDescription(_data.emoji)), ("maskCoords", ConstructorParameterDescription(_data.maskCoords)), ("keywords", ConstructorParameterDescription(_data.keywords))]) - } - } - - public static func parse_inputStickerSetItem(_ reader: BufferReader) -> InputStickerSetItem? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.InputDocument? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.InputDocument - } - var _3: String? - _3 = parseString(reader) - var _4: Api.MaskCoords? - if Int(_1 ?? 0) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.MaskCoords - } - } - var _5: String? - if Int(_1 ?? 0) & Int(1 << 1) != 0 { - _5 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _4 != nil - let _c5 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.InputStickerSetItem.inputStickerSetItem(Cons_inputStickerSetItem(flags: _1!, document: _2!, emoji: _3!, maskCoords: _4, keywords: _5)) - } - else { - return nil - } - } - } -} -public extension Api { - enum InputStickeredMedia: TypeConstructorDescription { - public class Cons_inputStickeredMediaDocument: TypeConstructorDescription { - public var id: Api.InputDocument - public init(id: Api.InputDocument) { - self.id = id - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(self.id))]) - } - } - public class Cons_inputStickeredMediaPhoto: TypeConstructorDescription { - public var id: Api.InputPhoto - public init(id: Api.InputPhoto) { - self.id = id - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(self.id))]) - } - } - case inputStickeredMediaDocument(Cons_inputStickeredMediaDocument) - case inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .inputStickeredMediaDocument(let _data): - if boxed { - buffer.appendInt32(70813275) - } - _data.id.serialize(buffer, true) - break - case .inputStickeredMediaPhoto(let _data): - if boxed { - buffer.appendInt32(1251549527) - } - _data.id.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .inputStickeredMediaDocument(let _data): - return ("inputStickeredMediaDocument", [("id", ConstructorParameterDescription(_data.id))]) - case .inputStickeredMediaPhoto(let _data): - return ("inputStickeredMediaPhoto", [("id", ConstructorParameterDescription(_data.id))]) - } - } - - public static func parse_inputStickeredMediaDocument(_ reader: BufferReader) -> InputStickeredMedia? { - var _1: Api.InputDocument? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.InputDocument - } - let _c1 = _1 != nil - if _c1 { - return Api.InputStickeredMedia.inputStickeredMediaDocument(Cons_inputStickeredMediaDocument(id: _1!)) - } - else { - return nil - } - } - public static func parse_inputStickeredMediaPhoto(_ reader: BufferReader) -> InputStickeredMedia? { - var _1: Api.InputPhoto? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.InputPhoto - } - let _c1 = _1 != nil - if _c1 { - return Api.InputStickeredMedia.inputStickeredMediaPhoto(Cons_inputStickeredMediaPhoto(id: _1!)) - } - else { - return nil - } - } - } -} public extension Api { indirect enum InputStorePaymentPurpose: TypeConstructorDescription { public class Cons_inputStorePaymentAuthCode: TypeConstructorDescription { @@ -1699,3 +1542,80 @@ public extension Api { } } } +public extension Api { + enum JoinChatBotResult: TypeConstructorDescription { + public class Cons_joinChatBotResultWebView: TypeConstructorDescription { + public var url: String + public init(url: String) { + self.url = url + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(self.url))]) + } + } + case joinChatBotResultApproved + case joinChatBotResultDeclined + case joinChatBotResultQueued + case joinChatBotResultWebView(Cons_joinChatBotResultWebView) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .joinChatBotResultApproved: + if boxed { + buffer.appendInt32(-1374344599) + } + break + case .joinChatBotResultDeclined: + if boxed { + buffer.appendInt32(251265428) + } + break + case .joinChatBotResultQueued: + if boxed { + buffer.appendInt32(-1734105024) + } + break + case .joinChatBotResultWebView(let _data): + if boxed { + buffer.appendInt32(-689719277) + } + serializeString(_data.url, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .joinChatBotResultApproved: + return ("joinChatBotResultApproved", []) + case .joinChatBotResultDeclined: + return ("joinChatBotResultDeclined", []) + case .joinChatBotResultQueued: + return ("joinChatBotResultQueued", []) + case .joinChatBotResultWebView(let _data): + return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(_data.url))]) + } + } + + public static func parse_joinChatBotResultApproved(_ reader: BufferReader) -> JoinChatBotResult? { + return Api.JoinChatBotResult.joinChatBotResultApproved + } + public static func parse_joinChatBotResultDeclined(_ reader: BufferReader) -> JoinChatBotResult? { + return Api.JoinChatBotResult.joinChatBotResultDeclined + } + public static func parse_joinChatBotResultQueued(_ reader: BufferReader) -> JoinChatBotResult? { + return Api.JoinChatBotResult.joinChatBotResultQueued + } + public static func parse_joinChatBotResultWebView(_ reader: BufferReader) -> JoinChatBotResult? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.JoinChatBotResult.joinChatBotResultWebView(Cons_joinChatBotResultWebView(url: _1!)) + } + else { + return nil + } + } + } +} diff --git a/submodules/TelegramApi/Sources/Api15.swift b/submodules/TelegramApi/Sources/Api15.swift index a7fab8381c..7df4305b1c 100644 --- a/submodules/TelegramApi/Sources/Api15.swift +++ b/submodules/TelegramApi/Sources/Api15.swift @@ -1,80 +1,3 @@ -public extension Api { - enum JoinChatBotResult: TypeConstructorDescription { - public class Cons_joinChatBotResultWebView: TypeConstructorDescription { - public var url: String - public init(url: String) { - self.url = url - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(self.url))]) - } - } - case joinChatBotResultApproved - case joinChatBotResultDeclined - case joinChatBotResultQueued - case joinChatBotResultWebView(Cons_joinChatBotResultWebView) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .joinChatBotResultApproved: - if boxed { - buffer.appendInt32(-1374344599) - } - break - case .joinChatBotResultDeclined: - if boxed { - buffer.appendInt32(251265428) - } - break - case .joinChatBotResultQueued: - if boxed { - buffer.appendInt32(-1734105024) - } - break - case .joinChatBotResultWebView(let _data): - if boxed { - buffer.appendInt32(-689719277) - } - serializeString(_data.url, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .joinChatBotResultApproved: - return ("joinChatBotResultApproved", []) - case .joinChatBotResultDeclined: - return ("joinChatBotResultDeclined", []) - case .joinChatBotResultQueued: - return ("joinChatBotResultQueued", []) - case .joinChatBotResultWebView(let _data): - return ("joinChatBotResultWebView", [("url", ConstructorParameterDescription(_data.url))]) - } - } - - public static func parse_joinChatBotResultApproved(_ reader: BufferReader) -> JoinChatBotResult? { - return Api.JoinChatBotResult.joinChatBotResultApproved - } - public static func parse_joinChatBotResultDeclined(_ reader: BufferReader) -> JoinChatBotResult? { - return Api.JoinChatBotResult.joinChatBotResultDeclined - } - public static func parse_joinChatBotResultQueued(_ reader: BufferReader) -> JoinChatBotResult? { - return Api.JoinChatBotResult.joinChatBotResultQueued - } - public static func parse_joinChatBotResultWebView(_ reader: BufferReader) -> JoinChatBotResult? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.JoinChatBotResult.joinChatBotResultWebView(Cons_joinChatBotResultWebView(url: _1!)) - } - else { - return nil - } - } - } -} public extension Api { indirect enum KeyboardButton: TypeConstructorDescription { public class Cons_inputKeyboardButtonRequestPeer: TypeConstructorDescription { diff --git a/submodules/TelegramApi/Sources/Api19.swift b/submodules/TelegramApi/Sources/Api19.swift index 542180c858..9134cda518 100644 --- a/submodules/TelegramApi/Sources/Api19.swift +++ b/submodules/TelegramApi/Sources/Api19.swift @@ -430,21 +430,6 @@ public extension Api { return ("inputPageBlockMap", [("geo", ConstructorParameterDescription(self.geo)), ("zoom", ConstructorParameterDescription(self.zoom)), ("w", ConstructorParameterDescription(self.w)), ("h", ConstructorParameterDescription(self.h)), ("caption", ConstructorParameterDescription(self.caption))]) } } - public class Cons_inputPageBlockOrderedList: TypeConstructorDescription { - public var flags: Int32 - public var items: [Api.InputPageListOrderedItem] - public var start: Int32? - public var type: String? - public init(flags: Int32, items: [Api.InputPageListOrderedItem], start: Int32?, type: String?) { - self.flags = flags - self.items = items - self.start = start - self.type = type - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(self.flags)), ("items", ConstructorParameterDescription(self.items)), ("start", ConstructorParameterDescription(self.start)), ("type", ConstructorParameterDescription(self.type))]) - } - } public class Cons_pageBlockAnchor: TypeConstructorDescription { public var name: String public init(name: String) { @@ -487,6 +472,17 @@ public extension Api { return ("pageBlockBlockquote", [("text", ConstructorParameterDescription(self.text)), ("caption", ConstructorParameterDescription(self.caption))]) } } + public class Cons_pageBlockBlockquoteBlocks: TypeConstructorDescription { + public var blocks: [Api.PageBlock] + public var caption: Api.RichText + public init(blocks: [Api.PageBlock], caption: Api.RichText) { + self.blocks = blocks + self.caption = caption + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("pageBlockBlockquoteBlocks", [("blocks", ConstructorParameterDescription(self.blocks)), ("caption", ConstructorParameterDescription(self.caption))]) + } + } public class Cons_pageBlockChannel: TypeConstructorDescription { public var channel: Api.Chat public init(channel: Api.Chat) { @@ -688,12 +684,18 @@ public extension Api { } } public class Cons_pageBlockOrderedList: TypeConstructorDescription { + public var flags: Int32 public var items: [Api.PageListOrderedItem] - public init(items: [Api.PageListOrderedItem]) { + public var start: Int32? + public var type: String? + public init(flags: Int32, items: [Api.PageListOrderedItem], start: Int32?, type: String?) { + self.flags = flags self.items = items + self.start = start + self.type = type } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("pageBlockOrderedList", [("items", ConstructorParameterDescription(self.items))]) + return ("pageBlockOrderedList", [("flags", ConstructorParameterDescription(self.flags)), ("items", ConstructorParameterDescription(self.items)), ("start", ConstructorParameterDescription(self.start)), ("type", ConstructorParameterDescription(self.type))]) } } public class Cons_pageBlockParagraph: TypeConstructorDescription { @@ -829,11 +831,11 @@ public extension Api { } } case inputPageBlockMap(Cons_inputPageBlockMap) - case inputPageBlockOrderedList(Cons_inputPageBlockOrderedList) case pageBlockAnchor(Cons_pageBlockAnchor) case pageBlockAudio(Cons_pageBlockAudio) case pageBlockAuthorDate(Cons_pageBlockAuthorDate) case pageBlockBlockquote(Cons_pageBlockBlockquote) + case pageBlockBlockquoteBlocks(Cons_pageBlockBlockquoteBlocks) case pageBlockChannel(Cons_pageBlockChannel) case pageBlockCollage(Cons_pageBlockCollage) case pageBlockCover(Cons_pageBlockCover) @@ -880,23 +882,6 @@ public extension Api { serializeInt32(_data.h, buffer: buffer, boxed: false) _data.caption.serialize(buffer, true) break - case .inputPageBlockOrderedList(let _data): - if boxed { - buffer.appendInt32(-1186155733) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.items.count)) - for item in _data.items { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.start!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.type!, buffer: buffer, boxed: false) - } - break case .pageBlockAnchor(let _data): if boxed { buffer.appendInt32(-837994576) @@ -924,6 +909,17 @@ public extension Api { _data.text.serialize(buffer, true) _data.caption.serialize(buffer, true) break + case .pageBlockBlockquoteBlocks(let _data): + if boxed { + buffer.appendInt32(242108356) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.blocks.count)) + for item in _data.blocks { + item.serialize(buffer, true) + } + _data.caption.serialize(buffer, true) + break case .pageBlockChannel(let _data): if boxed { buffer.appendInt32(-283684427) @@ -1084,13 +1080,20 @@ public extension Api { break case .pageBlockOrderedList(let _data): if boxed { - buffer.appendInt32(-1702174239) + buffer.appendInt32(534181569) } + serializeInt32(_data.flags, buffer: buffer, boxed: false) buffer.appendInt32(481674261) buffer.appendInt32(Int32(_data.items.count)) for item in _data.items { item.serialize(buffer, true) } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.start!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.type!, buffer: buffer, boxed: false) + } break case .pageBlockParagraph(let _data): if boxed { @@ -1204,8 +1207,6 @@ public extension Api { switch self { case .inputPageBlockMap(let _data): return ("inputPageBlockMap", [("geo", ConstructorParameterDescription(_data.geo)), ("zoom", ConstructorParameterDescription(_data.zoom)), ("w", ConstructorParameterDescription(_data.w)), ("h", ConstructorParameterDescription(_data.h)), ("caption", ConstructorParameterDescription(_data.caption))]) - case .inputPageBlockOrderedList(let _data): - return ("inputPageBlockOrderedList", [("flags", ConstructorParameterDescription(_data.flags)), ("items", ConstructorParameterDescription(_data.items)), ("start", ConstructorParameterDescription(_data.start)), ("type", ConstructorParameterDescription(_data.type))]) case .pageBlockAnchor(let _data): return ("pageBlockAnchor", [("name", ConstructorParameterDescription(_data.name))]) case .pageBlockAudio(let _data): @@ -1214,6 +1215,8 @@ public extension Api { return ("pageBlockAuthorDate", [("author", ConstructorParameterDescription(_data.author)), ("publishedDate", ConstructorParameterDescription(_data.publishedDate))]) case .pageBlockBlockquote(let _data): return ("pageBlockBlockquote", [("text", ConstructorParameterDescription(_data.text)), ("caption", ConstructorParameterDescription(_data.caption))]) + case .pageBlockBlockquoteBlocks(let _data): + return ("pageBlockBlockquoteBlocks", [("blocks", ConstructorParameterDescription(_data.blocks)), ("caption", ConstructorParameterDescription(_data.caption))]) case .pageBlockChannel(let _data): return ("pageBlockChannel", [("channel", ConstructorParameterDescription(_data.channel))]) case .pageBlockCollage(let _data): @@ -1253,7 +1256,7 @@ public extension Api { case .pageBlockMath(let _data): return ("pageBlockMath", [("source", ConstructorParameterDescription(_data.source))]) case .pageBlockOrderedList(let _data): - return ("pageBlockOrderedList", [("items", ConstructorParameterDescription(_data.items))]) + return ("pageBlockOrderedList", [("flags", ConstructorParameterDescription(_data.flags)), ("items", ConstructorParameterDescription(_data.items)), ("start", ConstructorParameterDescription(_data.start)), ("type", ConstructorParameterDescription(_data.type))]) case .pageBlockParagraph(let _data): return ("pageBlockParagraph", [("text", ConstructorParameterDescription(_data.text))]) case .pageBlockPhoto(let _data): @@ -1310,32 +1313,6 @@ public extension Api { return nil } } - public static func parse_inputPageBlockOrderedList(_ reader: BufferReader) -> PageBlock? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.InputPageListOrderedItem]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputPageListOrderedItem.self) - } - var _3: Int32? - if Int(_1 ?? 0) & Int(1 << 0) != 0 { - _3 = reader.readInt32() - } - var _4: String? - if Int(_1 ?? 0) & Int(1 << 1) != 0 { - _4 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.PageBlock.inputPageBlockOrderedList(Cons_inputPageBlockOrderedList(flags: _1!, items: _2!, start: _3, type: _4)) - } - else { - return nil - } - } public static func parse_pageBlockAnchor(_ reader: BufferReader) -> PageBlock? { var _1: String? _1 = parseString(reader) @@ -1397,6 +1374,24 @@ public extension Api { return nil } } + public static func parse_pageBlockBlockquoteBlocks(_ reader: BufferReader) -> PageBlock? { + var _1: [Api.PageBlock]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self) + } + var _2: Api.RichText? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.RichText + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.PageBlock.pageBlockBlockquoteBlocks(Cons_pageBlockBlockquoteBlocks(blocks: _1!, caption: _2!)) + } + else { + return nil + } + } public static func parse_pageBlockChannel(_ reader: BufferReader) -> PageBlock? { var _1: Api.Chat? if let signature = reader.readInt32() { @@ -1708,13 +1703,26 @@ public extension Api { } } public static func parse_pageBlockOrderedList(_ reader: BufferReader) -> PageBlock? { - var _1: [Api.PageListOrderedItem]? + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.PageListOrderedItem]? if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListOrderedItem.self) + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageListOrderedItem.self) + } + var _3: Int32? + if Int(_1 ?? 0) & Int(1 << 0) != 0 { + _3 = reader.readInt32() + } + var _4: String? + if Int(_1 ?? 0) & Int(1 << 1) != 0 { + _4 = parseString(reader) } let _c1 = _1 != nil - if _c1 { - return Api.PageBlock.pageBlockOrderedList(Cons_pageBlockOrderedList(items: _1!)) + let _c2 = _2 != nil + let _c3 = (Int(_1 ?? 0) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1 ?? 0) & Int(1 << 1) == 0) || _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.PageBlock.pageBlockOrderedList(Cons_pageBlockOrderedList(flags: _1!, items: _2!, start: _3, type: _4)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index d6f92cf706..2bec29fc7d 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -759,6 +759,19 @@ public extension Api { return ("botInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(self.flags)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("url", ConstructorParameterDescription(self.url)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup))]) } } + public class Cons_botInlineMessageRichMessage: TypeConstructorDescription { + public var flags: Int32 + public var replyMarkup: Api.ReplyMarkup? + public var richMessage: Api.RichMessage + public init(flags: Int32, replyMarkup: Api.ReplyMarkup?, richMessage: Api.RichMessage) { + self.flags = flags + self.replyMarkup = replyMarkup + self.richMessage = richMessage + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("botInlineMessageRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("richMessage", ConstructorParameterDescription(self.richMessage))]) + } + } public class Cons_botInlineMessageText: TypeConstructorDescription { public var flags: Int32 public var message: String @@ -780,6 +793,7 @@ public extension Api { case botInlineMessageMediaInvoice(Cons_botInlineMessageMediaInvoice) case botInlineMessageMediaVenue(Cons_botInlineMessageMediaVenue) case botInlineMessageMediaWebPage(Cons_botInlineMessageMediaWebPage) + case botInlineMessageRichMessage(Cons_botInlineMessageRichMessage) case botInlineMessageText(Cons_botInlineMessageText) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -882,6 +896,16 @@ public extension Api { _data.replyMarkup!.serialize(buffer, true) } break + case .botInlineMessageRichMessage(let _data): + if boxed { + buffer.appendInt32(174161531) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.replyMarkup!.serialize(buffer, true) + } + _data.richMessage.serialize(buffer, true) + break case .botInlineMessageText(let _data): if boxed { buffer.appendInt32(-1937807902) @@ -916,6 +940,8 @@ public extension Api { return ("botInlineMessageMediaVenue", [("flags", ConstructorParameterDescription(_data.flags)), ("geo", ConstructorParameterDescription(_data.geo)), ("title", ConstructorParameterDescription(_data.title)), ("address", ConstructorParameterDescription(_data.address)), ("provider", ConstructorParameterDescription(_data.provider)), ("venueId", ConstructorParameterDescription(_data.venueId)), ("venueType", ConstructorParameterDescription(_data.venueType)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) case .botInlineMessageMediaWebPage(let _data): return ("botInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("url", ConstructorParameterDescription(_data.url)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) + case .botInlineMessageRichMessage(let _data): + return ("botInlineMessageRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("richMessage", ConstructorParameterDescription(_data.richMessage))]) case .botInlineMessageText(let _data): return ("botInlineMessageText", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) } @@ -1123,6 +1149,29 @@ public extension Api { return nil } } + public static func parse_botInlineMessageRichMessage(_ reader: BufferReader) -> BotInlineMessage? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.ReplyMarkup? + if Int(_1 ?? 0) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup + } + } + var _3: Api.RichMessage? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.RichMessage + } + let _c1 = _1 != nil + let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.BotInlineMessage.botInlineMessageRichMessage(Cons_botInlineMessageRichMessage(flags: _1!, replyMarkup: _2, richMessage: _3!)) + } + else { + return nil + } + } public static func parse_botInlineMessageText(_ reader: BufferReader) -> BotInlineMessage? { var _1: Int32? _1 = reader.readInt32() diff --git a/submodules/TelegramApi/Sources/Api20.swift b/submodules/TelegramApi/Sources/Api20.swift index d47874f004..15df72e4d0 100644 --- a/submodules/TelegramApi/Sources/Api20.swift +++ b/submodules/TelegramApi/Sources/Api20.swift @@ -149,28 +149,36 @@ public extension Api { indirect enum PageListOrderedItem: TypeConstructorDescription { public class Cons_pageListOrderedItemBlocks: TypeConstructorDescription { public var flags: Int32 - public var num: String + public var num: String? public var blocks: [Api.PageBlock] - public init(flags: Int32, num: String, blocks: [Api.PageBlock]) { + public var value: Int32? + public var type: String? + public init(flags: Int32, num: String?, blocks: [Api.PageBlock], value: Int32?, type: String?) { self.flags = flags self.num = num self.blocks = blocks + self.value = value + self.type = type } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("blocks", ConstructorParameterDescription(self.blocks))]) + return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("blocks", ConstructorParameterDescription(self.blocks)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))]) } } public class Cons_pageListOrderedItemText: TypeConstructorDescription { public var flags: Int32 - public var num: String + public var num: String? public var text: Api.RichText - public init(flags: Int32, num: String, text: Api.RichText) { + public var value: Int32? + public var type: String? + public init(flags: Int32, num: String?, text: Api.RichText, value: Int32?, type: String?) { self.flags = flags self.num = num self.text = text + self.value = value + self.type = type } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("text", ConstructorParameterDescription(self.text))]) + return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(self.flags)), ("num", ConstructorParameterDescription(self.num)), ("text", ConstructorParameterDescription(self.text)), ("value", ConstructorParameterDescription(self.value)), ("type", ConstructorParameterDescription(self.type))]) } } case pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks) @@ -180,23 +188,39 @@ public extension Api { switch self { case .pageListOrderedItemBlocks(let _data): if boxed { - buffer.appendInt32(1109995988) + buffer.appendInt32(-1879910928) } serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.num, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeString(_data.num!, buffer: buffer, boxed: false) + } buffer.appendInt32(481674261) buffer.appendInt32(Int32(_data.blocks.count)) for item in _data.blocks { item.serialize(buffer, true) } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.value!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeString(_data.type!, buffer: buffer, boxed: false) + } break case .pageListOrderedItemText(let _data): if boxed { - buffer.appendInt32(-851533770) + buffer.appendInt32(352522633) } serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.num, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeString(_data.num!, buffer: buffer, boxed: false) + } _data.text.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.value!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeString(_data.type!, buffer: buffer, boxed: false) + } break } } @@ -204,9 +228,9 @@ public extension Api { public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { case .pageListOrderedItemBlocks(let _data): - return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("blocks", ConstructorParameterDescription(_data.blocks))]) + return ("pageListOrderedItemBlocks", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("blocks", ConstructorParameterDescription(_data.blocks)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))]) case .pageListOrderedItemText(let _data): - return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("text", ConstructorParameterDescription(_data.text))]) + return ("pageListOrderedItemText", [("flags", ConstructorParameterDescription(_data.flags)), ("num", ConstructorParameterDescription(_data.num)), ("text", ConstructorParameterDescription(_data.text)), ("value", ConstructorParameterDescription(_data.value)), ("type", ConstructorParameterDescription(_data.type))]) } } @@ -214,16 +238,28 @@ public extension Api { var _1: Int32? _1 = reader.readInt32() var _2: String? - _2 = parseString(reader) + if Int(_1 ?? 0) & Int(1 << 2) != 0 { + _2 = parseString(reader) + } var _3: [Api.PageBlock]? if let _ = reader.readInt32() { _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PageBlock.self) } + var _4: Int32? + if Int(_1 ?? 0) & Int(1 << 3) != 0 { + _4 = reader.readInt32() + } + var _5: String? + if Int(_1 ?? 0) & Int(1 << 4) != 0 { + _5 = parseString(reader) + } let _c1 = _1 != nil - let _c2 = _2 != nil + let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.PageListOrderedItem.pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks(flags: _1!, num: _2!, blocks: _3!)) + let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil + let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.PageListOrderedItem.pageListOrderedItemBlocks(Cons_pageListOrderedItemBlocks(flags: _1!, num: _2, blocks: _3!, value: _4, type: _5)) } else { return nil @@ -233,16 +269,28 @@ public extension Api { var _1: Int32? _1 = reader.readInt32() var _2: String? - _2 = parseString(reader) + if Int(_1 ?? 0) & Int(1 << 2) != 0 { + _2 = parseString(reader) + } var _3: Api.RichText? if let signature = reader.readInt32() { _3 = Api.parse(reader, signature: signature) as? Api.RichText } + var _4: Int32? + if Int(_1 ?? 0) & Int(1 << 3) != 0 { + _4 = reader.readInt32() + } + var _5: String? + if Int(_1 ?? 0) & Int(1 << 4) != 0 { + _5 = parseString(reader) + } let _c1 = _1 != nil - let _c2 = _2 != nil + let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.PageListOrderedItem.pageListOrderedItemText(Cons_pageListOrderedItemText(flags: _1!, num: _2!, text: _3!)) + let _c4 = (Int(_1 ?? 0) & Int(1 << 3) == 0) || _4 != nil + let _c5 = (Int(_1 ?? 0) & Int(1 << 4) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.PageListOrderedItem.pageListOrderedItemText(Cons_pageListOrderedItemText(flags: _1!, num: _2, text: _3!, value: _4, type: _5)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api36.swift b/submodules/TelegramApi/Sources/Api36.swift index e16cb3b45e..ff6fd215ca 100644 --- a/submodules/TelegramApi/Sources/Api36.swift +++ b/submodules/TelegramApi/Sources/Api36.swift @@ -211,17 +211,15 @@ public extension Api.messages { } public class Cons_chatInviteJoinResultWebView: TypeConstructorDescription { public var botId: Int64 - public var url: String - public var queryId: Int64 + public var webview: Api.WebViewResult public var users: [Api.User] - public init(botId: Int64, url: String, queryId: Int64, users: [Api.User]) { + public init(botId: Int64, webview: Api.WebViewResult, users: [Api.User]) { self.botId = botId - self.url = url - self.queryId = queryId + self.webview = webview self.users = users } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("chatInviteJoinResultWebView", [("botId", ConstructorParameterDescription(self.botId)), ("url", ConstructorParameterDescription(self.url)), ("queryId", ConstructorParameterDescription(self.queryId)), ("users", ConstructorParameterDescription(self.users))]) + return ("chatInviteJoinResultWebView", [("botId", ConstructorParameterDescription(self.botId)), ("webview", ConstructorParameterDescription(self.webview)), ("users", ConstructorParameterDescription(self.users))]) } } case chatInviteJoinResultOk(Cons_chatInviteJoinResultOk) @@ -237,11 +235,10 @@ public extension Api.messages { break case .chatInviteJoinResultWebView(let _data): if boxed { - buffer.appendInt32(2001452532) + buffer.appendInt32(793887543) } serializeInt64(_data.botId, buffer: buffer, boxed: false) - serializeString(_data.url, buffer: buffer, boxed: false) - serializeInt64(_data.queryId, buffer: buffer, boxed: false) + _data.webview.serialize(buffer, true) buffer.appendInt32(481674261) buffer.appendInt32(Int32(_data.users.count)) for item in _data.users { @@ -256,7 +253,7 @@ public extension Api.messages { case .chatInviteJoinResultOk(let _data): return ("chatInviteJoinResultOk", [("updates", ConstructorParameterDescription(_data.updates))]) case .chatInviteJoinResultWebView(let _data): - return ("chatInviteJoinResultWebView", [("botId", ConstructorParameterDescription(_data.botId)), ("url", ConstructorParameterDescription(_data.url)), ("queryId", ConstructorParameterDescription(_data.queryId)), ("users", ConstructorParameterDescription(_data.users))]) + return ("chatInviteJoinResultWebView", [("botId", ConstructorParameterDescription(_data.botId)), ("webview", ConstructorParameterDescription(_data.webview)), ("users", ConstructorParameterDescription(_data.users))]) } } @@ -276,20 +273,19 @@ public extension Api.messages { public static func parse_chatInviteJoinResultWebView(_ reader: BufferReader) -> ChatInviteJoinResult? { var _1: Int64? _1 = reader.readInt64() - var _2: String? - _2 = parseString(reader) - var _3: Int64? - _3 = reader.readInt64() - var _4: [Api.User]? + var _2: Api.WebViewResult? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.WebViewResult + } + var _3: [Api.User]? if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) } let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.messages.ChatInviteJoinResult.chatInviteJoinResultWebView(Cons_chatInviteJoinResultWebView(botId: _1!, url: _2!, queryId: _3!, users: _4!)) + if _c1 && _c2 && _c3 { + return Api.messages.ChatInviteJoinResult.chatInviteJoinResultWebView(Cons_chatInviteJoinResultWebView(botId: _1!, webview: _2!, users: _3!)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api42.swift b/submodules/TelegramApi/Sources/Api42.swift index 3879eaff5a..2bea97a246 100644 --- a/submodules/TelegramApi/Sources/Api42.swift +++ b/submodules/TelegramApi/Sources/Api42.swift @@ -1644,19 +1644,19 @@ public extension Api.functions.account { } } public extension Api.functions.account { - static func toggleWebBrowserSettingsException(flags: Int32, openExternalBrowser: Api.Bool?, url: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + static func toggleWebBrowserSettingsException(flags: Int32, openExternalBrowser: Api.Bool?, url: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(755631473) + buffer.appendInt32(1626161705) serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 { openExternalBrowser!.serialize(buffer, true) } serializeString(url, buffer: buffer, boxed: false) - return (FunctionDescription(name: "account.toggleWebBrowserSettingsException", parameters: [("flags", ConstructorParameterDescription(flags)), ("openExternalBrowser", ConstructorParameterDescription(openExternalBrowser)), ("url", ConstructorParameterDescription(url))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription(name: "account.toggleWebBrowserSettingsException", parameters: [("flags", ConstructorParameterDescription(flags)), ("openExternalBrowser", ConstructorParameterDescription(openExternalBrowser)), ("url", ConstructorParameterDescription(url))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) - var result: Api.Bool? + var result: Api.Updates? if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.Bool + result = Api.parse(reader, signature: signature) as? Api.Updates } return result }) diff --git a/submodules/TelegramApi/Sources/Api6.swift b/submodules/TelegramApi/Sources/Api6.swift index e4cfa5833d..0192271ffb 100644 --- a/submodules/TelegramApi/Sources/Api6.swift +++ b/submodules/TelegramApi/Sources/Api6.swift @@ -553,8 +553,8 @@ public extension Api { public var date: Int32 public var effect: Int64? public var suggestedPost: Api.SuggestedPost? - public var richMessage: Api.InputRichMessage? - public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.InputRichMessage?) { + public var richMessage: Api.RichMessage? + public init(flags: Int32, replyTo: Api.InputReplyTo?, message: String, entities: [Api.MessageEntity]?, media: Api.InputMedia?, date: Int32, effect: Int64?, suggestedPost: Api.SuggestedPost?, richMessage: Api.RichMessage?) { self.flags = flags self.replyTo = replyTo self.message = message @@ -587,7 +587,7 @@ public extension Api { switch self { case .draftMessage(let _data): if boxed { - buffer.appendInt32(-1743452271) + buffer.appendInt32(1627271828) } serializeInt32(_data.flags, buffer: buffer, boxed: false) if Int(_data.flags) & Int(1 << 4) != 0 { @@ -671,10 +671,10 @@ public extension Api { _8 = Api.parse(reader, signature: signature) as? Api.SuggestedPost } } - var _9: Api.InputRichMessage? + var _9: Api.RichMessage? if Int(_1 ?? 0) & Int(1 << 9) != 0 { if let signature = reader.readInt32() { - _9 = Api.parse(reader, signature: signature) as? Api.InputRichMessage + _9 = Api.parse(reader, signature: signature) as? Api.RichMessage } } let _c1 = _1 != nil diff --git a/submodules/TelegramApi/Sources/Api8.swift b/submodules/TelegramApi/Sources/Api8.swift index 6d78d0b9ed..bf3ed2bfc0 100644 --- a/submodules/TelegramApi/Sources/Api8.swift +++ b/submodules/TelegramApi/Sources/Api8.swift @@ -997,6 +997,19 @@ public extension Api { return ("inputBotInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(self.flags)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("url", ConstructorParameterDescription(self.url)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup))]) } } + public class Cons_inputBotInlineMessageRichMessage: TypeConstructorDescription { + public var flags: Int32 + public var replyMarkup: Api.ReplyMarkup? + public var richMessage: Api.InputRichMessage + public init(flags: Int32, replyMarkup: Api.ReplyMarkup?, richMessage: Api.InputRichMessage) { + self.flags = flags + self.replyMarkup = replyMarkup + self.richMessage = richMessage + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputBotInlineMessageRichMessage", [("flags", ConstructorParameterDescription(self.flags)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("richMessage", ConstructorParameterDescription(self.richMessage))]) + } + } public class Cons_inputBotInlineMessageText: TypeConstructorDescription { public var flags: Int32 public var message: String @@ -1019,6 +1032,7 @@ public extension Api { case inputBotInlineMessageMediaInvoice(Cons_inputBotInlineMessageMediaInvoice) case inputBotInlineMessageMediaVenue(Cons_inputBotInlineMessageMediaVenue) case inputBotInlineMessageMediaWebPage(Cons_inputBotInlineMessageMediaWebPage) + case inputBotInlineMessageRichMessage(Cons_inputBotInlineMessageRichMessage) case inputBotInlineMessageText(Cons_inputBotInlineMessageText) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { @@ -1132,6 +1146,16 @@ public extension Api { _data.replyMarkup!.serialize(buffer, true) } break + case .inputBotInlineMessageRichMessage(let _data): + if boxed { + buffer.appendInt32(-1271007892) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.replyMarkup!.serialize(buffer, true) + } + _data.richMessage.serialize(buffer, true) + break case .inputBotInlineMessageText(let _data): if boxed { buffer.appendInt32(1036876423) @@ -1168,6 +1192,8 @@ public extension Api { return ("inputBotInlineMessageMediaVenue", [("flags", ConstructorParameterDescription(_data.flags)), ("geoPoint", ConstructorParameterDescription(_data.geoPoint)), ("title", ConstructorParameterDescription(_data.title)), ("address", ConstructorParameterDescription(_data.address)), ("provider", ConstructorParameterDescription(_data.provider)), ("venueId", ConstructorParameterDescription(_data.venueId)), ("venueType", ConstructorParameterDescription(_data.venueType)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) case .inputBotInlineMessageMediaWebPage(let _data): return ("inputBotInlineMessageMediaWebPage", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("url", ConstructorParameterDescription(_data.url)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) + case .inputBotInlineMessageRichMessage(let _data): + return ("inputBotInlineMessageRichMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("richMessage", ConstructorParameterDescription(_data.richMessage))]) case .inputBotInlineMessageText(let _data): return ("inputBotInlineMessageText", [("flags", ConstructorParameterDescription(_data.flags)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup))]) } @@ -1403,6 +1429,29 @@ public extension Api { return nil } } + public static func parse_inputBotInlineMessageRichMessage(_ reader: BufferReader) -> InputBotInlineMessage? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.ReplyMarkup? + if Int(_1 ?? 0) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup + } + } + var _3: Api.InputRichMessage? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.InputRichMessage + } + let _c1 = _1 != nil + let _c2 = (Int(_1 ?? 0) & Int(1 << 2) == 0) || _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.InputBotInlineMessage.inputBotInlineMessageRichMessage(Cons_inputBotInlineMessageRichMessage(flags: _1!, replyMarkup: _2, richMessage: _3!)) + } + else { + return nil + } + } public static func parse_inputBotInlineMessageText(_ reader: BufferReader) -> InputBotInlineMessage? { var _1: Int32? _1 = reader.readInt32() diff --git a/submodules/TelegramCore/Sources/ApiUtils/ChatContextResult.swift b/submodules/TelegramCore/Sources/ApiUtils/ChatContextResult.swift index 81b3454c13..8fc467b2be 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/ChatContextResult.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/ChatContextResult.swift @@ -11,7 +11,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable { } case auto(caption: String, entities: TextEntitiesMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?) - case text(text: String, entities: TextEntitiesMessageAttribute?, disableUrlPreview: Bool, previewParameters: WebpagePreviewMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?) + case text(text: String, entities: TextEntitiesMessageAttribute?, richText: RichTextMessageAttribute?, disableUrlPreview: Bool, previewParameters: WebpagePreviewMessageAttribute?, replyMarkup: ReplyMarkupMessageAttribute?) case mapLocation(media: TelegramMediaMap, replyMarkup: ReplyMarkupMessageAttribute?) case contact(media: TelegramMediaContact, replyMarkup: ReplyMarkupMessageAttribute?) case invoice(media: TelegramMediaInvoice, replyMarkup: ReplyMarkupMessageAttribute?) @@ -22,7 +22,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable { case 0: self = .auto(caption: decoder.decodeStringForKey("c", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute) case 1: - self = .text(text: decoder.decodeStringForKey("t", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, disableUrlPreview: decoder.decodeInt32ForKey("du", orElse: 0) != 0, previewParameters: decoder.decodeObjectForKey("prp") as? WebpagePreviewMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute) + self = .text(text: decoder.decodeStringForKey("t", orElse: ""), entities: decoder.decodeObjectForKey("e") as? TextEntitiesMessageAttribute, richText: decoder.decodeObjectForKey("rt", decoder: { RichTextMessageAttribute(decoder: $0) }) as? RichTextMessageAttribute, disableUrlPreview: decoder.decodeInt32ForKey("du", orElse: 0) != 0, previewParameters: decoder.decodeObjectForKey("prp") as? WebpagePreviewMessageAttribute, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute) case 2: self = .mapLocation(media: decoder.decodeObjectForKey("l") as! TelegramMediaMap, replyMarkup: decoder.decodeObjectForKey("m") as? ReplyMarkupMessageAttribute) case 3: @@ -51,7 +51,7 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable { } else { encoder.encodeNil(forKey: "m") } - case let .text(text, entities, disableUrlPreview, previewParameters, replyMarkup): + case let .text(text, entities, richText, disableUrlPreview, previewParameters, replyMarkup): encoder.encodeInt32(1, forKey: "_v") encoder.encodeString(text, forKey: "t") if let entities = entities { @@ -59,6 +59,11 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable { } else { encoder.encodeNil(forKey: "e") } + if let richText { + encoder.encodeObject(richText, forKey: "rt") + } else { + encoder.encodeNil(forKey: "rt") + } encoder.encodeInt32(disableUrlPreview ? 1 : 0, forKey: "du") if let previewParameters = previewParameters { encoder.encodeObject(previewParameters, forKey: "prp") @@ -148,14 +153,17 @@ public enum ChatContextResultMessage: PostboxCoding, Equatable, Codable { } else { return false } - case let .text(lhsText, lhsEntities, lhsDisableUrlPreview, lhsPreviewParameters, lhsReplyMarkup): - if case let .text(rhsText, rhsEntities, rhsDisableUrlPreview, rhsPreviewParameters, rhsReplyMarkup) = rhs { + case let .text(lhsText, lhsEntities, lhsRichText, lhsDisableUrlPreview, lhsPreviewParameters, lhsReplyMarkup): + if case let .text(rhsText, rhsEntities, rhsRichText, rhsDisableUrlPreview, rhsPreviewParameters, rhsReplyMarkup) = rhs { if lhsText != rhsText { return false } if lhsEntities != rhsEntities { return false } + if lhsRichText != rhsRichText { + return false + } if lhsDisableUrlPreview != rhsDisableUrlPreview { return false } @@ -508,12 +516,18 @@ extension ChatContextResultMessage { parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup) } let leadingPreview = (flags & (1 << 3)) != 0 - self = .text(text: message, entities: parsedEntities, disableUrlPreview: (flags & (1 << 0)) != 0, previewParameters: WebpagePreviewMessageAttribute( + self = .text(text: message, entities: parsedEntities, richText: nil, disableUrlPreview: (flags & (1 << 0)) != 0, previewParameters: WebpagePreviewMessageAttribute( leadingPreview: leadingPreview, forceLargeMedia: nil, isManuallyAdded: false, isSafe: false ), replyMarkup: parsedReplyMarkup) + case let .botInlineMessageRichMessage(botInlineMessageRichMessage): + var parsedReplyMarkup: ReplyMarkupMessageAttribute? + if let replyMarkup = botInlineMessageRichMessage.replyMarkup { + parsedReplyMarkup = ReplyMarkupMessageAttribute(apiMarkup: replyMarkup) + } + self = .text(text: "", entities: nil, richText: RichTextMessageAttribute(apiRichMessage: botInlineMessageRichMessage.richMessage), disableUrlPreview: false, previewParameters: nil, replyMarkup: parsedReplyMarkup) case let .botInlineMessageMediaGeo(botInlineMessageMediaGeoData): let (_, geo, heading, period, proximityNotificationRadius, replyMarkup) = (botInlineMessageMediaGeoData.flags, botInlineMessageMediaGeoData.geo, botInlineMessageMediaGeoData.heading, botInlineMessageMediaGeoData.period, botInlineMessageMediaGeoData.proximityNotificationRadius, botInlineMessageMediaGeoData.replyMarkup) let media = telegramMediaMapFromApiGeoPoint(geo, title: nil, address: nil, provider: nil, venueId: nil, venueType: nil, liveBroadcastingTimeout: period, liveProximityNotificationRadius: proximityNotificationRadius, heading: heading) diff --git a/submodules/TelegramCore/Sources/ApiUtils/InstantPage.swift b/submodules/TelegramCore/Sources/ApiUtils/InstantPage.swift index 5fbc475515..cf3ef21812 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/InstantPage.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/InstantPage.swift @@ -366,7 +366,7 @@ extension InstantPageBlock { return .pageBlockAnchor(Api.PageBlock.Cons_pageBlockAnchor(name: value)) case let .list(items, ordered): if ordered { - return .inputPageBlockOrderedList(Api.PageBlock.Cons_inputPageBlockOrderedList(flags: 0, items: items.map { $0.apiInputPageOrderedListItem() }, start: nil, type: nil)) + return .pageBlockOrderedList(Api.PageBlock.Cons_pageBlockOrderedList(flags: 0, items: items.map { $0.apiInputPageOrderedListItem() }, start: nil, type: nil)) } else { return .pageBlockList(Api.PageBlock.Cons_pageBlockList(items: items.map { $0.apiInputPageListItem() })) } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/OutgoingMessageWithChatContextResult.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/OutgoingMessageWithChatContextResult.swift index e7d30b530f..0809161243 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/OutgoingMessageWithChatContextResult.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/OutgoingMessageWithChatContextResult.swift @@ -145,9 +145,13 @@ func _internal_outgoingMessageWithChatContextResult(to peerId: PeerId, threadId: return .message(text: caption, attributes: attributes, inlineStickers: [:], mediaReference: nil, threadId: threadId, replyToMessageId: replyToMessageId, replyToStoryId: replyToStoryId, localGroupingKey: nil, correlationId: correlationId, bubbleUpEmojiOrStickersets: []) } } - case let .text(text, entities, disableUrlPreview, previewParameters, replyMarkup): - if let entities = entities { - attributes.append(entities) + case let .text(text, entities, richText, disableUrlPreview, previewParameters, replyMarkup): + if let richText { + attributes.append(richText) + } else { + if let entities = entities { + attributes.append(entities) + } } if let replyMarkup = replyMarkup { attributes.append(replyMarkup) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift index 0587fafd12..01d8f00167 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinChannel.swift @@ -150,7 +150,10 @@ func _internal_joinChannel(account: Account, peerId: PeerId, hash: String?) -> S } |> castError(JoinChannelError.self) |> map { _ -> JoinChannelOutcome in - return .webView(botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(data.botId)), url: data.url, queryId: data.queryId) + switch data.webview { + case let .webViewResultUrl(webViewResultUrl): + return .webView(botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(data.botId)), url: webViewResultUrl.url, queryId: webViewResultUrl.queryId ?? 0) + } } } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift index af6b5b3e8a..3c4f10db2c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/JoinLink.swift @@ -110,7 +110,10 @@ func _internal_joinChatInteractively(with hash: String, account: Account) -> Sig } |> castError(JoinLinkError.self) |> map { _ -> JoinChatInteractivelyOutcome in - return .webView(botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(data.botId)), url: data.url, queryId: data.queryId) + switch data.webview { + case let .webViewResultUrl(webViewResultUrl): + return .webView(botId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(data.botId)), url: webViewResultUrl.url, queryId: webViewResultUrl.queryId ?? 0) + } } } } diff --git a/submodules/WebUI/Sources/WebAppMessageChatPreviewItem.swift b/submodules/WebUI/Sources/WebAppMessageChatPreviewItem.swift index af6446c1ef..c7dac9573c 100644 --- a/submodules/WebUI/Sources/WebAppMessageChatPreviewItem.swift +++ b/submodules/WebUI/Sources/WebAppMessageChatPreviewItem.swift @@ -19,6 +19,12 @@ final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemCo if lhs.text != rhs.text { return false } + if lhs.entities != rhs.entities { + return false + } + if lhs.richText != rhs.richText { + return false + } if lhs.media.count != rhs.media.count { return false } @@ -35,6 +41,7 @@ final class PeerNameColorChatPreviewItem: ListViewItem, ItemListItem, ListItemCo let text: String let entities: TextEntitiesMessageAttribute? + let richText: RichTextMessageAttribute? let media: [EngineRawMedia] let replyMarkup: ReplyMarkupMessageAttribute? let botAddress: String @@ -207,6 +214,9 @@ final class PeerNameColorChatPreviewItemNode: ListViewItemNode { if let entities = messageItem.entities { attributes.append(entities) } + if let richText = messageItem.richText { + attributes.append(richText) + } if let replyMarkup = messageItem.replyMarkup { attributes.append(replyMarkup) } diff --git a/submodules/WebUI/Sources/WebAppMessagePreviewScreen.swift b/submodules/WebUI/Sources/WebAppMessagePreviewScreen.swift index 49da936b4e..9362bf658f 100644 --- a/submodules/WebUI/Sources/WebAppMessagePreviewScreen.swift +++ b/submodules/WebUI/Sources/WebAppMessagePreviewScreen.swift @@ -137,6 +137,7 @@ private final class SheetContent: CombinedComponent { var text: String = "" var entities: TextEntitiesMessageAttribute? + var richText: RichTextMessageAttribute? var media: [EngineRawMedia] = [] var replyMarkup: ReplyMarkupMessageAttribute? @@ -152,8 +153,9 @@ private final class SheetContent: CombinedComponent { media = [image] } replyMarkup = replyMarkupValue - case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue): + case let .text(textValue, entitiesValue, richTextValue, disableUrlPreview, previewParameters, replyMarkupValue): text = textValue + richText = richTextValue entities = entitiesValue let _ = disableUrlPreview let _ = previewParameters @@ -181,9 +183,10 @@ private final class SheetContent: CombinedComponent { media = [content] } replyMarkup = replyMarkupValue - case let .text(textValue, entitiesValue, disableUrlPreview, previewParameters, replyMarkupValue): + case let .text(textValue, entitiesValue, richTextValue, disableUrlPreview, previewParameters, replyMarkupValue): text = textValue entities = entitiesValue + richText = richTextValue let _ = disableUrlPreview let _ = previewParameters replyMarkup = replyMarkupValue @@ -206,6 +209,7 @@ private final class SheetContent: CombinedComponent { let messageItem = PeerNameColorChatPreviewItem.MessageItem( text: text, entities: entities, + richText: richText, media: media, replyMarkup: replyMarkup, botAddress: component.botAddress