From f192fbf16b434cd970888d8c1409ba2082a648f6 Mon Sep 17 00:00:00 2001 From: Ali <> Date: Fri, 27 May 2022 22:32:44 +0400 Subject: [PATCH] Update API --- submodules/TelegramApi/Sources/Api0.swift | 5 +- submodules/TelegramApi/Sources/Api23.swift | 102 +++++++++++++-------- submodules/TelegramApi/Sources/Api24.swift | 36 ++++++++ submodules/TelegramApi/Sources/Api27.swift | 15 +++ submodules/TelegramApi/Sources/Api9.swift | 8 +- 5 files changed, 125 insertions(+), 41 deletions(-) diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 05fc1c813f..3ff0ecd247 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -360,7 +360,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1678949555] = { return Api.InputWebDocument.parse_inputWebDocument($0) } dict[-1625153079] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) } dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) } - dict[-1197014651] = { return Api.Invoice.parse_invoice($0) } + dict[1475721060] = { return Api.Invoice.parse_invoice($0) } dict[-1059185703] = { return Api.JSONObjectValue.parse_jsonObjectValue($0) } dict[-146520221] = { return Api.JSONValue.parse_jsonArray($0) } dict[-952869270] = { return Api.JSONValue.parse_jsonBool($0) } @@ -918,6 +918,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[415997816] = { return Api.help.InviteText.parse_inviteText($0) } dict[-1600596305] = { return Api.help.PassportConfig.parse_passportConfig($0) } dict[-1078332329] = { return Api.help.PassportConfig.parse_passportConfigNotModified($0) } + dict[1065019118] = { return Api.help.PremiumPromo.parse_premiumPromo($0) } dict[-1942390465] = { return Api.help.PromoData.parse_promoData($0) } dict[-1728664459] = { return Api.help.PromoData.parse_promoDataEmpty($0) } dict[235081943] = { return Api.help.RecentMeUrls.parse_recentMeUrls($0) } @@ -1647,6 +1648,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.help.PassportConfig: _1.serialize(buffer, boxed) + case let _1 as Api.help.PremiumPromo: + _1.serialize(buffer, boxed) case let _1 as Api.help.PromoData: _1.serialize(buffer, boxed) case let _1 as Api.help.RecentMeUrls: diff --git a/submodules/TelegramApi/Sources/Api23.swift b/submodules/TelegramApi/Sources/Api23.swift index 6781cecc18..ff75cb25b6 100644 --- a/submodules/TelegramApi/Sources/Api23.swift +++ b/submodules/TelegramApi/Sources/Api23.swift @@ -210,6 +210,72 @@ public extension Api.help { } } +public extension Api.help { + enum PremiumPromo: TypeConstructorDescription { + case premiumPromo(statusText: String, statusEntities: [Api.MessageEntity], videoSections: [String], videos: [Api.Document]) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .premiumPromo(let statusText, let statusEntities, let videoSections, let videos): + if boxed { + buffer.appendInt32(1065019118) + } + serializeString(statusText, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(statusEntities.count)) + for item in statusEntities { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(videoSections.count)) + for item in videoSections { + serializeString(item, buffer: buffer, boxed: false) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(videos.count)) + for item in videos { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, Any)]) { + switch self { + case .premiumPromo(let statusText, let statusEntities, let videoSections, let videos): + return ("premiumPromo", [("statusText", String(describing: statusText)), ("statusEntities", String(describing: statusEntities)), ("videoSections", String(describing: videoSections)), ("videos", String(describing: videos))]) + } + } + + public static func parse_premiumPromo(_ reader: BufferReader) -> PremiumPromo? { + var _1: String? + _1 = parseString(reader) + var _2: [Api.MessageEntity]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) + } + var _3: [String]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self) + } + var _4: [Api.Document]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.help.PremiumPromo.premiumPromo(statusText: _1!, statusEntities: _2!, videoSections: _3!, videos: _4!) + } + else { + return nil + } + } + + } +} public extension Api.help { enum PromoData: TypeConstructorDescription { case promoData(flags: Int32, expires: Int32, peer: Api.Peer, chats: [Api.Chat], users: [Api.User], psaType: String?, psaMessage: String?) @@ -1292,39 +1358,3 @@ public extension Api.messages { } } -public extension Api.messages { - enum CheckedHistoryImportPeer: TypeConstructorDescription { - case checkedHistoryImportPeer(confirmText: String) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .checkedHistoryImportPeer(let confirmText): - if boxed { - buffer.appendInt32(-1571952873) - } - serializeString(confirmText, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, Any)]) { - switch self { - case .checkedHistoryImportPeer(let confirmText): - return ("checkedHistoryImportPeer", [("confirmText", String(describing: confirmText))]) - } - } - - public static func parse_checkedHistoryImportPeer(_ reader: BufferReader) -> CheckedHistoryImportPeer? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(confirmText: _1!) - } - else { - return nil - } - } - - } -} diff --git a/submodules/TelegramApi/Sources/Api24.swift b/submodules/TelegramApi/Sources/Api24.swift index fd0350a042..b12751463a 100644 --- a/submodules/TelegramApi/Sources/Api24.swift +++ b/submodules/TelegramApi/Sources/Api24.swift @@ -1,3 +1,39 @@ +public extension Api.messages { + enum CheckedHistoryImportPeer: TypeConstructorDescription { + case checkedHistoryImportPeer(confirmText: String) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .checkedHistoryImportPeer(let confirmText): + if boxed { + buffer.appendInt32(-1571952873) + } + serializeString(confirmText, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, Any)]) { + switch self { + case .checkedHistoryImportPeer(let confirmText): + return ("checkedHistoryImportPeer", [("confirmText", String(describing: confirmText))]) + } + } + + public static func parse_checkedHistoryImportPeer(_ reader: BufferReader) -> CheckedHistoryImportPeer? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.messages.CheckedHistoryImportPeer.checkedHistoryImportPeer(confirmText: _1!) + } + else { + return nil + } + } + + } +} public extension Api.messages { enum DhConfig: TypeConstructorDescription { case dhConfig(g: Int32, p: Buffer, version: Int32, random: Buffer) diff --git a/submodules/TelegramApi/Sources/Api27.swift b/submodules/TelegramApi/Sources/Api27.swift index 076af6e651..26acc8dd95 100644 --- a/submodules/TelegramApi/Sources/Api27.swift +++ b/submodules/TelegramApi/Sources/Api27.swift @@ -2973,6 +2973,21 @@ public extension Api.functions.help { }) } } +public extension Api.functions.help { + static func getPremiumPromo() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1206152236) + + return (FunctionDescription(name: "help.getPremiumPromo", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.PremiumPromo? in + let reader = BufferReader(buffer) + var result: Api.help.PremiumPromo? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.help.PremiumPromo + } + return result + }) + } +} public extension Api.functions.help { static func getPromoData() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() diff --git a/submodules/TelegramApi/Sources/Api9.swift b/submodules/TelegramApi/Sources/Api9.swift index 049c138639..db9a66bf37 100644 --- a/submodules/TelegramApi/Sources/Api9.swift +++ b/submodules/TelegramApi/Sources/Api9.swift @@ -904,7 +904,7 @@ public extension Api { switch self { case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let recurrentTermsUrl): if boxed { - buffer.appendInt32(-1197014651) + buffer.appendInt32(1475721060) } serializeInt32(flags, buffer: buffer, boxed: false) serializeString(currency, buffer: buffer, boxed: false) @@ -919,7 +919,7 @@ public extension Api { for item in suggestedTipAmounts! { serializeInt64(item, buffer: buffer, boxed: false) }} - if Int(flags) & Int(1 << 8) != 0 {serializeString(recurrentTermsUrl!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 9) != 0 {serializeString(recurrentTermsUrl!, buffer: buffer, boxed: false)} break } } @@ -947,13 +947,13 @@ public extension Api { _5 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) } } var _6: String? - if Int(_1!) & Int(1 << 8) != 0 {_6 = parseString(reader) } + if Int(_1!) & Int(1 << 9) != 0 {_6 = parseString(reader) } let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil let _c4 = (Int(_1!) & Int(1 << 8) == 0) || _4 != nil let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 8) == 0) || _6 != nil + let _c6 = (Int(_1!) & Int(1 << 9) == 0) || _6 != nil if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, recurrentTermsUrl: _6) }