From 8a6bfd44eaf7be112b579388f5c4363dd0dba60b Mon Sep 17 00:00:00 2001 From: Peter Date: Thu, 31 May 2018 16:22:57 +0300 Subject: [PATCH] no message --- TelegramCore.xcodeproj/project.pbxproj | 12 + TelegramCore/AddPeerMember.swift | 89 +- TelegramCore/Api0.swift | 2 + TelegramCore/Api1.swift | 76 ++ TelegramCore/Api3.swift | 1087 +++++++++-------- TelegramCore/CallSessionManager.swift | 96 +- TelegramCore/ChannelBlacklist.swift | 12 +- TelegramCore/ChannelMembers.swift | 12 +- TelegramCore/ContactManagement.swift | 15 + .../DeserializeFunctionResponse.swift | 13 + TelegramCore/Download.swift | 20 +- TelegramCore/Holes.swift | 2 +- TelegramCore/Network.swift | 6 +- TelegramCore/PeerAdmins.swift | 178 +-- TelegramCore/SearchGroupMembers.swift | 7 +- TelegramCore/Serialization.swift | 16 +- TelegramCore/TermsOfService.swift | 29 + 17 files changed, 969 insertions(+), 703 deletions(-) create mode 100644 TelegramCore/DeserializeFunctionResponse.swift create mode 100644 TelegramCore/TermsOfService.swift diff --git a/TelegramCore.xcodeproj/project.pbxproj b/TelegramCore.xcodeproj/project.pbxproj index e205a9dd59..24acb00bd5 100644 --- a/TelegramCore.xcodeproj/project.pbxproj +++ b/TelegramCore.xcodeproj/project.pbxproj @@ -350,6 +350,10 @@ D0642EFA1F3E05D700792790 /* EarliestUnseenPersonalMentionMessage.swift in Sources */ = {isa = PBXBuildFile; fileRef = D0642EF81F3E05D700792790 /* EarliestUnseenPersonalMentionMessage.swift */; }; D067066C1D512ADB00DED3E3 /* Postbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706671D512ADB00DED3E3 /* Postbox.framework */; }; D067066D1D512ADB00DED3E3 /* SwiftSignalKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D06706681D512ADB00DED3E3 /* SwiftSignalKit.framework */; }; + D06AFE8920BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06AFE8820BF66BF00EA5124 /* DeserializeFunctionResponse.swift */; }; + D06AFE8A20BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06AFE8820BF66BF00EA5124 /* DeserializeFunctionResponse.swift */; }; + D06ECFC820B810D300C576C2 /* TermsOfService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06ECFC720B810D300C576C2 /* TermsOfService.swift */; }; + D06ECFC920B810D300C576C2 /* TermsOfService.swift in Sources */ = {isa = PBXBuildFile; fileRef = D06ECFC720B810D300C576C2 /* TermsOfService.swift */; }; D07047B41F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07047B31F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift */; }; D07047B51F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07047B31F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift */; }; D07047B71F3DF2CD00F6A8D4 /* ManagedConsumePersonalMessagesActions.swift in Sources */ = {isa = PBXBuildFile; fileRef = D07047B61F3DF2CD00F6A8D4 /* ManagedConsumePersonalMessagesActions.swift */; }; @@ -903,6 +907,8 @@ D06706671D512ADB00DED3E3 /* Postbox.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = Postbox.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D06706681D512ADB00DED3E3 /* SwiftSignalKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = SwiftSignalKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; D067066E1D512AEB00DED3E3 /* MtProtoKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = MtProtoKit.framework; sourceTree = BUILT_PRODUCTS_DIR; }; + D06AFE8820BF66BF00EA5124 /* DeserializeFunctionResponse.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DeserializeFunctionResponse.swift; sourceTree = ""; }; + D06ECFC720B810D300C576C2 /* TermsOfService.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TermsOfService.swift; sourceTree = ""; }; D07047B31F3DF1FE00F6A8D4 /* ConsumablePersonalMentionMessageAttribute.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsumablePersonalMentionMessageAttribute.swift; sourceTree = ""; }; D07047B61F3DF2CD00F6A8D4 /* ManagedConsumePersonalMessagesActions.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ManagedConsumePersonalMessagesActions.swift; sourceTree = ""; }; D07047B91F3DF75500F6A8D4 /* ConsumePersonalMessageAction.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = ConsumePersonalMessageAction.swift; sourceTree = ""; }; @@ -1445,6 +1451,7 @@ D03B0D581D631A6900955575 /* Network.swift */, D0BE383D1E7C5995000079AF /* MediaPool.swift */, D03B0D591D631A6900955575 /* Serialization.swift */, + D06AFE8820BF66BF00EA5124 /* DeserializeFunctionResponse.swift */, ); name = Network; sourceTree = ""; @@ -1468,6 +1475,7 @@ D0528E591E658B3600E2FEF5 /* ManagedLocalInputActivities.swift */, D099D7481EEF418D00A3128C /* HistoryViewChannelStateValidation.swift */, D0B1671C1F9EA2C300976B40 /* ChatHistoryPreloadManager.swift */, + D06ECFC720B810D300C576C2 /* TermsOfService.swift */, ); name = Account; sourceTree = ""; @@ -2036,12 +2044,14 @@ D03B0CF71D62250800955575 /* TelegramMediaImage.swift in Sources */, D054648E20738626002ECC1E /* SecureIdDriversLicenseValue.swift in Sources */, C210DD621FBDB90800F673D8 /* SourceReferenceMessageAttribute.swift in Sources */, + D06ECFC820B810D300C576C2 /* TermsOfService.swift in Sources */, D0E23DDF1E8082A400B9B6D2 /* ArchivedStickerPacks.swift in Sources */, D0546494207386D7002ECC1E /* SecureIdUtilityBillValue.swift in Sources */, D0BC386E1E3FDAB70044D6FE /* CreateGroup.swift in Sources */, D0FA8BB31E201B02001E855B /* ProcessSecretChatIncomingEncryptedOperations.swift in Sources */, D0FC19582020CC4B00FEDBB2 /* TelegramPeerGroupState.swift in Sources */, C205FEA81EB3B75900455808 /* ExportMessageLink.swift in Sources */, + D06AFE8920BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */, D0E305AA1E5BA02D00D7A3A2 /* ChannelBlacklist.swift in Sources */, D0EE7FC72098853100981319 /* SecureIdTemporaryRegistrationValue.swift in Sources */, C22EE61B1E67418000334C38 /* ToggleChannelSignatures.swift in Sources */, @@ -2504,6 +2514,7 @@ D0EE7FC220986BF400981319 /* SecureIdInternalPassportValue.swift in Sources */, D0B418A61D7E0592004562A4 /* CloudFileMediaResource.swift in Sources */, D073CEA51DCBF3F5007511FD /* StickerManagement.swift in Sources */, + D06AFE8A20BF66BF00EA5124 /* DeserializeFunctionResponse.swift in Sources */, D03C536D1DAD5CA9004C17B3 /* ApiGroupOrChannel.swift in Sources */, D01C06B81FBBA269001561AB /* CanSendMessagesToPeer.swift in Sources */, D0E35A151DE4C6A200BC6096 /* OutgoingMessageWithChatContextResult.swift in Sources */, @@ -2524,6 +2535,7 @@ D001F3E91E128A1C007A8C60 /* SecretChatState.swift in Sources */, D08F4A6A1E79CECB00A2AA15 /* ManagedSynchronizeInstalledStickerPacksOperations.swift in Sources */, D0B8444B1DAB91FD005F29E1 /* ManagedSynchronizePeerReadStates.swift in Sources */, + D06ECFC920B810D300C576C2 /* TermsOfService.swift in Sources */, D0F8C39E20178B9B00236FC5 /* GroupFeedPeers.swift in Sources */, D073CE6C1DCBCF17007511FD /* TextEntitiesMessageAttribute.swift in Sources */, D03C53751DAD5CA9004C17B3 /* TelegramUserPresence.swift in Sources */, diff --git a/TelegramCore/AddPeerMember.swift b/TelegramCore/AddPeerMember.swift index b5798101d3..924ca3e218 100644 --- a/TelegramCore/AddPeerMember.swift +++ b/TelegramCore/AddPeerMember.swift @@ -88,6 +88,94 @@ public func addPeerMember(account: Account, peerId: PeerId, memberId: PeerId) -> } |> mapError { _ -> AddPeerMemberError in return .generic } |> switchToLatest } +public enum AddChannelMemberError { + case generic +} + +public func addChannelMember(account: Account, peerId: PeerId, memberId: PeerId) -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> { + return fetchChannelParticipant(account: account, peerId: peerId, participantId: memberId) + |> mapError { error -> AddChannelMemberError in + return .generic + } + |> mapToSignal { currentParticipant -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> in + return account.postbox.modify { modifier -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> in + if let peer = modifier.getPeer(peerId), let memberPeer = modifier.getPeer(memberId), let inputUser = apiInputUser(memberPeer) { + if let channel = peer as? TelegramChannel, let inputChannel = apiInputChannel(channel) { + let updatedParticipant: ChannelParticipant + if let currentParticipant = currentParticipant, case let .member(_, invitedAt, adminInfo, banInfo) = currentParticipant { + updatedParticipant = ChannelParticipant.member(id: memberId, invitedAt: invitedAt, adminInfo: adminInfo, banInfo: nil) + } else { + updatedParticipant = ChannelParticipant.member(id: memberId, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: nil, banInfo: nil) + } + return account.network.request(Api.functions.channels.inviteToChannel(channel: inputChannel, users: [inputUser])) + |> map { [$0] } + |> `catch` { error -> Signal<[Api.Updates], AddChannelMemberError> in + return .fail(.generic) + } + |> mapToSignal { result -> Signal<(ChannelParticipant?, RenderedChannelParticipant), AddChannelMemberError> in + for updates in result { + account.stateManager.addUpdates(updates) + } + return account.postbox.modify { modifier -> (ChannelParticipant?, RenderedChannelParticipant) in + modifier.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in + if let cachedData = cachedData as? CachedChannelData, let memberCount = cachedData.participantsSummary.memberCount, let kickedCount = cachedData.participantsSummary.kickedCount { + var updatedMemberCount = memberCount + var updatedKickedCount = kickedCount + var wasMember = false + var wasBanned = false + if let currentParticipant = currentParticipant { + switch currentParticipant { + case .creator: + break + case let .member(_, _, _, banInfo): + if let banInfo = banInfo { + wasBanned = true + wasMember = !banInfo.rights.flags.contains(.banReadMessages) + } else { + wasMember = true + } + } + } + if !wasMember { + updatedMemberCount = updatedMemberCount + 1 + } + if wasBanned { + updatedKickedCount = max(0, updatedKickedCount - 1) + } + + return cachedData.withUpdatedParticipantsSummary(cachedData.participantsSummary.withUpdatedMemberCount(updatedMemberCount).withUpdatedKickedCount(updatedKickedCount)) + } else { + return cachedData + } + }) + var peers: [PeerId: Peer] = [:] + var presences: [PeerId: PeerPresence] = [:] + peers[memberPeer.id] = memberPeer + if let presence = modifier.getPeerPresence(peerId: memberPeer.id) { + presences[memberPeer.id] = presence + } + if case let .member(_, _, maybeAdminInfo, maybeBannedInfo) = updatedParticipant { + if let adminInfo = maybeAdminInfo { + if let peer = modifier.getPeer(adminInfo.promotedBy) { + peers[peer.id] = peer + } + } + } + return (currentParticipant, RenderedChannelParticipant(participant: updatedParticipant, peer: memberPeer, peers: peers, presences: presences)) + } + |> mapError { _ -> AddChannelMemberError in return .generic } + } + } else { + return .fail(.generic) + } + } else { + return .fail(.generic) + } + } + |> mapError { _ -> AddChannelMemberError in return .generic } + |> switchToLatest + } +} public func addChannelMembers(account: Account, peerId: PeerId, memberIds: [PeerId]) -> Signal { return account.postbox.modify { modifier -> Signal in @@ -116,4 +204,3 @@ public func addChannelMembers(account: Account, peerId: PeerId, memberIds: [Peer } |> switchToLatest } - diff --git a/TelegramCore/Api0.swift b/TelegramCore/Api0.swift index b2a6617397..2db759108c 100644 --- a/TelegramCore/Api0.swift +++ b/TelegramCore/Api0.swift @@ -501,6 +501,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1816636575] = { return Api.LangPackString.parse_langPackStringPluralized($0) } dict[695856818] = { return Api.LangPackString.parse_langPackStringDeleted($0) } dict[-1036396922] = { return Api.InputWebFileLocation.parse_inputWebFileLocation($0) } + dict[1713855074] = { return Api.InputWebFileLocation.parse_inputWebFileGeoPointLocation($0) } + dict[1430205163] = { return Api.InputWebFileLocation.parse_inputWebFileGeoMessageLocation($0) } dict[1436466797] = { return Api.MessageFwdHeader.parse_messageFwdHeader($0) } dict[398898678] = { return Api.help.Support.parse_support($0) } dict[1474492012] = { return Api.MessagesFilter.parse_inputMessagesFilterEmpty($0) } diff --git a/TelegramCore/Api1.swift b/TelegramCore/Api1.swift index 2a42faaf3c..6b36bee4d7 100644 --- a/TelegramCore/Api1.swift +++ b/TelegramCore/Api1.swift @@ -11174,6 +11174,8 @@ public extension Api { } public enum InputWebFileLocation { case inputWebFileLocation(url: String, accessHash: Int64) + case inputWebFileGeoPointLocation(geoPoint: Api.InputGeoPoint, w: Int32, h: Int32, zoom: Int32, scale: Int32) + case inputWebFileGeoMessageLocation(peer: Api.InputPeer, msgId: Int32, w: Int32, h: Int32, zoom: Int32, scale: Int32) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { @@ -11184,6 +11186,27 @@ public extension Api { serializeString(url, buffer: buffer, boxed: false) serializeInt64(accessHash, buffer: buffer, boxed: false) break + case .inputWebFileGeoPointLocation(let geoPoint, let w, let h, let zoom, let scale): + if boxed { + buffer.appendInt32(1713855074) + } + geoPoint.serialize(buffer, true) + serializeInt32(w, buffer: buffer, boxed: false) + serializeInt32(h, buffer: buffer, boxed: false) + serializeInt32(zoom, buffer: buffer, boxed: false) + serializeInt32(scale, buffer: buffer, boxed: false) + break + case .inputWebFileGeoMessageLocation(let peer, let msgId, let w, let h, let zoom, let scale): + if boxed { + buffer.appendInt32(1430205163) + } + peer.serialize(buffer, true) + serializeInt32(msgId, buffer: buffer, boxed: false) + serializeInt32(w, buffer: buffer, boxed: false) + serializeInt32(h, buffer: buffer, boxed: false) + serializeInt32(zoom, buffer: buffer, boxed: false) + serializeInt32(scale, buffer: buffer, boxed: false) + break } } @@ -11201,6 +11224,59 @@ public extension Api { return nil } } + static func parse_inputWebFileGeoPointLocation(_ reader: BufferReader) -> InputWebFileLocation? { + var _1: Api.InputGeoPoint? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.InputGeoPoint + } + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int32? + _5 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.InputWebFileLocation.inputWebFileGeoPointLocation(geoPoint: _1!, w: _2!, h: _3!, zoom: _4!, scale: _5!) + } + else { + return nil + } + } + static func parse_inputWebFileGeoMessageLocation(_ reader: BufferReader) -> InputWebFileLocation? { + var _1: Api.InputPeer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.InputPeer + } + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int32? + _5 = reader.readInt32() + var _6: Int32? + _6 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.InputWebFileLocation.inputWebFileGeoMessageLocation(peer: _1!, msgId: _2!, w: _3!, h: _4!, zoom: _5!, scale: _6!) + } + else { + return nil + } + } } public enum MessageFwdHeader { diff --git a/TelegramCore/Api3.swift b/TelegramCore/Api3.swift index 3a7b5cbd5b..4c897328bb 100644 --- a/TelegramCore/Api3.swift +++ b/TelegramCore/Api3.swift @@ -179,7 +179,7 @@ private final class FunctionDescription: CustomStringConvertible { public extension Api { public struct functions { public struct messages { - public static func getDialogs(flags: Int32, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Dialogs?) { + public static func getDialogs(flags: Int32, offsetDate: Int32, offsetId: Int32, offsetPeer: Api.InputPeer, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(421243333) serializeInt32(flags, buffer: buffer, boxed: false) @@ -187,7 +187,7 @@ public extension Api { serializeInt32(offsetId, buffer: buffer, boxed: false) offsetPeer.serialize(buffer, true) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getDialogs flags: \(flags), offsetDate: \(offsetDate), offsetId: \(offsetId), offsetPeer: \(offsetPeer), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Dialogs? in + return (FunctionDescription({return "(messages.getDialogs flags: \(flags), offsetDate: \(offsetDate), offsetId: \(offsetId), offsetPeer: \(offsetPeer), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Dialogs? in let reader = BufferReader(buffer) var result: Api.messages.Dialogs? if let signature = reader.readInt32() { @@ -197,7 +197,7 @@ public extension Api { }) } - public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func getHistory(peer: Api.InputPeer, offsetId: Int32, offsetDate: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-591691168) peer.serialize(buffer, true) @@ -208,7 +208,7 @@ public extension Api { serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getHistory peer: \(peer), offsetId: \(offsetId), offsetDate: \(offsetDate), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.getHistory peer: \(peer), offsetId: \(offsetId), offsetDate: \(offsetDate), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -218,12 +218,12 @@ public extension Api { }) } - public static func readHistory(peer: Api.InputPeer, maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedMessages?) { + public static func readHistory(peer: Api.InputPeer, maxId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(238054714) peer.serialize(buffer, true) serializeInt32(maxId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.readHistory peer: \(peer), maxId: \(maxId))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedMessages? in + return (FunctionDescription({return "(messages.readHistory peer: \(peer), maxId: \(maxId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in let reader = BufferReader(buffer) var result: Api.messages.AffectedMessages? if let signature = reader.readInt32() { @@ -233,13 +233,13 @@ public extension Api { }) } - public static func deleteHistory(flags: Int32, peer: Api.InputPeer, maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedHistory?) { + public static func deleteHistory(flags: Int32, peer: Api.InputPeer, maxId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(469850889) serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeInt32(maxId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.deleteHistory flags: \(flags), peer: \(peer), maxId: \(maxId))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedHistory? in + return (FunctionDescription({return "(messages.deleteHistory flags: \(flags), peer: \(peer), maxId: \(maxId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in let reader = BufferReader(buffer) var result: Api.messages.AffectedHistory? if let signature = reader.readInt32() { @@ -249,7 +249,7 @@ public extension Api { }) } - public static func deleteMessages(flags: Int32, id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedMessages?) { + public static func deleteMessages(flags: Int32, id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-443640366) serializeInt32(flags, buffer: buffer, boxed: false) @@ -258,7 +258,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.deleteMessages flags: \(flags), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedMessages? in + return (FunctionDescription({return "(messages.deleteMessages flags: \(flags), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in let reader = BufferReader(buffer) var result: Api.messages.AffectedMessages? if let signature = reader.readInt32() { @@ -268,11 +268,11 @@ public extension Api { }) } - public static func receivedMessages(maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.ReceivedNotifyMessage]?) { + public static func receivedMessages(maxId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.ReceivedNotifyMessage]>) { let buffer = Buffer() buffer.appendInt32(94983360) serializeInt32(maxId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.receivedMessages maxId: \(maxId))"}), buffer, { (buffer: Buffer) -> [Api.ReceivedNotifyMessage]? in + return (FunctionDescription({return "(messages.receivedMessages maxId: \(maxId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.ReceivedNotifyMessage]? in let reader = BufferReader(buffer) var result: [Api.ReceivedNotifyMessage]? if let _ = reader.readInt32() { @@ -282,12 +282,12 @@ public extension Api { }) } - public static func setTyping(peer: Api.InputPeer, action: Api.SendMessageAction) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setTyping(peer: Api.InputPeer, action: Api.SendMessageAction) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1551737264) peer.serialize(buffer, true) action.serialize(buffer, true) - return (FunctionDescription({return "(messages.setTyping peer: \(peer), action: \(action))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setTyping peer: \(peer), action: \(action))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -297,7 +297,7 @@ public extension Api { }) } - public static func sendMessage(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func sendMessage(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-91733382) serializeInt32(flags, buffer: buffer, boxed: false) @@ -311,7 +311,7 @@ public extension Api { for item in entities! { item.serialize(buffer, true) }} - return (FunctionDescription({return "(messages.sendMessage flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), message: \(message), randomId: \(randomId), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.sendMessage flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), message: \(message), randomId: \(randomId), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -321,11 +321,11 @@ public extension Api { }) } - public static func reportSpam(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reportSpam(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-820669733) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.reportSpam peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.reportSpam peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -335,11 +335,11 @@ public extension Api { }) } - public static func hideReportSpam(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func hideReportSpam(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1460572005) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.hideReportSpam peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.hideReportSpam peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -349,11 +349,11 @@ public extension Api { }) } - public static func getPeerSettings(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.PeerSettings?) { + public static func getPeerSettings(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(913498268) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.getPeerSettings peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.PeerSettings? in + return (FunctionDescription({return "(messages.getPeerSettings peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.PeerSettings? in let reader = BufferReader(buffer) var result: Api.PeerSettings? if let signature = reader.readInt32() { @@ -363,7 +363,7 @@ public extension Api { }) } - public static func getChats(id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Chats?) { + public static func getChats(id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1013621127) buffer.appendInt32(481674261) @@ -371,7 +371,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.getChats id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Chats? in + return (FunctionDescription({return "(messages.getChats id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) var result: Api.messages.Chats? if let signature = reader.readInt32() { @@ -381,11 +381,11 @@ public extension Api { }) } - public static func getFullChat(chatId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.ChatFull?) { + public static func getFullChat(chatId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(998448230) serializeInt32(chatId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getFullChat chatId: \(chatId))"}), buffer, { (buffer: Buffer) -> Api.messages.ChatFull? in + return (FunctionDescription({return "(messages.getFullChat chatId: \(chatId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in let reader = BufferReader(buffer) var result: Api.messages.ChatFull? if let signature = reader.readInt32() { @@ -395,12 +395,12 @@ public extension Api { }) } - public static func editChatTitle(chatId: Int32, title: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editChatTitle(chatId: Int32, title: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-599447467) serializeInt32(chatId, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.editChatTitle chatId: \(chatId), title: \(title))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.editChatTitle chatId: \(chatId), title: \(title))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -410,12 +410,12 @@ public extension Api { }) } - public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editChatPhoto(chatId: Int32, photo: Api.InputChatPhoto) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-900957736) serializeInt32(chatId, buffer: buffer, boxed: false) photo.serialize(buffer, true) - return (FunctionDescription({return "(messages.editChatPhoto chatId: \(chatId), photo: \(photo))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.editChatPhoto chatId: \(chatId), photo: \(photo))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -425,13 +425,13 @@ public extension Api { }) } - public static func addChatUser(chatId: Int32, userId: Api.InputUser, fwdLimit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func addChatUser(chatId: Int32, userId: Api.InputUser, fwdLimit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-106911223) serializeInt32(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) serializeInt32(fwdLimit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.addChatUser chatId: \(chatId), userId: \(userId), fwdLimit: \(fwdLimit))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.addChatUser chatId: \(chatId), userId: \(userId), fwdLimit: \(fwdLimit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -441,12 +441,12 @@ public extension Api { }) } - public static func deleteChatUser(chatId: Int32, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func deleteChatUser(chatId: Int32, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-530505962) serializeInt32(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) - return (FunctionDescription({return "(messages.deleteChatUser chatId: \(chatId), userId: \(userId))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.deleteChatUser chatId: \(chatId), userId: \(userId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -456,7 +456,7 @@ public extension Api { }) } - public static func createChat(users: [Api.InputUser], title: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func createChat(users: [Api.InputUser], title: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(164303470) buffer.appendInt32(481674261) @@ -465,7 +465,7 @@ public extension Api { item.serialize(buffer, true) } serializeString(title, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.createChat users: \(users), title: \(title))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.createChat users: \(users), title: \(title))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -475,13 +475,13 @@ public extension Api { }) } - public static func forwardMessage(peer: Api.InputPeer, id: Int32, randomId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func forwardMessage(peer: Api.InputPeer, id: Int32, randomId: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(865483769) peer.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) serializeInt64(randomId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.forwardMessage peer: \(peer), id: \(id), randomId: \(randomId))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.forwardMessage peer: \(peer), id: \(id), randomId: \(randomId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -491,12 +491,12 @@ public extension Api { }) } - public static func getDhConfig(version: Int32, randomLength: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.DhConfig?) { + public static func getDhConfig(version: Int32, randomLength: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(651135312) serializeInt32(version, buffer: buffer, boxed: false) serializeInt32(randomLength, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getDhConfig version: \(version), randomLength: \(randomLength))"}), buffer, { (buffer: Buffer) -> Api.messages.DhConfig? in + return (FunctionDescription({return "(messages.getDhConfig version: \(version), randomLength: \(randomLength))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.DhConfig? in let reader = BufferReader(buffer) var result: Api.messages.DhConfig? if let signature = reader.readInt32() { @@ -506,13 +506,13 @@ public extension Api { }) } - public static func requestEncryption(userId: Api.InputUser, randomId: Int32, gA: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.EncryptedChat?) { + public static func requestEncryption(userId: Api.InputUser, randomId: Int32, gA: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-162681021) userId.serialize(buffer, true) serializeInt32(randomId, buffer: buffer, boxed: false) serializeBytes(gA, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.requestEncryption userId: \(userId), randomId: \(randomId), gA: \(gA))"}), buffer, { (buffer: Buffer) -> Api.EncryptedChat? in + return (FunctionDescription({return "(messages.requestEncryption userId: \(userId), randomId: \(randomId), gA: \(gA))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedChat? in let reader = BufferReader(buffer) var result: Api.EncryptedChat? if let signature = reader.readInt32() { @@ -522,13 +522,13 @@ public extension Api { }) } - public static func acceptEncryption(peer: Api.InputEncryptedChat, gB: Buffer, keyFingerprint: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.EncryptedChat?) { + public static func acceptEncryption(peer: Api.InputEncryptedChat, gB: Buffer, keyFingerprint: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1035731989) peer.serialize(buffer, true) serializeBytes(gB, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.acceptEncryption peer: \(peer), gB: \(gB), keyFingerprint: \(keyFingerprint))"}), buffer, { (buffer: Buffer) -> Api.EncryptedChat? in + return (FunctionDescription({return "(messages.acceptEncryption peer: \(peer), gB: \(gB), keyFingerprint: \(keyFingerprint))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedChat? in let reader = BufferReader(buffer) var result: Api.EncryptedChat? if let signature = reader.readInt32() { @@ -538,11 +538,11 @@ public extension Api { }) } - public static func discardEncryption(chatId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func discardEncryption(chatId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-304536635) serializeInt32(chatId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.discardEncryption chatId: \(chatId))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.discardEncryption chatId: \(chatId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -552,12 +552,12 @@ public extension Api { }) } - public static func setEncryptedTyping(peer: Api.InputEncryptedChat, typing: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setEncryptedTyping(peer: Api.InputEncryptedChat, typing: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2031374829) peer.serialize(buffer, true) typing.serialize(buffer, true) - return (FunctionDescription({return "(messages.setEncryptedTyping peer: \(peer), typing: \(typing))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setEncryptedTyping peer: \(peer), typing: \(typing))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -567,12 +567,12 @@ public extension Api { }) } - public static func readEncryptedHistory(peer: Api.InputEncryptedChat, maxDate: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func readEncryptedHistory(peer: Api.InputEncryptedChat, maxDate: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2135648522) peer.serialize(buffer, true) serializeInt32(maxDate, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.readEncryptedHistory peer: \(peer), maxDate: \(maxDate))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.readEncryptedHistory peer: \(peer), maxDate: \(maxDate))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -582,13 +582,13 @@ public extension Api { }) } - public static func sendEncrypted(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.SentEncryptedMessage?) { + public static func sendEncrypted(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1451792525) peer.serialize(buffer, true) serializeInt64(randomId, buffer: buffer, boxed: false) serializeBytes(data, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.sendEncrypted peer: \(peer), randomId: \(randomId), data: \(data))"}), buffer, { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in + return (FunctionDescription({return "(messages.sendEncrypted peer: \(peer), randomId: \(randomId), data: \(data))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in let reader = BufferReader(buffer) var result: Api.messages.SentEncryptedMessage? if let signature = reader.readInt32() { @@ -598,14 +598,14 @@ public extension Api { }) } - public static func sendEncryptedFile(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer, file: Api.InputEncryptedFile) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.SentEncryptedMessage?) { + public static func sendEncryptedFile(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer, file: Api.InputEncryptedFile) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1701831834) peer.serialize(buffer, true) serializeInt64(randomId, buffer: buffer, boxed: false) serializeBytes(data, buffer: buffer, boxed: false) file.serialize(buffer, true) - return (FunctionDescription({return "(messages.sendEncryptedFile peer: \(peer), randomId: \(randomId), data: \(data), file: \(file))"}), buffer, { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in + return (FunctionDescription({return "(messages.sendEncryptedFile peer: \(peer), randomId: \(randomId), data: \(data), file: \(file))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in let reader = BufferReader(buffer) var result: Api.messages.SentEncryptedMessage? if let signature = reader.readInt32() { @@ -615,13 +615,13 @@ public extension Api { }) } - public static func sendEncryptedService(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.SentEncryptedMessage?) { + public static func sendEncryptedService(peer: Api.InputEncryptedChat, randomId: Int64, data: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(852769188) peer.serialize(buffer, true) serializeInt64(randomId, buffer: buffer, boxed: false) serializeBytes(data, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.sendEncryptedService peer: \(peer), randomId: \(randomId), data: \(data))"}), buffer, { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in + return (FunctionDescription({return "(messages.sendEncryptedService peer: \(peer), randomId: \(randomId), data: \(data))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SentEncryptedMessage? in let reader = BufferReader(buffer) var result: Api.messages.SentEncryptedMessage? if let signature = reader.readInt32() { @@ -631,11 +631,11 @@ public extension Api { }) } - public static func receivedQueue(maxQts: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> [Int64]?) { + public static func receivedQueue(maxQts: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Int64]>) { let buffer = Buffer() buffer.appendInt32(1436924774) serializeInt32(maxQts, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.receivedQueue maxQts: \(maxQts))"}), buffer, { (buffer: Buffer) -> [Int64]? in + return (FunctionDescription({return "(messages.receivedQueue maxQts: \(maxQts))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int64]? in let reader = BufferReader(buffer) var result: [Int64]? if let _ = reader.readInt32() { @@ -645,11 +645,11 @@ public extension Api { }) } - public static func reportEncryptedSpam(peer: Api.InputEncryptedChat) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reportEncryptedSpam(peer: Api.InputEncryptedChat) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1259113487) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.reportEncryptedSpam peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.reportEncryptedSpam peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -659,7 +659,7 @@ public extension Api { }) } - public static func readMessageContents(id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedMessages?) { + public static func readMessageContents(id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(916930423) buffer.appendInt32(481674261) @@ -667,7 +667,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.readMessageContents id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedMessages? in + return (FunctionDescription({return "(messages.readMessageContents id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in let reader = BufferReader(buffer) var result: Api.messages.AffectedMessages? if let signature = reader.readInt32() { @@ -677,11 +677,11 @@ public extension Api { }) } - public static func getAllStickers(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AllStickers?) { + public static func getAllStickers(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(479598769) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getAllStickers hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.AllStickers? in + return (FunctionDescription({return "(messages.getAllStickers hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in let reader = BufferReader(buffer) var result: Api.messages.AllStickers? if let signature = reader.readInt32() { @@ -691,11 +691,11 @@ public extension Api { }) } - public static func exportChatInvite(chatId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.ExportedChatInvite?) { + public static func exportChatInvite(chatId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2106086025) serializeInt32(chatId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.exportChatInvite chatId: \(chatId))"}), buffer, { (buffer: Buffer) -> Api.ExportedChatInvite? in + return (FunctionDescription({return "(messages.exportChatInvite chatId: \(chatId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedChatInvite? in let reader = BufferReader(buffer) var result: Api.ExportedChatInvite? if let signature = reader.readInt32() { @@ -705,11 +705,11 @@ public extension Api { }) } - public static func checkChatInvite(hash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.ChatInvite?) { + public static func checkChatInvite(hash: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1051570619) serializeString(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.checkChatInvite hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.ChatInvite? in + return (FunctionDescription({return "(messages.checkChatInvite hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ChatInvite? in let reader = BufferReader(buffer) var result: Api.ChatInvite? if let signature = reader.readInt32() { @@ -719,11 +719,11 @@ public extension Api { }) } - public static func importChatInvite(hash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func importChatInvite(hash: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1817183516) serializeString(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.importChatInvite hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.importChatInvite hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -733,11 +733,11 @@ public extension Api { }) } - public static func getStickerSet(stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.StickerSet?) { + public static func getStickerSet(stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(639215886) stickerset.serialize(buffer, true) - return (FunctionDescription({return "(messages.getStickerSet stickerset: \(stickerset))"}), buffer, { (buffer: Buffer) -> Api.messages.StickerSet? in + return (FunctionDescription({return "(messages.getStickerSet stickerset: \(stickerset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSet? in let reader = BufferReader(buffer) var result: Api.messages.StickerSet? if let signature = reader.readInt32() { @@ -747,12 +747,12 @@ public extension Api { }) } - public static func installStickerSet(stickerset: Api.InputStickerSet, archived: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.StickerSetInstallResult?) { + public static func installStickerSet(stickerset: Api.InputStickerSet, archived: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-946871200) stickerset.serialize(buffer, true) archived.serialize(buffer, true) - return (FunctionDescription({return "(messages.installStickerSet stickerset: \(stickerset), archived: \(archived))"}), buffer, { (buffer: Buffer) -> Api.messages.StickerSetInstallResult? in + return (FunctionDescription({return "(messages.installStickerSet stickerset: \(stickerset), archived: \(archived))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.StickerSetInstallResult? in let reader = BufferReader(buffer) var result: Api.messages.StickerSetInstallResult? if let signature = reader.readInt32() { @@ -762,11 +762,11 @@ public extension Api { }) } - public static func uninstallStickerSet(stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func uninstallStickerSet(stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-110209570) stickerset.serialize(buffer, true) - return (FunctionDescription({return "(messages.uninstallStickerSet stickerset: \(stickerset))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.uninstallStickerSet stickerset: \(stickerset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -776,14 +776,14 @@ public extension Api { }) } - public static func startBot(bot: Api.InputUser, peer: Api.InputPeer, randomId: Int64, startParam: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func startBot(bot: Api.InputUser, peer: Api.InputPeer, randomId: Int64, startParam: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-421563528) bot.serialize(buffer, true) peer.serialize(buffer, true) serializeInt64(randomId, buffer: buffer, boxed: false) serializeString(startParam, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.startBot bot: \(bot), peer: \(peer), randomId: \(randomId), startParam: \(startParam))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.startBot bot: \(bot), peer: \(peer), randomId: \(randomId), startParam: \(startParam))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -793,7 +793,7 @@ public extension Api { }) } - public static func getMessagesViews(peer: Api.InputPeer, id: [Int32], increment: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> [Int32]?) { + public static func getMessagesViews(peer: Api.InputPeer, id: [Int32], increment: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Int32]>) { let buffer = Buffer() buffer.appendInt32(-993483427) peer.serialize(buffer, true) @@ -803,7 +803,7 @@ public extension Api { serializeInt32(item, buffer: buffer, boxed: false) } increment.serialize(buffer, true) - return (FunctionDescription({return "(messages.getMessagesViews peer: \(peer), id: \(id), increment: \(increment))"}), buffer, { (buffer: Buffer) -> [Int32]? in + return (FunctionDescription({return "(messages.getMessagesViews peer: \(peer), id: \(id), increment: \(increment))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in let reader = BufferReader(buffer) var result: [Int32]? if let _ = reader.readInt32() { @@ -813,12 +813,12 @@ public extension Api { }) } - public static func toggleChatAdmins(chatId: Int32, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func toggleChatAdmins(chatId: Int32, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-326379039) serializeInt32(chatId, buffer: buffer, boxed: false) enabled.serialize(buffer, true) - return (FunctionDescription({return "(messages.toggleChatAdmins chatId: \(chatId), enabled: \(enabled))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.toggleChatAdmins chatId: \(chatId), enabled: \(enabled))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -828,13 +828,13 @@ public extension Api { }) } - public static func editChatAdmin(chatId: Int32, userId: Api.InputUser, isAdmin: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func editChatAdmin(chatId: Int32, userId: Api.InputUser, isAdmin: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1444503762) serializeInt32(chatId, buffer: buffer, boxed: false) userId.serialize(buffer, true) isAdmin.serialize(buffer, true) - return (FunctionDescription({return "(messages.editChatAdmin chatId: \(chatId), userId: \(userId), isAdmin: \(isAdmin))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.editChatAdmin chatId: \(chatId), userId: \(userId), isAdmin: \(isAdmin))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -844,11 +844,11 @@ public extension Api { }) } - public static func migrateChat(chatId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func migrateChat(chatId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(363051235) serializeInt32(chatId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.migrateChat chatId: \(chatId))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.migrateChat chatId: \(chatId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -858,7 +858,7 @@ public extension Api { }) } - public static func searchGlobal(q: String, offsetDate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func searchGlobal(q: String, offsetDate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1640190800) serializeString(q, buffer: buffer, boxed: false) @@ -866,7 +866,7 @@ public extension Api { offsetPeer.serialize(buffer, true) serializeInt32(offsetId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.searchGlobal q: \(q), offsetDate: \(offsetDate), offsetPeer: \(offsetPeer), offsetId: \(offsetId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.searchGlobal q: \(q), offsetDate: \(offsetDate), offsetPeer: \(offsetPeer), offsetId: \(offsetId), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -876,7 +876,7 @@ public extension Api { }) } - public static func reorderStickerSets(flags: Int32, order: [Int64]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reorderStickerSets(flags: Int32, order: [Int64]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2016638777) serializeInt32(flags, buffer: buffer, boxed: false) @@ -885,7 +885,7 @@ public extension Api { for item in order { serializeInt64(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.reorderStickerSets flags: \(flags), order: \(order))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.reorderStickerSets flags: \(flags), order: \(order))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -895,13 +895,13 @@ public extension Api { }) } - public static func getDocumentByHash(sha256: Buffer, size: Int32, mimeType: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Document?) { + public static func getDocumentByHash(sha256: Buffer, size: Int32, mimeType: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(864953444) serializeBytes(sha256, buffer: buffer, boxed: false) serializeInt32(size, buffer: buffer, boxed: false) serializeString(mimeType, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getDocumentByHash sha256: \(sha256), size: \(size), mimeType: \(mimeType))"}), buffer, { (buffer: Buffer) -> Api.Document? in + return (FunctionDescription({return "(messages.getDocumentByHash sha256: \(sha256), size: \(size), mimeType: \(mimeType))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Document? in let reader = BufferReader(buffer) var result: Api.Document? if let signature = reader.readInt32() { @@ -911,12 +911,12 @@ public extension Api { }) } - public static func searchGifs(q: String, offset: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FoundGifs?) { + public static func searchGifs(q: String, offset: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1080395925) serializeString(q, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.searchGifs q: \(q), offset: \(offset))"}), buffer, { (buffer: Buffer) -> Api.messages.FoundGifs? in + return (FunctionDescription({return "(messages.searchGifs q: \(q), offset: \(offset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FoundGifs? in let reader = BufferReader(buffer) var result: Api.messages.FoundGifs? if let signature = reader.readInt32() { @@ -926,11 +926,11 @@ public extension Api { }) } - public static func getSavedGifs(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.SavedGifs?) { + public static func getSavedGifs(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2084618926) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getSavedGifs hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.SavedGifs? in + return (FunctionDescription({return "(messages.getSavedGifs hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.SavedGifs? in let reader = BufferReader(buffer) var result: Api.messages.SavedGifs? if let signature = reader.readInt32() { @@ -940,12 +940,12 @@ public extension Api { }) } - public static func saveGif(id: Api.InputDocument, unsave: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveGif(id: Api.InputDocument, unsave: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(846868683) id.serialize(buffer, true) unsave.serialize(buffer, true) - return (FunctionDescription({return "(messages.saveGif id: \(id), unsave: \(unsave))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.saveGif id: \(id), unsave: \(unsave))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -955,7 +955,7 @@ public extension Api { }) } - public static func getInlineBotResults(flags: Int32, bot: Api.InputUser, peer: Api.InputPeer, geoPoint: Api.InputGeoPoint?, query: String, offset: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.BotResults?) { + public static func getInlineBotResults(flags: Int32, bot: Api.InputUser, peer: Api.InputPeer, geoPoint: Api.InputGeoPoint?, query: String, offset: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1364105629) serializeInt32(flags, buffer: buffer, boxed: false) @@ -964,7 +964,7 @@ public extension Api { if Int(flags) & Int(1 << 0) != 0 {geoPoint!.serialize(buffer, true)} serializeString(query, buffer: buffer, boxed: false) serializeString(offset, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getInlineBotResults flags: \(flags), bot: \(bot), peer: \(peer), geoPoint: \(String(describing: geoPoint)), query: \(query), offset: \(offset))"}), buffer, { (buffer: Buffer) -> Api.messages.BotResults? in + return (FunctionDescription({return "(messages.getInlineBotResults flags: \(flags), bot: \(bot), peer: \(peer), geoPoint: \(String(describing: geoPoint)), query: \(query), offset: \(offset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.BotResults? in let reader = BufferReader(buffer) var result: Api.messages.BotResults? if let signature = reader.readInt32() { @@ -974,7 +974,7 @@ public extension Api { }) } - public static func setInlineBotResults(flags: Int32, queryId: Int64, results: [Api.InputBotInlineResult], cacheTime: Int32, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setInlineBotResults(flags: Int32, queryId: Int64, results: [Api.InputBotInlineResult], cacheTime: Int32, nextOffset: String?, switchPm: Api.InlineBotSwitchPM?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-346119674) serializeInt32(flags, buffer: buffer, boxed: false) @@ -987,7 +987,7 @@ public extension Api { serializeInt32(cacheTime, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 2) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 3) != 0 {switchPm!.serialize(buffer, true)} - return (FunctionDescription({return "(messages.setInlineBotResults flags: \(flags), queryId: \(queryId), results: \(results), cacheTime: \(cacheTime), nextOffset: \(String(describing: nextOffset)), switchPm: \(String(describing: switchPm)))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setInlineBotResults flags: \(flags), queryId: \(queryId), results: \(results), cacheTime: \(cacheTime), nextOffset: \(String(describing: nextOffset)), switchPm: \(String(describing: switchPm)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -997,7 +997,7 @@ public extension Api { }) } - public static func sendInlineBotResult(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, randomId: Int64, queryId: Int64, id: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func sendInlineBotResult(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, randomId: Int64, queryId: Int64, id: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1318189314) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1006,7 +1006,7 @@ public extension Api { serializeInt64(randomId, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) serializeString(id, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.sendInlineBotResult flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), randomId: \(randomId), queryId: \(queryId), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.sendInlineBotResult flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), randomId: \(randomId), queryId: \(queryId), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1016,12 +1016,12 @@ public extension Api { }) } - public static func getMessageEditData(peer: Api.InputPeer, id: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.MessageEditData?) { + public static func getMessageEditData(peer: Api.InputPeer, id: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-39416522) peer.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getMessageEditData peer: \(peer), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.MessageEditData? in + return (FunctionDescription({return "(messages.getMessageEditData peer: \(peer), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.MessageEditData? in let reader = BufferReader(buffer) var result: Api.messages.MessageEditData? if let signature = reader.readInt32() { @@ -1031,36 +1031,14 @@ public extension Api { }) } - public static func editInlineBotMessage(flags: Int32, id: Api.InputBotInlineMessageID, message: String?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { - let buffer = Buffer() - buffer.appendInt32(319564933) - serializeInt32(flags, buffer: buffer, boxed: false) - id.serialize(buffer, true) - if Int(flags) & Int(1 << 11) != 0 {serializeString(message!, buffer: buffer, boxed: false)} - if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} - if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261) - buffer.appendInt32(Int32(entities!.count)) - for item in entities! { - item.serialize(buffer, true) - }} - return (FunctionDescription({return "(messages.editInlineBotMessage flags: \(flags), id: \(id), message: \(String(describing: message)), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)))"}), buffer, { (buffer: Buffer) -> Api.Bool? in - let reader = BufferReader(buffer) - var result: Api.Bool? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.Bool - } - return result - }) - } - - public static func getBotCallbackAnswer(flags: Int32, peer: Api.InputPeer, msgId: Int32, data: Buffer?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.BotCallbackAnswer?) { + public static func getBotCallbackAnswer(flags: Int32, peer: Api.InputPeer, msgId: Int32, data: Buffer?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2130010132) serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeInt32(msgId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeBytes(data!, buffer: buffer, boxed: false)} - return (FunctionDescription({return "(messages.getBotCallbackAnswer flags: \(flags), peer: \(peer), msgId: \(msgId), data: \(String(describing: data)))"}), buffer, { (buffer: Buffer) -> Api.messages.BotCallbackAnswer? in + return (FunctionDescription({return "(messages.getBotCallbackAnswer flags: \(flags), peer: \(peer), msgId: \(msgId), data: \(String(describing: data)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.BotCallbackAnswer? in let reader = BufferReader(buffer) var result: Api.messages.BotCallbackAnswer? if let signature = reader.readInt32() { @@ -1070,7 +1048,7 @@ public extension Api { }) } - public static func setBotCallbackAnswer(flags: Int32, queryId: Int64, message: String?, url: String?, cacheTime: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setBotCallbackAnswer(flags: Int32, queryId: Int64, message: String?, url: String?, cacheTime: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-712043766) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1078,7 +1056,7 @@ public extension Api { if Int(flags) & Int(1 << 0) != 0 {serializeString(message!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeString(url!, buffer: buffer, boxed: false)} serializeInt32(cacheTime, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.setBotCallbackAnswer flags: \(flags), queryId: \(queryId), message: \(String(describing: message)), url: \(String(describing: url)), cacheTime: \(cacheTime))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setBotCallbackAnswer flags: \(flags), queryId: \(queryId), message: \(String(describing: message)), url: \(String(describing: url)), cacheTime: \(cacheTime))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1088,7 +1066,7 @@ public extension Api { }) } - public static func saveDraft(flags: Int32, replyToMsgId: Int32?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveDraft(flags: Int32, replyToMsgId: Int32?, peer: Api.InputPeer, message: String, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1137057461) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1100,7 +1078,7 @@ public extension Api { for item in entities! { item.serialize(buffer, true) }} - return (FunctionDescription({return "(messages.saveDraft flags: \(flags), replyToMsgId: \(String(describing: replyToMsgId)), peer: \(peer), message: \(message), entities: \(String(describing: entities)))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.saveDraft flags: \(flags), replyToMsgId: \(String(describing: replyToMsgId)), peer: \(peer), message: \(message), entities: \(String(describing: entities)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1110,11 +1088,11 @@ public extension Api { }) } - public static func getAllDrafts() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func getAllDrafts() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1782549861) - return (FunctionDescription({return "(messages.getAllDrafts )"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.getAllDrafts )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1124,11 +1102,11 @@ public extension Api { }) } - public static func getFeaturedStickers(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FeaturedStickers?) { + public static func getFeaturedStickers(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(766298703) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getFeaturedStickers hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.FeaturedStickers? in + return (FunctionDescription({return "(messages.getFeaturedStickers hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FeaturedStickers? in let reader = BufferReader(buffer) var result: Api.messages.FeaturedStickers? if let signature = reader.readInt32() { @@ -1138,7 +1116,7 @@ public extension Api { }) } - public static func readFeaturedStickers(id: [Int64]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func readFeaturedStickers(id: [Int64]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1527873830) buffer.appendInt32(481674261) @@ -1146,7 +1124,7 @@ public extension Api { for item in id { serializeInt64(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.readFeaturedStickers id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.readFeaturedStickers id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1156,12 +1134,12 @@ public extension Api { }) } - public static func getRecentStickers(flags: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.RecentStickers?) { + public static func getRecentStickers(flags: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1587647177) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getRecentStickers flags: \(flags), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.RecentStickers? in + return (FunctionDescription({return "(messages.getRecentStickers flags: \(flags), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.RecentStickers? in let reader = BufferReader(buffer) var result: Api.messages.RecentStickers? if let signature = reader.readInt32() { @@ -1171,13 +1149,13 @@ public extension Api { }) } - public static func saveRecentSticker(flags: Int32, id: Api.InputDocument, unsave: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveRecentSticker(flags: Int32, id: Api.InputDocument, unsave: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(958863608) serializeInt32(flags, buffer: buffer, boxed: false) id.serialize(buffer, true) unsave.serialize(buffer, true) - return (FunctionDescription({return "(messages.saveRecentSticker flags: \(flags), id: \(id), unsave: \(unsave))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.saveRecentSticker flags: \(flags), id: \(id), unsave: \(unsave))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1187,11 +1165,11 @@ public extension Api { }) } - public static func clearRecentStickers(flags: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func clearRecentStickers(flags: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1986437075) serializeInt32(flags, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.clearRecentStickers flags: \(flags))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.clearRecentStickers flags: \(flags))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1201,13 +1179,13 @@ public extension Api { }) } - public static func getArchivedStickers(flags: Int32, offsetId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.ArchivedStickers?) { + public static func getArchivedStickers(flags: Int32, offsetId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1475442322) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(offsetId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getArchivedStickers flags: \(flags), offsetId: \(offsetId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.ArchivedStickers? in + return (FunctionDescription({return "(messages.getArchivedStickers flags: \(flags), offsetId: \(offsetId), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ArchivedStickers? in let reader = BufferReader(buffer) var result: Api.messages.ArchivedStickers? if let signature = reader.readInt32() { @@ -1217,11 +1195,11 @@ public extension Api { }) } - public static func getMaskStickers(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AllStickers?) { + public static func getMaskStickers(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1706608543) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getMaskStickers hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.AllStickers? in + return (FunctionDescription({return "(messages.getMaskStickers hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AllStickers? in let reader = BufferReader(buffer) var result: Api.messages.AllStickers? if let signature = reader.readInt32() { @@ -1231,11 +1209,11 @@ public extension Api { }) } - public static func getAttachedStickers(media: Api.InputStickeredMedia) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.StickerSetCovered]?) { + public static func getAttachedStickers(media: Api.InputStickeredMedia) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.StickerSetCovered]>) { let buffer = Buffer() buffer.appendInt32(-866424884) media.serialize(buffer, true) - return (FunctionDescription({return "(messages.getAttachedStickers media: \(media))"}), buffer, { (buffer: Buffer) -> [Api.StickerSetCovered]? in + return (FunctionDescription({return "(messages.getAttachedStickers media: \(media))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.StickerSetCovered]? in let reader = BufferReader(buffer) var result: [Api.StickerSetCovered]? if let _ = reader.readInt32() { @@ -1245,7 +1223,7 @@ public extension Api { }) } - public static func setGameScore(flags: Int32, peer: Api.InputPeer, id: Int32, userId: Api.InputUser, score: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func setGameScore(flags: Int32, peer: Api.InputPeer, id: Int32, userId: Api.InputUser, score: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1896289088) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1253,7 +1231,7 @@ public extension Api { serializeInt32(id, buffer: buffer, boxed: false) userId.serialize(buffer, true) serializeInt32(score, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.setGameScore flags: \(flags), peer: \(peer), id: \(id), userId: \(userId), score: \(score))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.setGameScore flags: \(flags), peer: \(peer), id: \(id), userId: \(userId), score: \(score))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1263,14 +1241,14 @@ public extension Api { }) } - public static func setInlineGameScore(flags: Int32, id: Api.InputBotInlineMessageID, userId: Api.InputUser, score: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setInlineGameScore(flags: Int32, id: Api.InputBotInlineMessageID, userId: Api.InputUser, score: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(363700068) serializeInt32(flags, buffer: buffer, boxed: false) id.serialize(buffer, true) userId.serialize(buffer, true) serializeInt32(score, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.setInlineGameScore flags: \(flags), id: \(id), userId: \(userId), score: \(score))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setInlineGameScore flags: \(flags), id: \(id), userId: \(userId), score: \(score))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1280,13 +1258,13 @@ public extension Api { }) } - public static func getGameHighScores(peer: Api.InputPeer, id: Int32, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.HighScores?) { + public static func getGameHighScores(peer: Api.InputPeer, id: Int32, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-400399203) peer.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) userId.serialize(buffer, true) - return (FunctionDescription({return "(messages.getGameHighScores peer: \(peer), id: \(id), userId: \(userId))"}), buffer, { (buffer: Buffer) -> Api.messages.HighScores? in + return (FunctionDescription({return "(messages.getGameHighScores peer: \(peer), id: \(id), userId: \(userId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HighScores? in let reader = BufferReader(buffer) var result: Api.messages.HighScores? if let signature = reader.readInt32() { @@ -1296,12 +1274,12 @@ public extension Api { }) } - public static func getInlineGameHighScores(id: Api.InputBotInlineMessageID, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.HighScores?) { + public static func getInlineGameHighScores(id: Api.InputBotInlineMessageID, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(258170395) id.serialize(buffer, true) userId.serialize(buffer, true) - return (FunctionDescription({return "(messages.getInlineGameHighScores id: \(id), userId: \(userId))"}), buffer, { (buffer: Buffer) -> Api.messages.HighScores? in + return (FunctionDescription({return "(messages.getInlineGameHighScores id: \(id), userId: \(userId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.HighScores? in let reader = BufferReader(buffer) var result: Api.messages.HighScores? if let signature = reader.readInt32() { @@ -1311,13 +1289,13 @@ public extension Api { }) } - public static func getCommonChats(userId: Api.InputUser, maxId: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Chats?) { + public static func getCommonChats(userId: Api.InputUser, maxId: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(218777796) userId.serialize(buffer, true) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getCommonChats userId: \(userId), maxId: \(maxId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.messages.Chats? in + return (FunctionDescription({return "(messages.getCommonChats userId: \(userId), maxId: \(maxId), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) var result: Api.messages.Chats? if let signature = reader.readInt32() { @@ -1327,7 +1305,7 @@ public extension Api { }) } - public static func getAllChats(exceptIds: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Chats?) { + public static func getAllChats(exceptIds: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-341307408) buffer.appendInt32(481674261) @@ -1335,7 +1313,7 @@ public extension Api { for item in exceptIds { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(messages.getAllChats exceptIds: \(exceptIds))"}), buffer, { (buffer: Buffer) -> Api.messages.Chats? in + return (FunctionDescription({return "(messages.getAllChats exceptIds: \(exceptIds))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) var result: Api.messages.Chats? if let signature = reader.readInt32() { @@ -1345,12 +1323,12 @@ public extension Api { }) } - public static func getWebPage(url: String, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.WebPage?) { + public static func getWebPage(url: String, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(852135825) serializeString(url, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getWebPage url: \(url), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.WebPage? in + return (FunctionDescription({return "(messages.getWebPage url: \(url), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.WebPage? in let reader = BufferReader(buffer) var result: Api.WebPage? if let signature = reader.readInt32() { @@ -1360,11 +1338,11 @@ public extension Api { }) } - public static func getPinnedDialogs() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.PeerDialogs?) { + public static func getPinnedDialogs() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-497756594) - return (FunctionDescription({return "(messages.getPinnedDialogs )"}), buffer, { (buffer: Buffer) -> Api.messages.PeerDialogs? in + return (FunctionDescription({return "(messages.getPinnedDialogs )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.PeerDialogs? in let reader = BufferReader(buffer) var result: Api.messages.PeerDialogs? if let signature = reader.readInt32() { @@ -1374,7 +1352,7 @@ public extension Api { }) } - public static func setBotShippingResults(flags: Int32, queryId: Int64, error: String?, shippingOptions: [Api.ShippingOption]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setBotShippingResults(flags: Int32, queryId: Int64, error: String?, shippingOptions: [Api.ShippingOption]?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-436833542) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1385,7 +1363,7 @@ public extension Api { for item in shippingOptions! { item.serialize(buffer, true) }} - return (FunctionDescription({return "(messages.setBotShippingResults flags: \(flags), queryId: \(queryId), error: \(String(describing: error)), shippingOptions: \(String(describing: shippingOptions)))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setBotShippingResults flags: \(flags), queryId: \(queryId), error: \(String(describing: error)), shippingOptions: \(String(describing: shippingOptions)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1395,13 +1373,13 @@ public extension Api { }) } - public static func setBotPrecheckoutResults(flags: Int32, queryId: Int64, error: String?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setBotPrecheckoutResults(flags: Int32, queryId: Int64, error: String?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(163765653) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt64(queryId, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeString(error!, buffer: buffer, boxed: false)} - return (FunctionDescription({return "(messages.setBotPrecheckoutResults flags: \(flags), queryId: \(queryId), error: \(String(describing: error)))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.setBotPrecheckoutResults flags: \(flags), queryId: \(queryId), error: \(String(describing: error)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1411,13 +1389,13 @@ public extension Api { }) } - public static func sendScreenshotNotification(peer: Api.InputPeer, replyToMsgId: Int32, randomId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func sendScreenshotNotification(peer: Api.InputPeer, replyToMsgId: Int32, randomId: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-914493408) peer.serialize(buffer, true) serializeInt32(replyToMsgId, buffer: buffer, boxed: false) serializeInt64(randomId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.sendScreenshotNotification peer: \(peer), replyToMsgId: \(replyToMsgId), randomId: \(randomId))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.sendScreenshotNotification peer: \(peer), replyToMsgId: \(replyToMsgId), randomId: \(randomId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1427,11 +1405,11 @@ public extension Api { }) } - public static func getFavedStickers(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FavedStickers?) { + public static func getFavedStickers(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(567151374) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getFavedStickers hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.FavedStickers? in + return (FunctionDescription({return "(messages.getFavedStickers hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FavedStickers? in let reader = BufferReader(buffer) var result: Api.messages.FavedStickers? if let signature = reader.readInt32() { @@ -1441,12 +1419,12 @@ public extension Api { }) } - public static func faveSticker(id: Api.InputDocument, unfave: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func faveSticker(id: Api.InputDocument, unfave: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1174420133) id.serialize(buffer, true) unfave.serialize(buffer, true) - return (FunctionDescription({return "(messages.faveSticker id: \(id), unfave: \(unfave))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.faveSticker id: \(id), unfave: \(unfave))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1456,7 +1434,7 @@ public extension Api { }) } - public static func getUnreadMentions(peer: Api.InputPeer, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func getUnreadMentions(peer: Api.InputPeer, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1180140658) peer.serialize(buffer, true) @@ -1465,7 +1443,7 @@ public extension Api { serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getUnreadMentions peer: \(peer), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.getUnreadMentions peer: \(peer), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -1475,11 +1453,11 @@ public extension Api { }) } - public static func readMentions(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedHistory?) { + public static func readMentions(peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(251759059) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.readMentions peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedHistory? in + return (FunctionDescription({return "(messages.readMentions peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in let reader = BufferReader(buffer) var result: Api.messages.AffectedHistory? if let signature = reader.readInt32() { @@ -1489,14 +1467,14 @@ public extension Api { }) } - public static func editGeoLive(flags: Int32, peer: Api.InputPeer, id: Int32, geoPoint: Api.InputGeoPoint?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editGeoLive(flags: Int32, peer: Api.InputPeer, id: Int32, geoPoint: Api.InputGeoPoint?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1701695410) serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 1) != 0 {geoPoint!.serialize(buffer, true)} - return (FunctionDescription({return "(messages.editGeoLive flags: \(flags), peer: \(peer), id: \(id), geoPoint: \(String(describing: geoPoint)))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.editGeoLive flags: \(flags), peer: \(peer), id: \(id), geoPoint: \(String(describing: geoPoint)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1506,12 +1484,12 @@ public extension Api { }) } - public static func uploadMedia(peer: Api.InputPeer, media: Api.InputMedia) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.MessageMedia?) { + public static func uploadMedia(peer: Api.InputPeer, media: Api.InputMedia) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1369162417) peer.serialize(buffer, true) media.serialize(buffer, true) - return (FunctionDescription({return "(messages.uploadMedia peer: \(peer), media: \(media))"}), buffer, { (buffer: Buffer) -> Api.MessageMedia? in + return (FunctionDescription({return "(messages.uploadMedia peer: \(peer), media: \(media))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.MessageMedia? in let reader = BufferReader(buffer) var result: Api.MessageMedia? if let signature = reader.readInt32() { @@ -1521,7 +1499,7 @@ public extension Api { }) } - public static func sendMultiMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, multiMedia: [Api.InputSingleMedia]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func sendMultiMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, multiMedia: [Api.InputSingleMedia]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(546656559) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1532,7 +1510,7 @@ public extension Api { for item in multiMedia { item.serialize(buffer, true) } - return (FunctionDescription({return "(messages.sendMultiMedia flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), multiMedia: \(multiMedia))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.sendMultiMedia flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), multiMedia: \(multiMedia))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1542,7 +1520,7 @@ public extension Api { }) } - public static func forwardMessages(flags: Int32, fromPeer: Api.InputPeer, id: [Int32], randomId: [Int64], toPeer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func forwardMessages(flags: Int32, fromPeer: Api.InputPeer, id: [Int32], randomId: [Int64], toPeer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1888354709) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1558,7 +1536,7 @@ public extension Api { serializeInt64(item, buffer: buffer, boxed: false) } toPeer.serialize(buffer, true) - return (FunctionDescription({return "(messages.forwardMessages flags: \(flags), fromPeer: \(fromPeer), id: \(id), randomId: \(randomId), toPeer: \(toPeer))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.forwardMessages flags: \(flags), fromPeer: \(fromPeer), id: \(id), randomId: \(randomId), toPeer: \(toPeer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1568,12 +1546,12 @@ public extension Api { }) } - public static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.EncryptedFile?) { + public static func uploadEncryptedFile(peer: Api.InputEncryptedChat, file: Api.InputEncryptedFile) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1347929239) peer.serialize(buffer, true) file.serialize(buffer, true) - return (FunctionDescription({return "(messages.uploadEncryptedFile peer: \(peer), file: \(file))"}), buffer, { (buffer: Buffer) -> Api.EncryptedFile? in + return (FunctionDescription({return "(messages.uploadEncryptedFile peer: \(peer), file: \(file))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.EncryptedFile? in let reader = BufferReader(buffer) var result: Api.EncryptedFile? if let signature = reader.readInt32() { @@ -1583,7 +1561,7 @@ public extension Api { }) } - public static func getWebPagePreview(flags: Int32, message: String, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.MessageMedia?) { + public static func getWebPagePreview(flags: Int32, message: String, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1956073268) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1593,7 +1571,7 @@ public extension Api { for item in entities! { item.serialize(buffer, true) }} - return (FunctionDescription({return "(messages.getWebPagePreview flags: \(flags), message: \(message), entities: \(String(describing: entities)))"}), buffer, { (buffer: Buffer) -> Api.MessageMedia? in + return (FunctionDescription({return "(messages.getWebPagePreview flags: \(flags), message: \(message), entities: \(String(describing: entities)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.MessageMedia? in let reader = BufferReader(buffer) var result: Api.MessageMedia? if let signature = reader.readInt32() { @@ -1603,7 +1581,7 @@ public extension Api { }) } - public static func sendMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, media: Api.InputMedia, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func sendMedia(flags: Int32, peer: Api.InputPeer, replyToMsgId: Int32?, media: Api.InputMedia, message: String, randomId: Int64, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1194252757) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1618,7 +1596,7 @@ public extension Api { for item in entities! { item.serialize(buffer, true) }} - return (FunctionDescription({return "(messages.sendMedia flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), media: \(media), message: \(message), randomId: \(randomId), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.sendMedia flags: \(flags), peer: \(peer), replyToMsgId: \(String(describing: replyToMsgId)), media: \(media), message: \(message), randomId: \(randomId), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1628,7 +1606,7 @@ public extension Api { }) } - public static func getMessages(id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func getMessages(id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1673946374) buffer.appendInt32(481674261) @@ -1636,7 +1614,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(messages.getMessages id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.getMessages id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -1646,7 +1624,7 @@ public extension Api { }) } - public static func report(peer: Api.InputPeer, id: [Int32], reason: Api.ReportReason) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func report(peer: Api.InputPeer, id: [Int32], reason: Api.ReportReason) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1115507112) peer.serialize(buffer, true) @@ -1656,7 +1634,7 @@ public extension Api { serializeInt32(item, buffer: buffer, boxed: false) } reason.serialize(buffer, true) - return (FunctionDescription({return "(messages.report peer: \(peer), id: \(id), reason: \(reason))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.report peer: \(peer), id: \(id), reason: \(reason))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1666,13 +1644,13 @@ public extension Api { }) } - public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func getRecentLocations(peer: Api.InputPeer, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1144759543) peer.serialize(buffer, true) serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getRecentLocations peer: \(peer), limit: \(limit), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.getRecentLocations peer: \(peer), limit: \(limit), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -1682,7 +1660,7 @@ public extension Api { }) } - public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func search(flags: Int32, peer: Api.InputPeer, q: String, fromId: Api.InputUser?, filter: Api.MessagesFilter, minDate: Int32, maxDate: Int32, offsetId: Int32, addOffset: Int32, limit: Int32, maxId: Int32, minId: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2045448344) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1698,7 +1676,7 @@ public extension Api { serializeInt32(maxId, buffer: buffer, boxed: false) serializeInt32(minId, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.search flags: \(flags), peer: \(peer), q: \(q), fromId: \(String(describing: fromId)), filter: \(filter), minDate: \(minDate), maxDate: \(maxDate), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(messages.search flags: \(flags), peer: \(peer), q: \(q), fromId: \(String(describing: fromId)), filter: \(filter), minDate: \(minDate), maxDate: \(maxDate), offsetId: \(offsetId), addOffset: \(addOffset), limit: \(limit), maxId: \(maxId), minId: \(minId), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -1708,12 +1686,12 @@ public extension Api { }) } - public static func toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func toggleDialogPin(flags: Int32, peer: Api.InputDialogPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1489903017) serializeInt32(flags, buffer: buffer, boxed: false) peer.serialize(buffer, true) - return (FunctionDescription({return "(messages.toggleDialogPin flags: \(flags), peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.toggleDialogPin flags: \(flags), peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1723,7 +1701,7 @@ public extension Api { }) } - public static func reorderPinnedDialogs(flags: Int32, order: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reorderPinnedDialogs(flags: Int32, order: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1532089919) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1732,7 +1710,7 @@ public extension Api { for item in order { item.serialize(buffer, true) } - return (FunctionDescription({return "(messages.reorderPinnedDialogs flags: \(flags), order: \(order))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(messages.reorderPinnedDialogs flags: \(flags), order: \(order))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1742,7 +1720,7 @@ public extension Api { }) } - public static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.PeerDialogs?) { + public static func getPeerDialogs(peers: [Api.InputDialogPeer]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-462373635) buffer.appendInt32(481674261) @@ -1750,7 +1728,7 @@ public extension Api { for item in peers { item.serialize(buffer, true) } - return (FunctionDescription({return "(messages.getPeerDialogs peers: \(peers))"}), buffer, { (buffer: Buffer) -> Api.messages.PeerDialogs? in + return (FunctionDescription({return "(messages.getPeerDialogs peers: \(peers))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.PeerDialogs? in let reader = BufferReader(buffer) var result: Api.messages.PeerDialogs? if let signature = reader.readInt32() { @@ -1760,13 +1738,13 @@ public extension Api { }) } - public static func searchStickerSets(flags: Int32, q: String, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.FoundStickerSets?) { + public static func searchStickerSets(flags: Int32, q: String, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1028140917) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(q, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.searchStickerSets flags: \(flags), q: \(q), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.FoundStickerSets? in + return (FunctionDescription({return "(messages.searchStickerSets flags: \(flags), q: \(q), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.FoundStickerSets? in let reader = BufferReader(buffer) var result: Api.messages.FoundStickerSets? if let signature = reader.readInt32() { @@ -1776,7 +1754,7 @@ public extension Api { }) } - public static func editMessage(flags: Int32, peer: Api.InputPeer, id: Int32, message: String?, media: Api.InputMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, geoPoint: Api.InputGeoPoint?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editMessage(flags: Int32, peer: Api.InputPeer, id: Int32, message: String?, media: Api.InputMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, geoPoint: Api.InputGeoPoint?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1073683256) serializeInt32(flags, buffer: buffer, boxed: false) @@ -1791,7 +1769,7 @@ public extension Api { item.serialize(buffer, true) }} if Int(flags) & Int(1 << 13) != 0 {geoPoint!.serialize(buffer, true)} - return (FunctionDescription({return "(messages.editMessage flags: \(flags), peer: \(peer), id: \(id), message: \(String(describing: message)), media: \(String(describing: media)), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)), geoPoint: \(String(describing: geoPoint)))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(messages.editMessage flags: \(flags), peer: \(peer), id: \(id), message: \(String(describing: message)), media: \(String(describing: media)), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)), geoPoint: \(String(describing: geoPoint)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1801,12 +1779,36 @@ public extension Api { }) } - public static func getStickers(emoticon: String, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Stickers?) { + public static func editInlineBotMessage(flags: Int32, id: Api.InputBotInlineMessageID, message: String?, media: Api.InputMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, geoPoint: Api.InputGeoPoint?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1379669976) + serializeInt32(flags, buffer: buffer, boxed: false) + id.serialize(buffer, true) + if Int(flags) & Int(1 << 11) != 0 {serializeString(message!, buffer: buffer, boxed: false)} + if Int(flags) & Int(1 << 14) != 0 {media!.serialize(buffer, true)} + if Int(flags) & Int(1 << 2) != 0 {replyMarkup!.serialize(buffer, true)} + if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261) + buffer.appendInt32(Int32(entities!.count)) + for item in entities! { + item.serialize(buffer, true) + }} + if Int(flags) & Int(1 << 13) != 0 {geoPoint!.serialize(buffer, true)} + return (FunctionDescription({return "(messages.editInlineBotMessage flags: \(flags), id: \(id), message: \(String(describing: message)), media: \(String(describing: media)), replyMarkup: \(String(describing: replyMarkup)), entities: \(String(describing: entities)), geoPoint: \(String(describing: geoPoint)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in + let reader = BufferReader(buffer) + var result: Api.Bool? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.Bool + } + return result + }) + } + + public static func getStickers(emoticon: String, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(71126828) serializeString(emoticon, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(messages.getStickers emoticon: \(emoticon), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.messages.Stickers? in + return (FunctionDescription({return "(messages.getStickers emoticon: \(emoticon), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Stickers? in let reader = BufferReader(buffer) var result: Api.messages.Stickers? if let signature = reader.readInt32() { @@ -1817,12 +1819,12 @@ public extension Api { } } public struct channels { - public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func readHistory(channel: Api.InputChannel, maxId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-871347913) channel.serialize(buffer, true) serializeInt32(maxId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.readHistory channel: \(channel), maxId: \(maxId))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.readHistory channel: \(channel), maxId: \(maxId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1832,7 +1834,7 @@ public extension Api { }) } - public static func deleteMessages(channel: Api.InputChannel, id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedMessages?) { + public static func deleteMessages(channel: Api.InputChannel, id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2067661490) channel.serialize(buffer, true) @@ -1841,7 +1843,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(channels.deleteMessages channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedMessages? in + return (FunctionDescription({return "(channels.deleteMessages channel: \(channel), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedMessages? in let reader = BufferReader(buffer) var result: Api.messages.AffectedMessages? if let signature = reader.readInt32() { @@ -1851,12 +1853,12 @@ public extension Api { }) } - public static func deleteUserHistory(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.AffectedHistory?) { + public static func deleteUserHistory(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-787622117) channel.serialize(buffer, true) userId.serialize(buffer, true) - return (FunctionDescription({return "(channels.deleteUserHistory channel: \(channel), userId: \(userId))"}), buffer, { (buffer: Buffer) -> Api.messages.AffectedHistory? in + return (FunctionDescription({return "(channels.deleteUserHistory channel: \(channel), userId: \(userId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.AffectedHistory? in let reader = BufferReader(buffer) var result: Api.messages.AffectedHistory? if let signature = reader.readInt32() { @@ -1866,7 +1868,7 @@ public extension Api { }) } - public static func reportSpam(channel: Api.InputChannel, userId: Api.InputUser, id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reportSpam(channel: Api.InputChannel, userId: Api.InputUser, id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-32999408) channel.serialize(buffer, true) @@ -1876,7 +1878,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(channels.reportSpam channel: \(channel), userId: \(userId), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.reportSpam channel: \(channel), userId: \(userId), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1886,12 +1888,12 @@ public extension Api { }) } - public static func getParticipant(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.ChannelParticipant?) { + public static func getParticipant(channel: Api.InputChannel, userId: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1416484774) channel.serialize(buffer, true) userId.serialize(buffer, true) - return (FunctionDescription({return "(channels.getParticipant channel: \(channel), userId: \(userId))"}), buffer, { (buffer: Buffer) -> Api.channels.ChannelParticipant? in + return (FunctionDescription({return "(channels.getParticipant channel: \(channel), userId: \(userId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.ChannelParticipant? in let reader = BufferReader(buffer) var result: Api.channels.ChannelParticipant? if let signature = reader.readInt32() { @@ -1901,7 +1903,7 @@ public extension Api { }) } - public static func getChannels(id: [Api.InputChannel]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Chats?) { + public static func getChannels(id: [Api.InputChannel]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(176122811) buffer.appendInt32(481674261) @@ -1909,7 +1911,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(channels.getChannels id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Chats? in + return (FunctionDescription({return "(channels.getChannels id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) var result: Api.messages.Chats? if let signature = reader.readInt32() { @@ -1919,11 +1921,11 @@ public extension Api { }) } - public static func getFullChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.ChatFull?) { + public static func getFullChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(141781513) channel.serialize(buffer, true) - return (FunctionDescription({return "(channels.getFullChannel channel: \(channel))"}), buffer, { (buffer: Buffer) -> Api.messages.ChatFull? in + return (FunctionDescription({return "(channels.getFullChannel channel: \(channel))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ChatFull? in let reader = BufferReader(buffer) var result: Api.messages.ChatFull? if let signature = reader.readInt32() { @@ -1933,13 +1935,13 @@ public extension Api { }) } - public static func createChannel(flags: Int32, title: String, about: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func createChannel(flags: Int32, title: String, about: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-192332417) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(title, buffer: buffer, boxed: false) serializeString(about, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.createChannel flags: \(flags), title: \(title), about: \(about))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.createChannel flags: \(flags), title: \(title), about: \(about))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1949,12 +1951,12 @@ public extension Api { }) } - public static func editAbout(channel: Api.InputChannel, about: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func editAbout(channel: Api.InputChannel, about: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(333610782) channel.serialize(buffer, true) serializeString(about, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.editAbout channel: \(channel), about: \(about))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.editAbout channel: \(channel), about: \(about))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -1964,12 +1966,12 @@ public extension Api { }) } - public static func editTitle(channel: Api.InputChannel, title: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editTitle(channel: Api.InputChannel, title: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1450044624) channel.serialize(buffer, true) serializeString(title, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.editTitle channel: \(channel), title: \(title))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.editTitle channel: \(channel), title: \(title))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1979,12 +1981,12 @@ public extension Api { }) } - public static func editPhoto(channel: Api.InputChannel, photo: Api.InputChatPhoto) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editPhoto(channel: Api.InputChannel, photo: Api.InputChatPhoto) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-248621111) channel.serialize(buffer, true) photo.serialize(buffer, true) - return (FunctionDescription({return "(channels.editPhoto channel: \(channel), photo: \(photo))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.editPhoto channel: \(channel), photo: \(photo))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -1994,12 +1996,12 @@ public extension Api { }) } - public static func checkUsername(channel: Api.InputChannel, username: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func checkUsername(channel: Api.InputChannel, username: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(283557164) channel.serialize(buffer, true) serializeString(username, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.checkUsername channel: \(channel), username: \(username))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.checkUsername channel: \(channel), username: \(username))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2009,12 +2011,12 @@ public extension Api { }) } - public static func updateUsername(channel: Api.InputChannel, username: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func updateUsername(channel: Api.InputChannel, username: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(890549214) channel.serialize(buffer, true) serializeString(username, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.updateUsername channel: \(channel), username: \(username))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.updateUsername channel: \(channel), username: \(username))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2024,11 +2026,11 @@ public extension Api { }) } - public static func joinChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func joinChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(615851205) channel.serialize(buffer, true) - return (FunctionDescription({return "(channels.joinChannel channel: \(channel))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.joinChannel channel: \(channel))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2038,11 +2040,11 @@ public extension Api { }) } - public static func leaveChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func leaveChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-130635115) channel.serialize(buffer, true) - return (FunctionDescription({return "(channels.leaveChannel channel: \(channel))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.leaveChannel channel: \(channel))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2052,7 +2054,7 @@ public extension Api { }) } - public static func inviteToChannel(channel: Api.InputChannel, users: [Api.InputUser]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func inviteToChannel(channel: Api.InputChannel, users: [Api.InputUser]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(429865580) channel.serialize(buffer, true) @@ -2061,7 +2063,7 @@ public extension Api { for item in users { item.serialize(buffer, true) } - return (FunctionDescription({return "(channels.inviteToChannel channel: \(channel), users: \(users))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.inviteToChannel channel: \(channel), users: \(users))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2071,13 +2073,13 @@ public extension Api { }) } - public static func kickFromChannel(channel: Api.InputChannel, userId: Api.InputUser, kicked: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func kickFromChannel(channel: Api.InputChannel, userId: Api.InputUser, kicked: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1502421484) channel.serialize(buffer, true) userId.serialize(buffer, true) kicked.serialize(buffer, true) - return (FunctionDescription({return "(channels.kickFromChannel channel: \(channel), userId: \(userId), kicked: \(kicked))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.kickFromChannel channel: \(channel), userId: \(userId), kicked: \(kicked))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2087,11 +2089,11 @@ public extension Api { }) } - public static func exportInvite(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.ExportedChatInvite?) { + public static func exportInvite(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-950663035) channel.serialize(buffer, true) - return (FunctionDescription({return "(channels.exportInvite channel: \(channel))"}), buffer, { (buffer: Buffer) -> Api.ExportedChatInvite? in + return (FunctionDescription({return "(channels.exportInvite channel: \(channel))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedChatInvite? in let reader = BufferReader(buffer) var result: Api.ExportedChatInvite? if let signature = reader.readInt32() { @@ -2101,11 +2103,11 @@ public extension Api { }) } - public static func deleteChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func deleteChannel(channel: Api.InputChannel) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1072619549) channel.serialize(buffer, true) - return (FunctionDescription({return "(channels.deleteChannel channel: \(channel))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.deleteChannel channel: \(channel))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2115,12 +2117,12 @@ public extension Api { }) } - public static func toggleInvites(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func toggleInvites(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1231065863) channel.serialize(buffer, true) enabled.serialize(buffer, true) - return (FunctionDescription({return "(channels.toggleInvites channel: \(channel), enabled: \(enabled))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.toggleInvites channel: \(channel), enabled: \(enabled))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2130,12 +2132,12 @@ public extension Api { }) } - public static func toggleSignatures(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func toggleSignatures(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(527021574) channel.serialize(buffer, true) enabled.serialize(buffer, true) - return (FunctionDescription({return "(channels.toggleSignatures channel: \(channel), enabled: \(enabled))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.toggleSignatures channel: \(channel), enabled: \(enabled))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2145,13 +2147,13 @@ public extension Api { }) } - public static func updatePinnedMessage(flags: Int32, channel: Api.InputChannel, id: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func updatePinnedMessage(flags: Int32, channel: Api.InputChannel, id: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1490162350) serializeInt32(flags, buffer: buffer, boxed: false) channel.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.updatePinnedMessage flags: \(flags), channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.updatePinnedMessage flags: \(flags), channel: \(channel), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2161,11 +2163,11 @@ public extension Api { }) } - public static func getAdminedPublicChannels() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Chats?) { + public static func getAdminedPublicChannels() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1920105769) - return (FunctionDescription({return "(channels.getAdminedPublicChannels )"}), buffer, { (buffer: Buffer) -> Api.messages.Chats? in + return (FunctionDescription({return "(channels.getAdminedPublicChannels )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Chats? in let reader = BufferReader(buffer) var result: Api.messages.Chats? if let signature = reader.readInt32() { @@ -2175,13 +2177,13 @@ public extension Api { }) } - public static func editAdmin(channel: Api.InputChannel, userId: Api.InputUser, adminRights: Api.ChannelAdminRights) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editAdmin(channel: Api.InputChannel, userId: Api.InputUser, adminRights: Api.ChannelAdminRights) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(548962836) channel.serialize(buffer, true) userId.serialize(buffer, true) adminRights.serialize(buffer, true) - return (FunctionDescription({return "(channels.editAdmin channel: \(channel), userId: \(userId), adminRights: \(adminRights))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.editAdmin channel: \(channel), userId: \(userId), adminRights: \(adminRights))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2191,13 +2193,13 @@ public extension Api { }) } - public static func editBanned(channel: Api.InputChannel, userId: Api.InputUser, bannedRights: Api.ChannelBannedRights) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func editBanned(channel: Api.InputChannel, userId: Api.InputUser, bannedRights: Api.ChannelBannedRights) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1076292147) channel.serialize(buffer, true) userId.serialize(buffer, true) bannedRights.serialize(buffer, true) - return (FunctionDescription({return "(channels.editBanned channel: \(channel), userId: \(userId), bannedRights: \(bannedRights))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.editBanned channel: \(channel), userId: \(userId), bannedRights: \(bannedRights))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2207,7 +2209,7 @@ public extension Api { }) } - public static func getAdminLog(flags: Int32, channel: Api.InputChannel, q: String, eventsFilter: Api.ChannelAdminLogEventsFilter?, admins: [Api.InputUser]?, maxId: Int64, minId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.AdminLogResults?) { + public static func getAdminLog(flags: Int32, channel: Api.InputChannel, q: String, eventsFilter: Api.ChannelAdminLogEventsFilter?, admins: [Api.InputUser]?, maxId: Int64, minId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(870184064) serializeInt32(flags, buffer: buffer, boxed: false) @@ -2222,7 +2224,7 @@ public extension Api { serializeInt64(maxId, buffer: buffer, boxed: false) serializeInt64(minId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.getAdminLog flags: \(flags), channel: \(channel), q: \(q), eventsFilter: \(String(describing: eventsFilter)), admins: \(String(describing: admins)), maxId: \(maxId), minId: \(minId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.channels.AdminLogResults? in + return (FunctionDescription({return "(channels.getAdminLog flags: \(flags), channel: \(channel), q: \(q), eventsFilter: \(String(describing: eventsFilter)), admins: \(String(describing: admins)), maxId: \(maxId), minId: \(minId), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.AdminLogResults? in let reader = BufferReader(buffer) var result: Api.channels.AdminLogResults? if let signature = reader.readInt32() { @@ -2232,12 +2234,12 @@ public extension Api { }) } - public static func setStickers(channel: Api.InputChannel, stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setStickers(channel: Api.InputChannel, stickerset: Api.InputStickerSet) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-359881479) channel.serialize(buffer, true) stickerset.serialize(buffer, true) - return (FunctionDescription({return "(channels.setStickers channel: \(channel), stickerset: \(stickerset))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.setStickers channel: \(channel), stickerset: \(stickerset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2247,7 +2249,7 @@ public extension Api { }) } - public static func readMessageContents(channel: Api.InputChannel, id: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func readMessageContents(channel: Api.InputChannel, id: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-357180360) channel.serialize(buffer, true) @@ -2256,7 +2258,7 @@ public extension Api { for item in id { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(channels.readMessageContents channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.readMessageContents channel: \(channel), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2266,12 +2268,12 @@ public extension Api { }) } - public static func deleteHistory(channel: Api.InputChannel, maxId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func deleteHistory(channel: Api.InputChannel, maxId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1355375294) channel.serialize(buffer, true) serializeInt32(maxId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.deleteHistory channel: \(channel), maxId: \(maxId))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(channels.deleteHistory channel: \(channel), maxId: \(maxId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2281,12 +2283,12 @@ public extension Api { }) } - public static func togglePreHistoryHidden(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func togglePreHistoryHidden(channel: Api.InputChannel, enabled: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-356796084) channel.serialize(buffer, true) enabled.serialize(buffer, true) - return (FunctionDescription({return "(channels.togglePreHistoryHidden channel: \(channel), enabled: \(enabled))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(channels.togglePreHistoryHidden channel: \(channel), enabled: \(enabled))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -2296,7 +2298,7 @@ public extension Api { }) } - public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.channels.ChannelParticipants?) { + public static func getParticipants(channel: Api.InputChannel, filter: Api.ChannelParticipantsFilter, offset: Int32, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(306054633) channel.serialize(buffer, true) @@ -2304,7 +2306,7 @@ public extension Api { serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(channels.getParticipants channel: \(channel), filter: \(filter), offset: \(offset), limit: \(limit), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.channels.ChannelParticipants? in + return (FunctionDescription({return "(channels.getParticipants channel: \(channel), filter: \(filter), offset: \(offset), limit: \(limit), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.ChannelParticipants? in let reader = BufferReader(buffer) var result: Api.channels.ChannelParticipants? if let signature = reader.readInt32() { @@ -2314,13 +2316,13 @@ public extension Api { }) } - public static func exportMessageLink(channel: Api.InputChannel, id: Int32, grouped: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.ExportedMessageLink?) { + public static func exportMessageLink(channel: Api.InputChannel, id: Int32, grouped: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-826838685) channel.serialize(buffer, true) serializeInt32(id, buffer: buffer, boxed: false) grouped.serialize(buffer, true) - return (FunctionDescription({return "(channels.exportMessageLink channel: \(channel), id: \(id), grouped: \(grouped))"}), buffer, { (buffer: Buffer) -> Api.ExportedMessageLink? in + return (FunctionDescription({return "(channels.exportMessageLink channel: \(channel), id: \(id), grouped: \(grouped))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.ExportedMessageLink? in let reader = BufferReader(buffer) var result: Api.ExportedMessageLink? if let signature = reader.readInt32() { @@ -2330,7 +2332,7 @@ public extension Api { }) } - public static func getMessages(channel: Api.InputChannel, id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.messages.Messages?) { + public static func getMessages(channel: Api.InputChannel, id: [Api.InputMessage]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1383294429) channel.serialize(buffer, true) @@ -2339,7 +2341,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(channels.getMessages channel: \(channel), id: \(id))"}), buffer, { (buffer: Buffer) -> Api.messages.Messages? in + return (FunctionDescription({return "(channels.getMessages channel: \(channel), id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.Messages? in let reader = BufferReader(buffer) var result: Api.messages.Messages? if let signature = reader.readInt32() { @@ -2350,11 +2352,11 @@ public extension Api { } } public struct payments { - public static func getPaymentForm(msgId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.PaymentForm?) { + public static func getPaymentForm(msgId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1712285883) serializeInt32(msgId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(payments.getPaymentForm msgId: \(msgId))"}), buffer, { (buffer: Buffer) -> Api.payments.PaymentForm? in + return (FunctionDescription({return "(payments.getPaymentForm msgId: \(msgId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentForm? in let reader = BufferReader(buffer) var result: Api.payments.PaymentForm? if let signature = reader.readInt32() { @@ -2364,11 +2366,11 @@ public extension Api { }) } - public static func getPaymentReceipt(msgId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.PaymentReceipt?) { + public static func getPaymentReceipt(msgId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1601001088) serializeInt32(msgId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(payments.getPaymentReceipt msgId: \(msgId))"}), buffer, { (buffer: Buffer) -> Api.payments.PaymentReceipt? in + return (FunctionDescription({return "(payments.getPaymentReceipt msgId: \(msgId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentReceipt? in let reader = BufferReader(buffer) var result: Api.payments.PaymentReceipt? if let signature = reader.readInt32() { @@ -2378,13 +2380,13 @@ public extension Api { }) } - public static func validateRequestedInfo(flags: Int32, msgId: Int32, info: Api.PaymentRequestedInfo) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.ValidatedRequestedInfo?) { + public static func validateRequestedInfo(flags: Int32, msgId: Int32, info: Api.PaymentRequestedInfo) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1997180532) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(msgId, buffer: buffer, boxed: false) info.serialize(buffer, true) - return (FunctionDescription({return "(payments.validateRequestedInfo flags: \(flags), msgId: \(msgId), info: \(info))"}), buffer, { (buffer: Buffer) -> Api.payments.ValidatedRequestedInfo? in + return (FunctionDescription({return "(payments.validateRequestedInfo flags: \(flags), msgId: \(msgId), info: \(info))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.ValidatedRequestedInfo? in let reader = BufferReader(buffer) var result: Api.payments.ValidatedRequestedInfo? if let signature = reader.readInt32() { @@ -2394,7 +2396,7 @@ public extension Api { }) } - public static func sendPaymentForm(flags: Int32, msgId: Int32, requestedInfoId: String?, shippingOptionId: String?, credentials: Api.InputPaymentCredentials) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.PaymentResult?) { + public static func sendPaymentForm(flags: Int32, msgId: Int32, requestedInfoId: String?, shippingOptionId: String?, credentials: Api.InputPaymentCredentials) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(730364339) serializeInt32(flags, buffer: buffer, boxed: false) @@ -2402,7 +2404,7 @@ public extension Api { if Int(flags) & Int(1 << 0) != 0 {serializeString(requestedInfoId!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeString(shippingOptionId!, buffer: buffer, boxed: false)} credentials.serialize(buffer, true) - return (FunctionDescription({return "(payments.sendPaymentForm flags: \(flags), msgId: \(msgId), requestedInfoId: \(String(describing: requestedInfoId)), shippingOptionId: \(String(describing: shippingOptionId)), credentials: \(credentials))"}), buffer, { (buffer: Buffer) -> Api.payments.PaymentResult? in + return (FunctionDescription({return "(payments.sendPaymentForm flags: \(flags), msgId: \(msgId), requestedInfoId: \(String(describing: requestedInfoId)), shippingOptionId: \(String(describing: shippingOptionId)), credentials: \(credentials))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentResult? in let reader = BufferReader(buffer) var result: Api.payments.PaymentResult? if let signature = reader.readInt32() { @@ -2412,11 +2414,11 @@ public extension Api { }) } - public static func getSavedInfo() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.payments.SavedInfo?) { + public static func getSavedInfo() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(578650699) - return (FunctionDescription({return "(payments.getSavedInfo )"}), buffer, { (buffer: Buffer) -> Api.payments.SavedInfo? in + return (FunctionDescription({return "(payments.getSavedInfo )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.SavedInfo? in let reader = BufferReader(buffer) var result: Api.payments.SavedInfo? if let signature = reader.readInt32() { @@ -2426,11 +2428,11 @@ public extension Api { }) } - public static func clearSavedInfo(flags: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func clearSavedInfo(flags: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-667062079) serializeInt32(flags, buffer: buffer, boxed: false) - return (FunctionDescription({return "(payments.clearSavedInfo flags: \(flags))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(payments.clearSavedInfo flags: \(flags))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2441,11 +2443,11 @@ public extension Api { } } public struct auth { - public static func checkPhone(phoneNumber: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.CheckedPhone?) { + public static func checkPhone(phoneNumber: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1877286395) serializeString(phoneNumber, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.checkPhone phoneNumber: \(phoneNumber))"}), buffer, { (buffer: Buffer) -> Api.auth.CheckedPhone? in + return (FunctionDescription({return "(auth.checkPhone phoneNumber: \(phoneNumber))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.CheckedPhone? in let reader = BufferReader(buffer) var result: Api.auth.CheckedPhone? if let signature = reader.readInt32() { @@ -2455,7 +2457,7 @@ public extension Api { }) } - public static func sendCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?, apiId: Int32, apiHash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.SentCode?) { + public static func sendCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?, apiId: Int32, apiHash: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2035355412) serializeInt32(flags, buffer: buffer, boxed: false) @@ -2463,7 +2465,7 @@ public extension Api { if Int(flags) & Int(1 << 0) != 0 {currentNumber!.serialize(buffer, true)} serializeInt32(apiId, buffer: buffer, boxed: false) serializeString(apiHash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.sendCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)), apiId: \(apiId), apiHash: \(apiHash))"}), buffer, { (buffer: Buffer) -> Api.auth.SentCode? in + return (FunctionDescription({return "(auth.sendCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)), apiId: \(apiId), apiHash: \(apiHash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in let reader = BufferReader(buffer) var result: Api.auth.SentCode? if let signature = reader.readInt32() { @@ -2473,7 +2475,7 @@ public extension Api { }) } - public static func signUp(phoneNumber: String, phoneCodeHash: String, phoneCode: String, firstName: String, lastName: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func signUp(phoneNumber: String, phoneCodeHash: String, phoneCode: String, firstName: String, lastName: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(453408308) serializeString(phoneNumber, buffer: buffer, boxed: false) @@ -2481,7 +2483,7 @@ public extension Api { serializeString(phoneCode, buffer: buffer, boxed: false) serializeString(firstName, buffer: buffer, boxed: false) serializeString(lastName, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.signUp phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode), firstName: \(firstName), lastName: \(lastName))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.signUp phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode), firstName: \(firstName), lastName: \(lastName))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2491,13 +2493,13 @@ public extension Api { }) } - public static func signIn(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func signIn(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1126886015) serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(phoneCodeHash, buffer: buffer, boxed: false) serializeString(phoneCode, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.signIn phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.signIn phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2507,11 +2509,11 @@ public extension Api { }) } - public static func logOut() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func logOut() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1461180992) - return (FunctionDescription({return "(auth.logOut )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.logOut )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2521,11 +2523,11 @@ public extension Api { }) } - public static func resetAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetAuthorizations() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1616179942) - return (FunctionDescription({return "(auth.resetAuthorizations )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.resetAuthorizations )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2535,7 +2537,7 @@ public extension Api { }) } - public static func sendInvites(phoneNumbers: [String], message: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func sendInvites(phoneNumbers: [String], message: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1998331287) buffer.appendInt32(481674261) @@ -2544,7 +2546,7 @@ public extension Api { serializeString(item, buffer: buffer, boxed: false) } serializeString(message, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.sendInvites phoneNumbers: \(phoneNumbers), message: \(message))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.sendInvites phoneNumbers: \(phoneNumbers), message: \(message))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2554,11 +2556,11 @@ public extension Api { }) } - public static func exportAuthorization(dcId: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.ExportedAuthorization?) { + public static func exportAuthorization(dcId: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-440401971) serializeInt32(dcId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.exportAuthorization dcId: \(dcId))"}), buffer, { (buffer: Buffer) -> Api.auth.ExportedAuthorization? in + return (FunctionDescription({return "(auth.exportAuthorization dcId: \(dcId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.ExportedAuthorization? in let reader = BufferReader(buffer) var result: Api.auth.ExportedAuthorization? if let signature = reader.readInt32() { @@ -2568,12 +2570,12 @@ public extension Api { }) } - public static func importAuthorization(id: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func importAuthorization(id: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-470837741) serializeInt32(id, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.importAuthorization id: \(id), bytes: \(bytes))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.importAuthorization id: \(id), bytes: \(bytes))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2583,14 +2585,14 @@ public extension Api { }) } - public static func bindTempAuthKey(permAuthKeyId: Int64, nonce: Int64, expiresAt: Int32, encryptedMessage: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func bindTempAuthKey(permAuthKeyId: Int64, nonce: Int64, expiresAt: Int32, encryptedMessage: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-841733627) serializeInt64(permAuthKeyId, buffer: buffer, boxed: false) serializeInt64(nonce, buffer: buffer, boxed: false) serializeInt32(expiresAt, buffer: buffer, boxed: false) serializeBytes(encryptedMessage, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.bindTempAuthKey permAuthKeyId: \(permAuthKeyId), nonce: \(nonce), expiresAt: \(expiresAt), encryptedMessage: \(encryptedMessage))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.bindTempAuthKey permAuthKeyId: \(permAuthKeyId), nonce: \(nonce), expiresAt: \(expiresAt), encryptedMessage: \(encryptedMessage))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2600,14 +2602,14 @@ public extension Api { }) } - public static func importBotAuthorization(flags: Int32, apiId: Int32, apiHash: String, botAuthToken: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func importBotAuthorization(flags: Int32, apiId: Int32, apiHash: String, botAuthToken: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1738800940) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(apiId, buffer: buffer, boxed: false) serializeString(apiHash, buffer: buffer, boxed: false) serializeString(botAuthToken, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.importBotAuthorization flags: \(flags), apiId: \(apiId), apiHash: \(apiHash), botAuthToken: \(botAuthToken))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.importBotAuthorization flags: \(flags), apiId: \(apiId), apiHash: \(apiHash), botAuthToken: \(botAuthToken))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2617,11 +2619,11 @@ public extension Api { }) } - public static func checkPassword(passwordHash: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func checkPassword(passwordHash: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(174260510) serializeBytes(passwordHash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.checkPassword passwordHash: \(passwordHash))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.checkPassword passwordHash: \(passwordHash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2631,11 +2633,11 @@ public extension Api { }) } - public static func requestPasswordRecovery() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.PasswordRecovery?) { + public static func requestPasswordRecovery() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-661144474) - return (FunctionDescription({return "(auth.requestPasswordRecovery )"}), buffer, { (buffer: Buffer) -> Api.auth.PasswordRecovery? in + return (FunctionDescription({return "(auth.requestPasswordRecovery )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.PasswordRecovery? in let reader = BufferReader(buffer) var result: Api.auth.PasswordRecovery? if let signature = reader.readInt32() { @@ -2645,11 +2647,11 @@ public extension Api { }) } - public static func recoverPassword(code: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.Authorization?) { + public static func recoverPassword(code: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1319464594) serializeString(code, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.recoverPassword code: \(code))"}), buffer, { (buffer: Buffer) -> Api.auth.Authorization? in + return (FunctionDescription({return "(auth.recoverPassword code: \(code))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.Authorization? in let reader = BufferReader(buffer) var result: Api.auth.Authorization? if let signature = reader.readInt32() { @@ -2659,12 +2661,12 @@ public extension Api { }) } - public static func resendCode(phoneNumber: String, phoneCodeHash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.SentCode?) { + public static func resendCode(phoneNumber: String, phoneCodeHash: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1056025023) serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(phoneCodeHash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.resendCode phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash))"}), buffer, { (buffer: Buffer) -> Api.auth.SentCode? in + return (FunctionDescription({return "(auth.resendCode phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in let reader = BufferReader(buffer) var result: Api.auth.SentCode? if let signature = reader.readInt32() { @@ -2674,12 +2676,12 @@ public extension Api { }) } - public static func cancelCode(phoneNumber: String, phoneCodeHash: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func cancelCode(phoneNumber: String, phoneCodeHash: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(520357240) serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(phoneCodeHash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(auth.cancelCode phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.cancelCode phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2689,7 +2691,7 @@ public extension Api { }) } - public static func dropTempAuthKeys(exceptAuthKeys: [Int64]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func dropTempAuthKeys(exceptAuthKeys: [Int64]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1907842680) buffer.appendInt32(481674261) @@ -2697,7 +2699,7 @@ public extension Api { for item in exceptAuthKeys { serializeInt64(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(auth.dropTempAuthKeys exceptAuthKeys: \(exceptAuthKeys))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(auth.dropTempAuthKeys exceptAuthKeys: \(exceptAuthKeys))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2708,12 +2710,12 @@ public extension Api { } } public struct bots { - public static func sendCustomRequest(customMethod: String, params: Api.DataJSON) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.DataJSON?) { + public static func sendCustomRequest(customMethod: String, params: Api.DataJSON) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1440257555) serializeString(customMethod, buffer: buffer, boxed: false) params.serialize(buffer, true) - return (FunctionDescription({return "(bots.sendCustomRequest customMethod: \(customMethod), params: \(params))"}), buffer, { (buffer: Buffer) -> Api.DataJSON? in + return (FunctionDescription({return "(bots.sendCustomRequest customMethod: \(customMethod), params: \(params))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.DataJSON? in let reader = BufferReader(buffer) var result: Api.DataJSON? if let signature = reader.readInt32() { @@ -2723,12 +2725,12 @@ public extension Api { }) } - public static func answerWebhookJSONQuery(queryId: Int64, data: Api.DataJSON) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func answerWebhookJSONQuery(queryId: Int64, data: Api.DataJSON) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-434028723) serializeInt64(queryId, buffer: buffer, boxed: false) data.serialize(buffer, true) - return (FunctionDescription({return "(bots.answerWebhookJSONQuery queryId: \(queryId), data: \(data))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(bots.answerWebhookJSONQuery queryId: \(queryId), data: \(data))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2739,7 +2741,7 @@ public extension Api { } } public struct users { - public static func getUsers(id: [Api.InputUser]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.User]?) { + public static func getUsers(id: [Api.InputUser]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.User]>) { let buffer = Buffer() buffer.appendInt32(227648840) buffer.appendInt32(481674261) @@ -2747,7 +2749,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(users.getUsers id: \(id))"}), buffer, { (buffer: Buffer) -> [Api.User]? in + return (FunctionDescription({return "(users.getUsers id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.User]? in let reader = BufferReader(buffer) var result: [Api.User]? if let _ = reader.readInt32() { @@ -2757,11 +2759,11 @@ public extension Api { }) } - public static func getFullUser(id: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.UserFull?) { + public static func getFullUser(id: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-902781519) id.serialize(buffer, true) - return (FunctionDescription({return "(users.getFullUser id: \(id))"}), buffer, { (buffer: Buffer) -> Api.UserFull? in + return (FunctionDescription({return "(users.getFullUser id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.UserFull? in let reader = BufferReader(buffer) var result: Api.UserFull? if let signature = reader.readInt32() { @@ -2771,7 +2773,7 @@ public extension Api { }) } - public static func setSecureValueErrors(id: Api.InputUser, errors: [Api.SecureValueError]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setSecureValueErrors(id: Api.InputUser, errors: [Api.SecureValueError]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1865902923) id.serialize(buffer, true) @@ -2780,7 +2782,7 @@ public extension Api { for item in errors { item.serialize(buffer, true) } - return (FunctionDescription({return "(users.setSecureValueErrors id: \(id), errors: \(errors))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(users.setSecureValueErrors id: \(id), errors: \(errors))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2791,11 +2793,11 @@ public extension Api { } } public struct contacts { - public static func getStatuses() -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.ContactStatus]?) { + public static func getStatuses() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.ContactStatus]>) { let buffer = Buffer() buffer.appendInt32(-995929106) - return (FunctionDescription({return "(contacts.getStatuses )"}), buffer, { (buffer: Buffer) -> [Api.ContactStatus]? in + return (FunctionDescription({return "(contacts.getStatuses )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.ContactStatus]? in let reader = BufferReader(buffer) var result: [Api.ContactStatus]? if let _ = reader.readInt32() { @@ -2805,11 +2807,11 @@ public extension Api { }) } - public static func deleteContact(id: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.Link?) { + public static func deleteContact(id: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1902823612) id.serialize(buffer, true) - return (FunctionDescription({return "(contacts.deleteContact id: \(id))"}), buffer, { (buffer: Buffer) -> Api.contacts.Link? in + return (FunctionDescription({return "(contacts.deleteContact id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Link? in let reader = BufferReader(buffer) var result: Api.contacts.Link? if let signature = reader.readInt32() { @@ -2819,7 +2821,7 @@ public extension Api { }) } - public static func deleteContacts(id: [Api.InputUser]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func deleteContacts(id: [Api.InputUser]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1504393374) buffer.appendInt32(481674261) @@ -2827,7 +2829,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(contacts.deleteContacts id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(contacts.deleteContacts id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2837,11 +2839,11 @@ public extension Api { }) } - public static func block(id: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func block(id: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(858475004) id.serialize(buffer, true) - return (FunctionDescription({return "(contacts.block id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(contacts.block id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2851,11 +2853,11 @@ public extension Api { }) } - public static func unblock(id: Api.InputUser) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func unblock(id: Api.InputUser) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-448724803) id.serialize(buffer, true) - return (FunctionDescription({return "(contacts.unblock id: \(id))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(contacts.unblock id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2865,12 +2867,12 @@ public extension Api { }) } - public static func getBlocked(offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.Blocked?) { + public static func getBlocked(offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-176409329) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(contacts.getBlocked offset: \(offset), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.contacts.Blocked? in + return (FunctionDescription({return "(contacts.getBlocked offset: \(offset), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Blocked? in let reader = BufferReader(buffer) var result: Api.contacts.Blocked? if let signature = reader.readInt32() { @@ -2880,11 +2882,11 @@ public extension Api { }) } - public static func exportCard() -> (CustomStringConvertible, Buffer, (Buffer) -> [Int32]?) { + public static func exportCard() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Int32]>) { let buffer = Buffer() buffer.appendInt32(-2065352905) - return (FunctionDescription({return "(contacts.exportCard )"}), buffer, { (buffer: Buffer) -> [Int32]? in + return (FunctionDescription({return "(contacts.exportCard )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int32]? in let reader = BufferReader(buffer) var result: [Int32]? if let _ = reader.readInt32() { @@ -2894,7 +2896,7 @@ public extension Api { }) } - public static func importCard(exportCard: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.User?) { + public static func importCard(exportCard: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1340184318) buffer.appendInt32(481674261) @@ -2902,7 +2904,7 @@ public extension Api { for item in exportCard { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(contacts.importCard exportCard: \(exportCard))"}), buffer, { (buffer: Buffer) -> Api.User? in + return (FunctionDescription({return "(contacts.importCard exportCard: \(exportCard))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in let reader = BufferReader(buffer) var result: Api.User? if let signature = reader.readInt32() { @@ -2912,12 +2914,12 @@ public extension Api { }) } - public static func search(q: String, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.Found?) { + public static func search(q: String, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(301470424) serializeString(q, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(contacts.search q: \(q), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.contacts.Found? in + return (FunctionDescription({return "(contacts.search q: \(q), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Found? in let reader = BufferReader(buffer) var result: Api.contacts.Found? if let signature = reader.readInt32() { @@ -2927,11 +2929,11 @@ public extension Api { }) } - public static func resolveUsername(username: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.ResolvedPeer?) { + public static func resolveUsername(username: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-113456221) serializeString(username, buffer: buffer, boxed: false) - return (FunctionDescription({return "(contacts.resolveUsername username: \(username))"}), buffer, { (buffer: Buffer) -> Api.contacts.ResolvedPeer? in + return (FunctionDescription({return "(contacts.resolveUsername username: \(username))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.ResolvedPeer? in let reader = BufferReader(buffer) var result: Api.contacts.ResolvedPeer? if let signature = reader.readInt32() { @@ -2941,14 +2943,14 @@ public extension Api { }) } - public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.TopPeers?) { + public static func getTopPeers(flags: Int32, offset: Int32, limit: Int32, hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-728224331) serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(contacts.getTopPeers flags: \(flags), offset: \(offset), limit: \(limit), hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.contacts.TopPeers? in + return (FunctionDescription({return "(contacts.getTopPeers flags: \(flags), offset: \(offset), limit: \(limit), hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.TopPeers? in let reader = BufferReader(buffer) var result: Api.contacts.TopPeers? if let signature = reader.readInt32() { @@ -2958,12 +2960,12 @@ public extension Api { }) } - public static func resetTopPeerRating(category: Api.TopPeerCategory, peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetTopPeerRating(category: Api.TopPeerCategory, peer: Api.InputPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(451113900) category.serialize(buffer, true) peer.serialize(buffer, true) - return (FunctionDescription({return "(contacts.resetTopPeerRating category: \(category), peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(contacts.resetTopPeerRating category: \(category), peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -2973,7 +2975,7 @@ public extension Api { }) } - public static func importContacts(contacts: [Api.InputContact]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.ImportedContacts?) { + public static func importContacts(contacts: [Api.InputContact]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(746589157) buffer.appendInt32(481674261) @@ -2981,7 +2983,7 @@ public extension Api { for item in contacts { item.serialize(buffer, true) } - return (FunctionDescription({return "(contacts.importContacts contacts: \(contacts))"}), buffer, { (buffer: Buffer) -> Api.contacts.ImportedContacts? in + return (FunctionDescription({return "(contacts.importContacts contacts: \(contacts))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.ImportedContacts? in let reader = BufferReader(buffer) var result: Api.contacts.ImportedContacts? if let signature = reader.readInt32() { @@ -2991,11 +2993,11 @@ public extension Api { }) } - public static func resetSaved() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetSaved() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2020263951) - return (FunctionDescription({return "(contacts.resetSaved )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(contacts.resetSaved )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3005,11 +3007,11 @@ public extension Api { }) } - public static func getContacts(hash: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.contacts.Contacts?) { + public static func getContacts(hash: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1071414113) serializeInt32(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(contacts.getContacts hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.contacts.Contacts? in + return (FunctionDescription({return "(contacts.getContacts hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.contacts.Contacts? in let reader = BufferReader(buffer) var result: Api.contacts.Contacts? if let signature = reader.readInt32() { @@ -3020,11 +3022,11 @@ public extension Api { } } public struct help { - public static func getConfig() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Config?) { + public static func getConfig() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-990308245) - return (FunctionDescription({return "(help.getConfig )"}), buffer, { (buffer: Buffer) -> Api.Config? in + return (FunctionDescription({return "(help.getConfig )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Config? in let reader = BufferReader(buffer) var result: Api.Config? if let signature = reader.readInt32() { @@ -3034,11 +3036,11 @@ public extension Api { }) } - public static func getNearestDc() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.NearestDc?) { + public static func getNearestDc() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(531836966) - return (FunctionDescription({return "(help.getNearestDc )"}), buffer, { (buffer: Buffer) -> Api.NearestDc? in + return (FunctionDescription({return "(help.getNearestDc )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.NearestDc? in let reader = BufferReader(buffer) var result: Api.NearestDc? if let signature = reader.readInt32() { @@ -3048,11 +3050,11 @@ public extension Api { }) } - public static func getAppUpdate() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.AppUpdate?) { + public static func getAppUpdate() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1372724842) - return (FunctionDescription({return "(help.getAppUpdate )"}), buffer, { (buffer: Buffer) -> Api.help.AppUpdate? in + return (FunctionDescription({return "(help.getAppUpdate )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.AppUpdate? in let reader = BufferReader(buffer) var result: Api.help.AppUpdate? if let signature = reader.readInt32() { @@ -3062,7 +3064,7 @@ public extension Api { }) } - public static func saveAppLog(events: [Api.InputAppEvent]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveAppLog(events: [Api.InputAppEvent]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1862465352) buffer.appendInt32(481674261) @@ -3070,7 +3072,7 @@ public extension Api { for item in events { item.serialize(buffer, true) } - return (FunctionDescription({return "(help.saveAppLog events: \(events))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(help.saveAppLog events: \(events))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3080,11 +3082,11 @@ public extension Api { }) } - public static func getInviteText() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.InviteText?) { + public static func getInviteText() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1295590211) - return (FunctionDescription({return "(help.getInviteText )"}), buffer, { (buffer: Buffer) -> Api.help.InviteText? in + return (FunctionDescription({return "(help.getInviteText )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.InviteText? in let reader = BufferReader(buffer) var result: Api.help.InviteText? if let signature = reader.readInt32() { @@ -3094,11 +3096,11 @@ public extension Api { }) } - public static func getSupport() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.Support?) { + public static func getSupport() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1663104819) - return (FunctionDescription({return "(help.getSupport )"}), buffer, { (buffer: Buffer) -> Api.help.Support? in + return (FunctionDescription({return "(help.getSupport )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.Support? in let reader = BufferReader(buffer) var result: Api.help.Support? if let signature = reader.readInt32() { @@ -3108,11 +3110,11 @@ public extension Api { }) } - public static func getAppChangelog(prevAppVersion: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func getAppChangelog(prevAppVersion: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1877938321) serializeString(prevAppVersion, buffer: buffer, boxed: false) - return (FunctionDescription({return "(help.getAppChangelog prevAppVersion: \(prevAppVersion))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(help.getAppChangelog prevAppVersion: \(prevAppVersion))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -3122,26 +3124,12 @@ public extension Api { }) } - public static func getTermsOfService() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.TermsOfService?) { - let buffer = Buffer() - buffer.appendInt32(889286899) - - return (FunctionDescription({return "(help.getTermsOfService )"}), buffer, { (buffer: Buffer) -> Api.help.TermsOfService? in - let reader = BufferReader(buffer) - var result: Api.help.TermsOfService? - if let signature = reader.readInt32() { - result = Api.parse(reader, signature: signature) as? Api.help.TermsOfService - } - return result - }) - } - - public static func setBotUpdatesStatus(pendingUpdatesCount: Int32, message: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setBotUpdatesStatus(pendingUpdatesCount: Int32, message: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-333262899) serializeInt32(pendingUpdatesCount, buffer: buffer, boxed: false) serializeString(message, buffer: buffer, boxed: false) - return (FunctionDescription({return "(help.setBotUpdatesStatus pendingUpdatesCount: \(pendingUpdatesCount), message: \(message))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(help.setBotUpdatesStatus pendingUpdatesCount: \(pendingUpdatesCount), message: \(message))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3151,11 +3139,11 @@ public extension Api { }) } - public static func getCdnConfig() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.CdnConfig?) { + public static func getCdnConfig() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1375900482) - return (FunctionDescription({return "(help.getCdnConfig )"}), buffer, { (buffer: Buffer) -> Api.CdnConfig? in + return (FunctionDescription({return "(help.getCdnConfig )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.CdnConfig? in let reader = BufferReader(buffer) var result: Api.CdnConfig? if let signature = reader.readInt32() { @@ -3165,11 +3153,11 @@ public extension Api { }) } - public static func test() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func test() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1058929929) - return (FunctionDescription({return "(help.test )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(help.test )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3179,11 +3167,11 @@ public extension Api { }) } - public static func getRecentMeUrls(referer: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.RecentMeUrls?) { + public static func getRecentMeUrls(referer: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1036054804) serializeString(referer, buffer: buffer, boxed: false) - return (FunctionDescription({return "(help.getRecentMeUrls referer: \(referer))"}), buffer, { (buffer: Buffer) -> Api.help.RecentMeUrls? in + return (FunctionDescription({return "(help.getRecentMeUrls referer: \(referer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.RecentMeUrls? in let reader = BufferReader(buffer) var result: Api.help.RecentMeUrls? if let signature = reader.readInt32() { @@ -3193,11 +3181,11 @@ public extension Api { }) } - public static func getProxyData() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.ProxyData?) { + public static func getProxyData() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1031231713) - return (FunctionDescription({return "(help.getProxyData )"}), buffer, { (buffer: Buffer) -> Api.help.ProxyData? in + return (FunctionDescription({return "(help.getProxyData )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.ProxyData? in let reader = BufferReader(buffer) var result: Api.help.ProxyData? if let signature = reader.readInt32() { @@ -3207,11 +3195,26 @@ public extension Api { }) } - public static func getDeepLinkInfo(path: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.help.DeepLinkInfo?) { + public static func getTermsOfService(countryIso2: String, langCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-92706236) + serializeString(countryIso2, buffer: buffer, boxed: false) + serializeString(langCode, buffer: buffer, boxed: false) + return (FunctionDescription({return "(help.getTermsOfService countryIso2: \(countryIso2), langCode: \(langCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.TermsOfService? in + let reader = BufferReader(buffer) + var result: Api.help.TermsOfService? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.help.TermsOfService + } + return result + }) + } + + public static func getDeepLinkInfo(path: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1072547679) serializeString(path, buffer: buffer, boxed: false) - return (FunctionDescription({return "(help.getDeepLinkInfo path: \(path))"}), buffer, { (buffer: Buffer) -> Api.help.DeepLinkInfo? in + return (FunctionDescription({return "(help.getDeepLinkInfo path: \(path))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.help.DeepLinkInfo? in let reader = BufferReader(buffer) var result: Api.help.DeepLinkInfo? if let signature = reader.readInt32() { @@ -3222,11 +3225,11 @@ public extension Api { } } public struct updates { - public static func getState() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.updates.State?) { + public static func getState() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-304838614) - return (FunctionDescription({return "(updates.getState )"}), buffer, { (buffer: Buffer) -> Api.updates.State? in + return (FunctionDescription({return "(updates.getState )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.State? in let reader = BufferReader(buffer) var result: Api.updates.State? if let signature = reader.readInt32() { @@ -3236,7 +3239,7 @@ public extension Api { }) } - public static func getDifference(flags: Int32, pts: Int32, ptsTotalLimit: Int32?, date: Int32, qts: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.updates.Difference?) { + public static func getDifference(flags: Int32, pts: Int32, ptsTotalLimit: Int32?, date: Int32, qts: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(630429265) serializeInt32(flags, buffer: buffer, boxed: false) @@ -3244,7 +3247,7 @@ public extension Api { if Int(flags) & Int(1 << 0) != 0 {serializeInt32(ptsTotalLimit!, buffer: buffer, boxed: false)} serializeInt32(date, buffer: buffer, boxed: false) serializeInt32(qts, buffer: buffer, boxed: false) - return (FunctionDescription({return "(updates.getDifference flags: \(flags), pts: \(pts), ptsTotalLimit: \(String(describing: ptsTotalLimit)), date: \(date), qts: \(qts))"}), buffer, { (buffer: Buffer) -> Api.updates.Difference? in + return (FunctionDescription({return "(updates.getDifference flags: \(flags), pts: \(pts), ptsTotalLimit: \(String(describing: ptsTotalLimit)), date: \(date), qts: \(qts))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.Difference? in let reader = BufferReader(buffer) var result: Api.updates.Difference? if let signature = reader.readInt32() { @@ -3254,7 +3257,7 @@ public extension Api { }) } - public static func getChannelDifference(flags: Int32, channel: Api.InputChannel, filter: Api.ChannelMessagesFilter, pts: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.updates.ChannelDifference?) { + public static func getChannelDifference(flags: Int32, channel: Api.InputChannel, filter: Api.ChannelMessagesFilter, pts: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(51854712) serializeInt32(flags, buffer: buffer, boxed: false) @@ -3262,7 +3265,7 @@ public extension Api { filter.serialize(buffer, true) serializeInt32(pts, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(updates.getChannelDifference flags: \(flags), channel: \(channel), filter: \(filter), pts: \(pts), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.updates.ChannelDifference? in + return (FunctionDescription({return "(updates.getChannelDifference flags: \(flags), channel: \(channel), filter: \(filter), pts: \(pts), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.updates.ChannelDifference? in let reader = BufferReader(buffer) var result: Api.updates.ChannelDifference? if let signature = reader.readInt32() { @@ -3273,13 +3276,13 @@ public extension Api { } } public struct upload { - public static func saveFilePart(fileId: Int64, filePart: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveFilePart(fileId: Int64, filePart: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1291540959) serializeInt64(fileId, buffer: buffer, boxed: false) serializeInt32(filePart, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.saveFilePart fileId: \(fileId), filePart: \(filePart), bytes: \(bytes))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(upload.saveFilePart fileId: \(fileId), filePart: \(filePart), bytes: \(bytes))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3289,13 +3292,13 @@ public extension Api { }) } - public static func getFile(location: Api.InputFileLocation, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.upload.File?) { + public static func getFile(location: Api.InputFileLocation, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-475607115) location.serialize(buffer, true) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.getFile location: \(location), offset: \(offset), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.upload.File? in + return (FunctionDescription({return "(upload.getFile location: \(location), offset: \(offset), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.File? in let reader = BufferReader(buffer) var result: Api.upload.File? if let signature = reader.readInt32() { @@ -3305,14 +3308,14 @@ public extension Api { }) } - public static func saveBigFilePart(fileId: Int64, filePart: Int32, fileTotalParts: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveBigFilePart(fileId: Int64, filePart: Int32, fileTotalParts: Int32, bytes: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-562337987) serializeInt64(fileId, buffer: buffer, boxed: false) serializeInt32(filePart, buffer: buffer, boxed: false) serializeInt32(fileTotalParts, buffer: buffer, boxed: false) serializeBytes(bytes, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.saveBigFilePart fileId: \(fileId), filePart: \(filePart), fileTotalParts: \(fileTotalParts), bytes: \(bytes))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(upload.saveBigFilePart fileId: \(fileId), filePart: \(filePart), fileTotalParts: \(fileTotalParts), bytes: \(bytes))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3322,13 +3325,13 @@ public extension Api { }) } - public static func getWebFile(location: Api.InputWebFileLocation, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.upload.WebFile?) { + public static func getWebFile(location: Api.InputWebFileLocation, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(619086221) location.serialize(buffer, true) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.getWebFile location: \(location), offset: \(offset), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.upload.WebFile? in + return (FunctionDescription({return "(upload.getWebFile location: \(location), offset: \(offset), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.WebFile? in let reader = BufferReader(buffer) var result: Api.upload.WebFile? if let signature = reader.readInt32() { @@ -3338,13 +3341,13 @@ public extension Api { }) } - public static func getCdnFile(fileToken: Buffer, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.upload.CdnFile?) { + public static func getCdnFile(fileToken: Buffer, offset: Int32, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(536919235) serializeBytes(fileToken, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.getCdnFile fileToken: \(fileToken), offset: \(offset), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.upload.CdnFile? in + return (FunctionDescription({return "(upload.getCdnFile fileToken: \(fileToken), offset: \(offset), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.upload.CdnFile? in let reader = BufferReader(buffer) var result: Api.upload.CdnFile? if let signature = reader.readInt32() { @@ -3354,12 +3357,12 @@ public extension Api { }) } - public static func reuploadCdnFile(fileToken: Buffer, requestToken: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.FileHash]?) { + public static func reuploadCdnFile(fileToken: Buffer, requestToken: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) { let buffer = Buffer() buffer.appendInt32(-1691921240) serializeBytes(fileToken, buffer: buffer, boxed: false) serializeBytes(requestToken, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.reuploadCdnFile fileToken: \(fileToken), requestToken: \(requestToken))"}), buffer, { (buffer: Buffer) -> [Api.FileHash]? in + return (FunctionDescription({return "(upload.reuploadCdnFile fileToken: \(fileToken), requestToken: \(requestToken))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in let reader = BufferReader(buffer) var result: [Api.FileHash]? if let _ = reader.readInt32() { @@ -3369,12 +3372,12 @@ public extension Api { }) } - public static func getCdnFileHashes(fileToken: Buffer, offset: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.FileHash]?) { + public static func getCdnFileHashes(fileToken: Buffer, offset: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) { let buffer = Buffer() buffer.appendInt32(1302676017) serializeBytes(fileToken, buffer: buffer, boxed: false) serializeInt32(offset, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.getCdnFileHashes fileToken: \(fileToken), offset: \(offset))"}), buffer, { (buffer: Buffer) -> [Api.FileHash]? in + return (FunctionDescription({return "(upload.getCdnFileHashes fileToken: \(fileToken), offset: \(offset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in let reader = BufferReader(buffer) var result: [Api.FileHash]? if let _ = reader.readInt32() { @@ -3384,12 +3387,12 @@ public extension Api { }) } - public static func getFileHashes(location: Api.InputFileLocation, offset: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.FileHash]?) { + public static func getFileHashes(location: Api.InputFileLocation, offset: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.FileHash]>) { let buffer = Buffer() buffer.appendInt32(-956147407) location.serialize(buffer, true) serializeInt32(offset, buffer: buffer, boxed: false) - return (FunctionDescription({return "(upload.getFileHashes location: \(location), offset: \(offset))"}), buffer, { (buffer: Buffer) -> [Api.FileHash]? in + return (FunctionDescription({return "(upload.getFileHashes location: \(location), offset: \(offset))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.FileHash]? in let reader = BufferReader(buffer) var result: [Api.FileHash]? if let _ = reader.readInt32() { @@ -3400,12 +3403,12 @@ public extension Api { } } public struct account { - public static func updateNotifySettings(peer: Api.InputNotifyPeer, settings: Api.InputPeerNotifySettings) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func updateNotifySettings(peer: Api.InputNotifyPeer, settings: Api.InputPeerNotifySettings) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2067899501) peer.serialize(buffer, true) settings.serialize(buffer, true) - return (FunctionDescription({return "(account.updateNotifySettings peer: \(peer), settings: \(settings))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.updateNotifySettings peer: \(peer), settings: \(settings))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3415,11 +3418,11 @@ public extension Api { }) } - public static func getNotifySettings(peer: Api.InputNotifyPeer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.PeerNotifySettings?) { + public static func getNotifySettings(peer: Api.InputNotifyPeer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(313765169) peer.serialize(buffer, true) - return (FunctionDescription({return "(account.getNotifySettings peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.PeerNotifySettings? in + return (FunctionDescription({return "(account.getNotifySettings peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.PeerNotifySettings? in let reader = BufferReader(buffer) var result: Api.PeerNotifySettings? if let signature = reader.readInt32() { @@ -3429,11 +3432,11 @@ public extension Api { }) } - public static func resetNotifySettings() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetNotifySettings() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-612493497) - return (FunctionDescription({return "(account.resetNotifySettings )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.resetNotifySettings )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3443,14 +3446,14 @@ public extension Api { }) } - public static func updateProfile(flags: Int32, firstName: String?, lastName: String?, about: String?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.User?) { + public static func updateProfile(flags: Int32, firstName: String?, lastName: String?, about: String?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2018596725) serializeInt32(flags, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {serializeString(firstName!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 1) != 0 {serializeString(lastName!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 2) != 0 {serializeString(about!, buffer: buffer, boxed: false)} - return (FunctionDescription({return "(account.updateProfile flags: \(flags), firstName: \(String(describing: firstName)), lastName: \(String(describing: lastName)), about: \(String(describing: about)))"}), buffer, { (buffer: Buffer) -> Api.User? in + return (FunctionDescription({return "(account.updateProfile flags: \(flags), firstName: \(String(describing: firstName)), lastName: \(String(describing: lastName)), about: \(String(describing: about)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in let reader = BufferReader(buffer) var result: Api.User? if let signature = reader.readInt32() { @@ -3460,11 +3463,11 @@ public extension Api { }) } - public static func updateStatus(offline: Api.Bool) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func updateStatus(offline: Api.Bool) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1713919532) offline.serialize(buffer, true) - return (FunctionDescription({return "(account.updateStatus offline: \(offline))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.updateStatus offline: \(offline))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3474,11 +3477,11 @@ public extension Api { }) } - public static func getWallPapers() -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.WallPaper]?) { + public static func getWallPapers() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.WallPaper]>) { let buffer = Buffer() buffer.appendInt32(-1068696894) - return (FunctionDescription({return "(account.getWallPapers )"}), buffer, { (buffer: Buffer) -> [Api.WallPaper]? in + return (FunctionDescription({return "(account.getWallPapers )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.WallPaper]? in let reader = BufferReader(buffer) var result: [Api.WallPaper]? if let _ = reader.readInt32() { @@ -3488,12 +3491,12 @@ public extension Api { }) } - public static func reportPeer(peer: Api.InputPeer, reason: Api.ReportReason) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func reportPeer(peer: Api.InputPeer, reason: Api.ReportReason) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1374118561) peer.serialize(buffer, true) reason.serialize(buffer, true) - return (FunctionDescription({return "(account.reportPeer peer: \(peer), reason: \(reason))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.reportPeer peer: \(peer), reason: \(reason))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3503,11 +3506,11 @@ public extension Api { }) } - public static func checkUsername(username: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func checkUsername(username: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(655677548) serializeString(username, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.checkUsername username: \(username))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.checkUsername username: \(username))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3517,11 +3520,11 @@ public extension Api { }) } - public static func updateUsername(username: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.User?) { + public static func updateUsername(username: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1040964988) serializeString(username, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.updateUsername username: \(username))"}), buffer, { (buffer: Buffer) -> Api.User? in + return (FunctionDescription({return "(account.updateUsername username: \(username))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in let reader = BufferReader(buffer) var result: Api.User? if let signature = reader.readInt32() { @@ -3531,11 +3534,11 @@ public extension Api { }) } - public static func getPrivacy(key: Api.InputPrivacyKey) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.PrivacyRules?) { + public static func getPrivacy(key: Api.InputPrivacyKey) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-623130288) key.serialize(buffer, true) - return (FunctionDescription({return "(account.getPrivacy key: \(key))"}), buffer, { (buffer: Buffer) -> Api.account.PrivacyRules? in + return (FunctionDescription({return "(account.getPrivacy key: \(key))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PrivacyRules? in let reader = BufferReader(buffer) var result: Api.account.PrivacyRules? if let signature = reader.readInt32() { @@ -3545,7 +3548,7 @@ public extension Api { }) } - public static func setPrivacy(key: Api.InputPrivacyKey, rules: [Api.InputPrivacyRule]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.PrivacyRules?) { + public static func setPrivacy(key: Api.InputPrivacyKey, rules: [Api.InputPrivacyRule]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-906486552) key.serialize(buffer, true) @@ -3554,7 +3557,7 @@ public extension Api { for item in rules { item.serialize(buffer, true) } - return (FunctionDescription({return "(account.setPrivacy key: \(key), rules: \(rules))"}), buffer, { (buffer: Buffer) -> Api.account.PrivacyRules? in + return (FunctionDescription({return "(account.setPrivacy key: \(key), rules: \(rules))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PrivacyRules? in let reader = BufferReader(buffer) var result: Api.account.PrivacyRules? if let signature = reader.readInt32() { @@ -3564,11 +3567,11 @@ public extension Api { }) } - public static func deleteAccount(reason: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func deleteAccount(reason: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1099779595) serializeString(reason, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.deleteAccount reason: \(reason))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.deleteAccount reason: \(reason))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3578,11 +3581,11 @@ public extension Api { }) } - public static func getAccountTTL() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.AccountDaysTTL?) { + public static func getAccountTTL() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(150761757) - return (FunctionDescription({return "(account.getAccountTTL )"}), buffer, { (buffer: Buffer) -> Api.AccountDaysTTL? in + return (FunctionDescription({return "(account.getAccountTTL )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.AccountDaysTTL? in let reader = BufferReader(buffer) var result: Api.AccountDaysTTL? if let signature = reader.readInt32() { @@ -3592,11 +3595,11 @@ public extension Api { }) } - public static func setAccountTTL(ttl: Api.AccountDaysTTL) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func setAccountTTL(ttl: Api.AccountDaysTTL) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(608323678) ttl.serialize(buffer, true) - return (FunctionDescription({return "(account.setAccountTTL ttl: \(ttl))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.setAccountTTL ttl: \(ttl))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3606,13 +3609,13 @@ public extension Api { }) } - public static func sendChangePhoneCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.SentCode?) { + public static func sendChangePhoneCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(149257707) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(phoneNumber, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {currentNumber!.serialize(buffer, true)} - return (FunctionDescription({return "(account.sendChangePhoneCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)))"}), buffer, { (buffer: Buffer) -> Api.auth.SentCode? in + return (FunctionDescription({return "(account.sendChangePhoneCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in let reader = BufferReader(buffer) var result: Api.auth.SentCode? if let signature = reader.readInt32() { @@ -3622,13 +3625,13 @@ public extension Api { }) } - public static func changePhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.User?) { + public static func changePhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1891839707) serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(phoneCodeHash, buffer: buffer, boxed: false) serializeString(phoneCode, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.changePhone phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, { (buffer: Buffer) -> Api.User? in + return (FunctionDescription({return "(account.changePhone phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.User? in let reader = BufferReader(buffer) var result: Api.User? if let signature = reader.readInt32() { @@ -3638,11 +3641,11 @@ public extension Api { }) } - public static func updateDeviceLocked(period: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func updateDeviceLocked(period: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(954152242) serializeInt32(period, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.updateDeviceLocked period: \(period))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.updateDeviceLocked period: \(period))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3652,11 +3655,11 @@ public extension Api { }) } - public static func getAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.Authorizations?) { + public static func getAuthorizations() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-484392616) - return (FunctionDescription({return "(account.getAuthorizations )"}), buffer, { (buffer: Buffer) -> Api.account.Authorizations? in + return (FunctionDescription({return "(account.getAuthorizations )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Authorizations? in let reader = BufferReader(buffer) var result: Api.account.Authorizations? if let signature = reader.readInt32() { @@ -3666,11 +3669,11 @@ public extension Api { }) } - public static func resetAuthorization(hash: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetAuthorization(hash: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-545786948) serializeInt64(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.resetAuthorization hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.resetAuthorization hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3680,11 +3683,11 @@ public extension Api { }) } - public static func getPassword() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.Password?) { + public static func getPassword() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1418342645) - return (FunctionDescription({return "(account.getPassword )"}), buffer, { (buffer: Buffer) -> Api.account.Password? in + return (FunctionDescription({return "(account.getPassword )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.Password? in let reader = BufferReader(buffer) var result: Api.account.Password? if let signature = reader.readInt32() { @@ -3694,11 +3697,11 @@ public extension Api { }) } - public static func getPasswordSettings(currentPasswordHash: Buffer) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.PasswordSettings?) { + public static func getPasswordSettings(currentPasswordHash: Buffer) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1131605573) serializeBytes(currentPasswordHash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.getPasswordSettings currentPasswordHash: \(currentPasswordHash))"}), buffer, { (buffer: Buffer) -> Api.account.PasswordSettings? in + return (FunctionDescription({return "(account.getPasswordSettings currentPasswordHash: \(currentPasswordHash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.PasswordSettings? in let reader = BufferReader(buffer) var result: Api.account.PasswordSettings? if let signature = reader.readInt32() { @@ -3708,12 +3711,12 @@ public extension Api { }) } - public static func updatePasswordSettings(currentPasswordHash: Buffer, newSettings: Api.account.PasswordInputSettings) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func updatePasswordSettings(currentPasswordHash: Buffer, newSettings: Api.account.PasswordInputSettings) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-92517498) serializeBytes(currentPasswordHash, buffer: buffer, boxed: false) newSettings.serialize(buffer, true) - return (FunctionDescription({return "(account.updatePasswordSettings currentPasswordHash: \(currentPasswordHash), newSettings: \(newSettings))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.updatePasswordSettings currentPasswordHash: \(currentPasswordHash), newSettings: \(newSettings))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3723,13 +3726,13 @@ public extension Api { }) } - public static func sendConfirmPhoneCode(flags: Int32, hash: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.SentCode?) { + public static func sendConfirmPhoneCode(flags: Int32, hash: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(353818557) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(hash, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {currentNumber!.serialize(buffer, true)} - return (FunctionDescription({return "(account.sendConfirmPhoneCode flags: \(flags), hash: \(hash), currentNumber: \(String(describing: currentNumber)))"}), buffer, { (buffer: Buffer) -> Api.auth.SentCode? in + return (FunctionDescription({return "(account.sendConfirmPhoneCode flags: \(flags), hash: \(hash), currentNumber: \(String(describing: currentNumber)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in let reader = BufferReader(buffer) var result: Api.auth.SentCode? if let signature = reader.readInt32() { @@ -3739,12 +3742,12 @@ public extension Api { }) } - public static func confirmPhone(phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func confirmPhone(phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1596029123) serializeString(phoneCodeHash, buffer: buffer, boxed: false) serializeString(phoneCode, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.confirmPhone phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.confirmPhone phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3754,12 +3757,12 @@ public extension Api { }) } - public static func getTmpPassword(passwordHash: Buffer, period: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.TmpPassword?) { + public static func getTmpPassword(passwordHash: Buffer, period: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1250046590) serializeBytes(passwordHash, buffer: buffer, boxed: false) serializeInt32(period, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.getTmpPassword passwordHash: \(passwordHash), period: \(period))"}), buffer, { (buffer: Buffer) -> Api.account.TmpPassword? in + return (FunctionDescription({return "(account.getTmpPassword passwordHash: \(passwordHash), period: \(period))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.TmpPassword? in let reader = BufferReader(buffer) var result: Api.account.TmpPassword? if let signature = reader.readInt32() { @@ -3769,7 +3772,7 @@ public extension Api { }) } - public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func unregisterDevice(tokenType: Int32, token: String, otherUids: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(813089983) serializeInt32(tokenType, buffer: buffer, boxed: false) @@ -3779,7 +3782,7 @@ public extension Api { for item in otherUids { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(account.unregisterDevice tokenType: \(tokenType), token: \(token), otherUids: \(otherUids))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.unregisterDevice tokenType: \(tokenType), token: \(token), otherUids: \(otherUids))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3789,11 +3792,11 @@ public extension Api { }) } - public static func getWebAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.WebAuthorizations?) { + public static func getWebAuthorizations() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(405695855) - return (FunctionDescription({return "(account.getWebAuthorizations )"}), buffer, { (buffer: Buffer) -> Api.account.WebAuthorizations? in + return (FunctionDescription({return "(account.getWebAuthorizations )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.WebAuthorizations? in let reader = BufferReader(buffer) var result: Api.account.WebAuthorizations? if let signature = reader.readInt32() { @@ -3803,11 +3806,11 @@ public extension Api { }) } - public static func resetWebAuthorization(hash: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetWebAuthorization(hash: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(755087855) serializeInt64(hash, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.resetWebAuthorization hash: \(hash))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.resetWebAuthorization hash: \(hash))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3817,11 +3820,11 @@ public extension Api { }) } - public static func resetWebAuthorizations() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func resetWebAuthorizations() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1747789204) - return (FunctionDescription({return "(account.resetWebAuthorizations )"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.resetWebAuthorizations )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3831,7 +3834,7 @@ public extension Api { }) } - public static func registerDevice(tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func registerDevice(tokenType: Int32, token: String, appSandbox: Api.Bool, secret: Buffer, otherUids: [Int32]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1555998096) serializeInt32(tokenType, buffer: buffer, boxed: false) @@ -3843,7 +3846,7 @@ public extension Api { for item in otherUids { serializeInt32(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(account.registerDevice tokenType: \(tokenType), token: \(token), appSandbox: \(appSandbox), secret: \(secret), otherUids: \(otherUids))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.registerDevice tokenType: \(tokenType), token: \(token), appSandbox: \(appSandbox), secret: \(secret), otherUids: \(otherUids))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3853,11 +3856,11 @@ public extension Api { }) } - public static func getAllSecureValues() -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.SecureValue]?) { + public static func getAllSecureValues() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) { let buffer = Buffer() buffer.appendInt32(-1299661699) - return (FunctionDescription({return "(account.getAllSecureValues )"}), buffer, { (buffer: Buffer) -> [Api.SecureValue]? in + return (FunctionDescription({return "(account.getAllSecureValues )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in let reader = BufferReader(buffer) var result: [Api.SecureValue]? if let _ = reader.readInt32() { @@ -3867,7 +3870,7 @@ public extension Api { }) } - public static func getSecureValue(types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.SecureValue]?) { + public static func getSecureValue(types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.SecureValue]>) { let buffer = Buffer() buffer.appendInt32(1936088002) buffer.appendInt32(481674261) @@ -3875,7 +3878,7 @@ public extension Api { for item in types { item.serialize(buffer, true) } - return (FunctionDescription({return "(account.getSecureValue types: \(types))"}), buffer, { (buffer: Buffer) -> [Api.SecureValue]? in + return (FunctionDescription({return "(account.getSecureValue types: \(types))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.SecureValue]? in let reader = BufferReader(buffer) var result: [Api.SecureValue]? if let _ = reader.readInt32() { @@ -3885,12 +3888,12 @@ public extension Api { }) } - public static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.SecureValue?) { + public static func saveSecureValue(value: Api.InputSecureValue, secureSecretId: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1986010339) value.serialize(buffer, true) serializeInt64(secureSecretId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.saveSecureValue value: \(value), secureSecretId: \(secureSecretId))"}), buffer, { (buffer: Buffer) -> Api.SecureValue? in + return (FunctionDescription({return "(account.saveSecureValue value: \(value), secureSecretId: \(secureSecretId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.SecureValue? in let reader = BufferReader(buffer) var result: Api.SecureValue? if let signature = reader.readInt32() { @@ -3900,7 +3903,7 @@ public extension Api { }) } - public static func deleteSecureValue(types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func deleteSecureValue(types: [Api.SecureValueType]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1199522741) buffer.appendInt32(481674261) @@ -3908,7 +3911,7 @@ public extension Api { for item in types { item.serialize(buffer, true) } - return (FunctionDescription({return "(account.deleteSecureValue types: \(types))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.deleteSecureValue types: \(types))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3918,13 +3921,13 @@ public extension Api { }) } - public static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.AuthorizationForm?) { + public static func getAuthorizationForm(botId: Int32, scope: String, publicKey: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1200903967) serializeInt32(botId, buffer: buffer, boxed: false) serializeString(scope, buffer: buffer, boxed: false) serializeString(publicKey, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.getAuthorizationForm botId: \(botId), scope: \(scope), publicKey: \(publicKey))"}), buffer, { (buffer: Buffer) -> Api.account.AuthorizationForm? in + return (FunctionDescription({return "(account.getAuthorizationForm botId: \(botId), scope: \(scope), publicKey: \(publicKey))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.AuthorizationForm? in let reader = BufferReader(buffer) var result: Api.account.AuthorizationForm? if let signature = reader.readInt32() { @@ -3934,7 +3937,7 @@ public extension Api { }) } - public static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func acceptAuthorization(botId: Int32, scope: String, publicKey: String, valueHashes: [Api.SecureValueHash], credentials: Api.SecureCredentialsEncrypted) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-419267436) serializeInt32(botId, buffer: buffer, boxed: false) @@ -3946,7 +3949,7 @@ public extension Api { item.serialize(buffer, true) } credentials.serialize(buffer, true) - return (FunctionDescription({return "(account.acceptAuthorization botId: \(botId), scope: \(scope), publicKey: \(publicKey), valueHashes: \(valueHashes), credentials: \(credentials))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.acceptAuthorization botId: \(botId), scope: \(scope), publicKey: \(publicKey), valueHashes: \(valueHashes), credentials: \(credentials))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3956,13 +3959,13 @@ public extension Api { }) } - public static func sendVerifyPhoneCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.auth.SentCode?) { + public static func sendVerifyPhoneCode(flags: Int32, phoneNumber: String, currentNumber: Api.Bool?) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-2110553932) serializeInt32(flags, buffer: buffer, boxed: false) serializeString(phoneNumber, buffer: buffer, boxed: false) if Int(flags) & Int(1 << 0) != 0 {currentNumber!.serialize(buffer, true)} - return (FunctionDescription({return "(account.sendVerifyPhoneCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)))"}), buffer, { (buffer: Buffer) -> Api.auth.SentCode? in + return (FunctionDescription({return "(account.sendVerifyPhoneCode flags: \(flags), phoneNumber: \(phoneNumber), currentNumber: \(String(describing: currentNumber)))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.auth.SentCode? in let reader = BufferReader(buffer) var result: Api.auth.SentCode? if let signature = reader.readInt32() { @@ -3972,13 +3975,13 @@ public extension Api { }) } - public static func verifyPhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func verifyPhone(phoneNumber: String, phoneCodeHash: String, phoneCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1305716726) serializeString(phoneNumber, buffer: buffer, boxed: false) serializeString(phoneCodeHash, buffer: buffer, boxed: false) serializeString(phoneCode, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.verifyPhone phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.verifyPhone phoneNumber: \(phoneNumber), phoneCodeHash: \(phoneCodeHash), phoneCode: \(phoneCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -3988,11 +3991,11 @@ public extension Api { }) } - public static func sendVerifyEmailCode(email: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.account.SentEmailCode?) { + public static func sendVerifyEmailCode(email: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1880182943) serializeString(email, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.sendVerifyEmailCode email: \(email))"}), buffer, { (buffer: Buffer) -> Api.account.SentEmailCode? in + return (FunctionDescription({return "(account.sendVerifyEmailCode email: \(email))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.account.SentEmailCode? in let reader = BufferReader(buffer) var result: Api.account.SentEmailCode? if let signature = reader.readInt32() { @@ -4002,12 +4005,12 @@ public extension Api { }) } - public static func verifyEmail(email: String, code: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func verifyEmail(email: String, code: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-323339813) serializeString(email, buffer: buffer, boxed: false) serializeString(code, buffer: buffer, boxed: false) - return (FunctionDescription({return "(account.verifyEmail email: \(email), code: \(code))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(account.verifyEmail email: \(email), code: \(code))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -4018,11 +4021,11 @@ public extension Api { } } public struct langpack { - public static func getLangPack(langCode: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.LangPackDifference?) { + public static func getLangPack(langCode: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1699363442) serializeString(langCode, buffer: buffer, boxed: false) - return (FunctionDescription({return "(langpack.getLangPack langCode: \(langCode))"}), buffer, { (buffer: Buffer) -> Api.LangPackDifference? in + return (FunctionDescription({return "(langpack.getLangPack langCode: \(langCode))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.LangPackDifference? in let reader = BufferReader(buffer) var result: Api.LangPackDifference? if let signature = reader.readInt32() { @@ -4032,7 +4035,7 @@ public extension Api { }) } - public static func getStrings(langCode: String, keys: [String]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.LangPackString]?) { + public static func getStrings(langCode: String, keys: [String]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.LangPackString]>) { let buffer = Buffer() buffer.appendInt32(773776152) serializeString(langCode, buffer: buffer, boxed: false) @@ -4041,7 +4044,7 @@ public extension Api { for item in keys { serializeString(item, buffer: buffer, boxed: false) } - return (FunctionDescription({return "(langpack.getStrings langCode: \(langCode), keys: \(keys))"}), buffer, { (buffer: Buffer) -> [Api.LangPackString]? in + return (FunctionDescription({return "(langpack.getStrings langCode: \(langCode), keys: \(keys))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.LangPackString]? in let reader = BufferReader(buffer) var result: [Api.LangPackString]? if let _ = reader.readInt32() { @@ -4051,11 +4054,11 @@ public extension Api { }) } - public static func getDifference(fromVersion: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.LangPackDifference?) { + public static func getDifference(fromVersion: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(187583869) serializeInt32(fromVersion, buffer: buffer, boxed: false) - return (FunctionDescription({return "(langpack.getDifference fromVersion: \(fromVersion))"}), buffer, { (buffer: Buffer) -> Api.LangPackDifference? in + return (FunctionDescription({return "(langpack.getDifference fromVersion: \(fromVersion))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.LangPackDifference? in let reader = BufferReader(buffer) var result: Api.LangPackDifference? if let signature = reader.readInt32() { @@ -4065,11 +4068,11 @@ public extension Api { }) } - public static func getLanguages() -> (CustomStringConvertible, Buffer, (Buffer) -> [Api.LangPackLanguage]?) { + public static func getLanguages() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Api.LangPackLanguage]>) { let buffer = Buffer() buffer.appendInt32(-2146445955) - return (FunctionDescription({return "(langpack.getLanguages )"}), buffer, { (buffer: Buffer) -> [Api.LangPackLanguage]? in + return (FunctionDescription({return "(langpack.getLanguages )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.LangPackLanguage]? in let reader = BufferReader(buffer) var result: [Api.LangPackLanguage]? if let _ = reader.readInt32() { @@ -4080,11 +4083,11 @@ public extension Api { } } public struct photos { - public static func updateProfilePhoto(id: Api.InputPhoto) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.UserProfilePhoto?) { + public static func updateProfilePhoto(id: Api.InputPhoto) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-256159406) id.serialize(buffer, true) - return (FunctionDescription({return "(photos.updateProfilePhoto id: \(id))"}), buffer, { (buffer: Buffer) -> Api.UserProfilePhoto? in + return (FunctionDescription({return "(photos.updateProfilePhoto id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.UserProfilePhoto? in let reader = BufferReader(buffer) var result: Api.UserProfilePhoto? if let signature = reader.readInt32() { @@ -4094,11 +4097,11 @@ public extension Api { }) } - public static func uploadProfilePhoto(file: Api.InputFile) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.photos.Photo?) { + public static func uploadProfilePhoto(file: Api.InputFile) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1328726168) file.serialize(buffer, true) - return (FunctionDescription({return "(photos.uploadProfilePhoto file: \(file))"}), buffer, { (buffer: Buffer) -> Api.photos.Photo? in + return (FunctionDescription({return "(photos.uploadProfilePhoto file: \(file))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photo? in let reader = BufferReader(buffer) var result: Api.photos.Photo? if let signature = reader.readInt32() { @@ -4108,7 +4111,7 @@ public extension Api { }) } - public static func deletePhotos(id: [Api.InputPhoto]) -> (CustomStringConvertible, Buffer, (Buffer) -> [Int64]?) { + public static func deletePhotos(id: [Api.InputPhoto]) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse<[Int64]>) { let buffer = Buffer() buffer.appendInt32(-2016444625) buffer.appendInt32(481674261) @@ -4116,7 +4119,7 @@ public extension Api { for item in id { item.serialize(buffer, true) } - return (FunctionDescription({return "(photos.deletePhotos id: \(id))"}), buffer, { (buffer: Buffer) -> [Int64]? in + return (FunctionDescription({return "(photos.deletePhotos id: \(id))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Int64]? in let reader = BufferReader(buffer) var result: [Int64]? if let _ = reader.readInt32() { @@ -4126,14 +4129,14 @@ public extension Api { }) } - public static func getUserPhotos(userId: Api.InputUser, offset: Int32, maxId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.photos.Photos?) { + public static func getUserPhotos(userId: Api.InputUser, offset: Int32, maxId: Int64, limit: Int32) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(-1848823128) userId.serialize(buffer, true) serializeInt32(offset, buffer: buffer, boxed: false) serializeInt64(maxId, buffer: buffer, boxed: false) serializeInt32(limit, buffer: buffer, boxed: false) - return (FunctionDescription({return "(photos.getUserPhotos userId: \(userId), offset: \(offset), maxId: \(maxId), limit: \(limit))"}), buffer, { (buffer: Buffer) -> Api.photos.Photos? in + return (FunctionDescription({return "(photos.getUserPhotos userId: \(userId), offset: \(offset), maxId: \(maxId), limit: \(limit))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.photos.Photos? in let reader = BufferReader(buffer) var result: Api.photos.Photos? if let signature = reader.readInt32() { @@ -4144,11 +4147,11 @@ public extension Api { } } public struct phone { - public static func getCallConfig() -> (CustomStringConvertible, Buffer, (Buffer) -> Api.DataJSON?) { + public static func getCallConfig() -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1430593449) - return (FunctionDescription({return "(phone.getCallConfig )"}), buffer, { (buffer: Buffer) -> Api.DataJSON? in + return (FunctionDescription({return "(phone.getCallConfig )"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.DataJSON? in let reader = BufferReader(buffer) var result: Api.DataJSON? if let signature = reader.readInt32() { @@ -4158,14 +4161,14 @@ public extension Api { }) } - public static func requestCall(userId: Api.InputUser, randomId: Int32, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.phone.PhoneCall?) { + public static func requestCall(userId: Api.InputUser, randomId: Int32, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1536537556) userId.serialize(buffer, true) serializeInt32(randomId, buffer: buffer, boxed: false) serializeBytes(gAHash, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) - return (FunctionDescription({return "(phone.requestCall userId: \(userId), randomId: \(randomId), gAHash: \(gAHash), `protocol`: \(`protocol`))"}), buffer, { (buffer: Buffer) -> Api.phone.PhoneCall? in + return (FunctionDescription({return "(phone.requestCall userId: \(userId), randomId: \(randomId), gAHash: \(gAHash), `protocol`: \(`protocol`))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in let reader = BufferReader(buffer) var result: Api.phone.PhoneCall? if let signature = reader.readInt32() { @@ -4175,13 +4178,13 @@ public extension Api { }) } - public static func acceptCall(peer: Api.InputPhoneCall, gB: Buffer, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.phone.PhoneCall?) { + public static func acceptCall(peer: Api.InputPhoneCall, gB: Buffer, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(1003664544) peer.serialize(buffer, true) serializeBytes(gB, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) - return (FunctionDescription({return "(phone.acceptCall peer: \(peer), gB: \(gB), `protocol`: \(`protocol`))"}), buffer, { (buffer: Buffer) -> Api.phone.PhoneCall? in + return (FunctionDescription({return "(phone.acceptCall peer: \(peer), gB: \(gB), `protocol`: \(`protocol`))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in let reader = BufferReader(buffer) var result: Api.phone.PhoneCall? if let signature = reader.readInt32() { @@ -4191,14 +4194,14 @@ public extension Api { }) } - public static func confirmCall(peer: Api.InputPhoneCall, gA: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.phone.PhoneCall?) { + public static func confirmCall(peer: Api.InputPhoneCall, gA: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(788404002) peer.serialize(buffer, true) serializeBytes(gA, buffer: buffer, boxed: false) serializeInt64(keyFingerprint, buffer: buffer, boxed: false) `protocol`.serialize(buffer, true) - return (FunctionDescription({return "(phone.confirmCall peer: \(peer), gA: \(gA), keyFingerprint: \(keyFingerprint), `protocol`: \(`protocol`))"}), buffer, { (buffer: Buffer) -> Api.phone.PhoneCall? in + return (FunctionDescription({return "(phone.confirmCall peer: \(peer), gA: \(gA), keyFingerprint: \(keyFingerprint), `protocol`: \(`protocol`))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.phone.PhoneCall? in let reader = BufferReader(buffer) var result: Api.phone.PhoneCall? if let signature = reader.readInt32() { @@ -4208,11 +4211,11 @@ public extension Api { }) } - public static func receivedCall(peer: Api.InputPhoneCall) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func receivedCall(peer: Api.InputPhoneCall) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(399855457) peer.serialize(buffer, true) - return (FunctionDescription({return "(phone.receivedCall peer: \(peer))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(phone.receivedCall peer: \(peer))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { @@ -4222,14 +4225,14 @@ public extension Api { }) } - public static func discardCall(peer: Api.InputPhoneCall, duration: Int32, reason: Api.PhoneCallDiscardReason, connectionId: Int64) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func discardCall(peer: Api.InputPhoneCall, duration: Int32, reason: Api.PhoneCallDiscardReason, connectionId: Int64) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(2027164582) peer.serialize(buffer, true) serializeInt32(duration, buffer: buffer, boxed: false) reason.serialize(buffer, true) serializeInt64(connectionId, buffer: buffer, boxed: false) - return (FunctionDescription({return "(phone.discardCall peer: \(peer), duration: \(duration), reason: \(reason), connectionId: \(connectionId))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(phone.discardCall peer: \(peer), duration: \(duration), reason: \(reason), connectionId: \(connectionId))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -4239,13 +4242,13 @@ public extension Api { }) } - public static func setCallRating(peer: Api.InputPhoneCall, rating: Int32, comment: String) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Updates?) { + public static func setCallRating(peer: Api.InputPhoneCall, rating: Int32, comment: String) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(475228724) peer.serialize(buffer, true) serializeInt32(rating, buffer: buffer, boxed: false) serializeString(comment, buffer: buffer, boxed: false) - return (FunctionDescription({return "(phone.setCallRating peer: \(peer), rating: \(rating), comment: \(comment))"}), buffer, { (buffer: Buffer) -> Api.Updates? in + return (FunctionDescription({return "(phone.setCallRating peer: \(peer), rating: \(rating), comment: \(comment))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Updates? in let reader = BufferReader(buffer) var result: Api.Updates? if let signature = reader.readInt32() { @@ -4255,12 +4258,12 @@ public extension Api { }) } - public static func saveCallDebug(peer: Api.InputPhoneCall, debug: Api.DataJSON) -> (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) { + public static func saveCallDebug(peer: Api.InputPhoneCall, debug: Api.DataJSON) -> (CustomStringConvertible, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() buffer.appendInt32(662363518) peer.serialize(buffer, true) debug.serialize(buffer, true) - return (FunctionDescription({return "(phone.saveCallDebug peer: \(peer), debug: \(debug))"}), buffer, { (buffer: Buffer) -> Api.Bool? in + return (FunctionDescription({return "(phone.saveCallDebug peer: \(peer), debug: \(debug))"}), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.Bool? in let reader = BufferReader(buffer) var result: Api.Bool? if let signature = reader.readInt32() { diff --git a/TelegramCore/CallSessionManager.swift b/TelegramCore/CallSessionManager.swift index 92c25d3b36..3e6a66d5df 100644 --- a/TelegramCore/CallSessionManager.swift +++ b/TelegramCore/CallSessionManager.swift @@ -328,38 +328,52 @@ private final class CallSessionManagerContext { var dropData: (CallSessionStableId, Int64, DropCallSessionReason)? var wasRinging = false switch context.state { - case let .ringing(id, accessHash, _, _): - wasRinging = true - dropData = (id, accessHash, .busy) - case let .accepting(id, accessHash, _, _, disposable): - dropData = (id, accessHash, .abort) - disposable.dispose() - case let .active(id, accessHash, beginTimestamp, _, _, _, _, _): - let duration = max(0, Int32(CFAbsoluteTimeGetCurrent()) - beginTimestamp) - let internalReason: DropCallSessionReason - switch reason { - case .busy, .hangUp: - internalReason = .hangUp(duration) - case .disconnect: - internalReason = .disconnect - } - dropData = (id, accessHash, internalReason) - case .dropping, .terminated: - break - case let .awaitingConfirmation(id, accessHash, _, _, _): - dropData = (id, accessHash, .abort) - case let .confirming(id, accessHash, _, _, _, disposable): - disposable.dispose() - dropData = (id, accessHash, .abort) - case let .requested(id, accessHash, _, _, _, _): - dropData = (id, accessHash, .busy) - case let .requesting(_, disposable): - disposable.dispose() - context.state = .terminated(reason: .ended(.hungUp), reportRating: nil) - self.contextUpdated(internalId: internalId) - if context.isEmpty { - self.contexts.removeValue(forKey: internalId) - } + case let .ringing(id, accessHash, _, _): + wasRinging = true + let internalReason: DropCallSessionReason + switch reason { + case .busy, .hangUp: + internalReason = .hangUp(0) + case .disconnect: + internalReason = .disconnect + } + dropData = (id, accessHash, internalReason) + case let .accepting(id, accessHash, _, _, disposable): + dropData = (id, accessHash, .abort) + disposable.dispose() + case let .active(id, accessHash, beginTimestamp, _, _, _, _, _): + let duration = max(0, Int32(CFAbsoluteTimeGetCurrent()) - beginTimestamp) + let internalReason: DropCallSessionReason + switch reason { + case .busy, .hangUp: + internalReason = .hangUp(duration) + case .disconnect: + internalReason = .disconnect + } + dropData = (id, accessHash, internalReason) + case .dropping, .terminated: + break + case let .awaitingConfirmation(id, accessHash, _, _, _): + dropData = (id, accessHash, .abort) + case let .confirming(id, accessHash, _, _, _, disposable): + disposable.dispose() + dropData = (id, accessHash, .abort) + case let .requested(id, accessHash, _, _, _, _): + let internalReason: DropCallSessionReason + switch reason { + case .busy, .hangUp: + internalReason = .hangUp(0) + case .disconnect: + internalReason = .disconnect + } + dropData = (id, accessHash, internalReason) + case let .requesting(_, disposable): + disposable.dispose() + context.state = .terminated(reason: .ended(.hungUp), reportRating: nil) + self.contextUpdated(internalId: internalId) + if context.isEmpty { + self.contexts.removeValue(forKey: internalId) + } } if let (id, accessHash, reason) = dropData { @@ -892,15 +906,15 @@ private func dropCallSession(network: Network, addUpdates: @escaping (Api.Update var mappedReason: Api.PhoneCallDiscardReason var duration: Int32 = 0 switch reason { - case .abort: - mappedReason = .phoneCallDiscardReasonHangup - case let .hangUp(value): - duration = value - mappedReason = .phoneCallDiscardReasonHangup - case .busy: - mappedReason = .phoneCallDiscardReasonBusy - case .disconnect: - mappedReason = .phoneCallDiscardReasonDisconnect + case .abort: + mappedReason = .phoneCallDiscardReasonHangup + case let .hangUp(value): + duration = value + mappedReason = .phoneCallDiscardReasonHangup + case .busy: + mappedReason = .phoneCallDiscardReasonBusy + case .disconnect: + mappedReason = .phoneCallDiscardReasonDisconnect } return network.request(Api.functions.phone.discardCall(peer: Api.InputPhoneCall.inputPhoneCall(id: stableId, accessHash: accessHash), duration: duration, reason: mappedReason, connectionId: 0)) |> map { Optional($0) } diff --git a/TelegramCore/ChannelBlacklist.swift b/TelegramCore/ChannelBlacklist.swift index 532f4020c2..6b9c446c95 100644 --- a/TelegramCore/ChannelBlacklist.swift +++ b/TelegramCore/ChannelBlacklist.swift @@ -168,11 +168,15 @@ public func updateChannelMemberBannedRights(account: Account, peerId: PeerId, me var wasKicked = false var wasBanned = false var wasMember = false + var wasAdmin = false if let currentParticipant = currentParticipant { switch currentParticipant { case .creator: break - case let .member(_, _, _, banInfo): + case let .member(_, _, adminInfo, banInfo): + if let adminInfo = adminInfo { + wasAdmin = true + } if let banInfo = banInfo { if banInfo.rights.flags.contains(.banReadMessages) { wasKicked = true @@ -207,6 +211,12 @@ public func updateChannelMemberBannedRights(account: Account, peerId: PeerId, me } } + if wasAdmin { + if let adminCount = updatedData.participantsSummary.adminCount { + updatedData = updatedData.withUpdatedParticipantsSummary(updatedData.participantsSummary.withUpdatedAdminCount(max(0, adminCount - 1))) + } + } + if isMember != wasMember { if let memberCount = updatedData.participantsSummary.memberCount { updatedData = updatedData.withUpdatedParticipantsSummary(updatedData.participantsSummary.withUpdatedMemberCount(max(0, memberCount + (isMember ? 1 : -1)))) diff --git a/TelegramCore/ChannelMembers.swift b/TelegramCore/ChannelMembers.swift index a307529b15..a07e91af62 100644 --- a/TelegramCore/ChannelMembers.swift +++ b/TelegramCore/ChannelMembers.swift @@ -21,8 +21,8 @@ public enum ChannelMembersCategory { case banned(ChannelMembersCategoryFilter) } -public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64) -> Signal<[RenderedChannelParticipant], NoError> { - return postbox.modify { modifier -> Signal<[RenderedChannelParticipant], NoError> in +public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, category: ChannelMembersCategory = .recent(.all), offset: Int32 = 0, limit: Int32 = 64, hash: Int32 = 0) -> Signal<[RenderedChannelParticipant]?, NoError> { + return postbox.modify { modifier -> Signal<[RenderedChannelParticipant]?, NoError> in if let peer = modifier.getPeer(peerId), let inputChannel = apiInputChannel(peer) { let apiFilter: Api.ChannelParticipantsFilter switch category { @@ -50,10 +50,10 @@ public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, c apiFilter = .channelParticipantsKicked(q: query) } } - return network.request(Api.functions.channels.getParticipants(channel: inputChannel, filter: apiFilter, offset: offset, limit: limit, hash: 0)) + return network.request(Api.functions.channels.getParticipants(channel: inputChannel, filter: apiFilter, offset: offset, limit: limit, hash: hash)) |> retryRequest - |> mapToSignal { result -> Signal<[RenderedChannelParticipant], NoError> in - return postbox.modify { modifier -> [RenderedChannelParticipant] in + |> mapToSignal { result -> Signal<[RenderedChannelParticipant]?, NoError> in + return postbox.modify { modifier -> [RenderedChannelParticipant]? in var items: [RenderedChannelParticipant] = [] switch result { case let .channelParticipants(_, participants, users): @@ -78,7 +78,7 @@ public func channelMembers(postbox: Postbox, network: Network, peerId: PeerId, c } case .channelParticipantsNotModified: - break + return nil } return items } diff --git a/TelegramCore/ContactManagement.swift b/TelegramCore/ContactManagement.swift index c74c99f806..a46b57c333 100644 --- a/TelegramCore/ContactManagement.swift +++ b/TelegramCore/ContactManagement.swift @@ -144,3 +144,18 @@ public func deleteContactPeerInteractively(account: Account, peerId: PeerId) -> } } |> switchToLatest } + +public func deleteAllContacts(postbox: Postbox, network: Network) -> Signal { + return postbox.modify { modifier -> [Api.InputUser] in + return modifier.getContactPeerIds().compactMap(modifier.getPeer).compactMap({ apiInputUser($0) }).compactMap({ $0 }) + } + |> mapToSignal { users -> Signal in + return network.request(Api.functions.contacts.deleteContacts(id: users)) + |> `catch` { _ -> Signal in + return .single(.boolFalse) + } + |> mapToSignal { _ -> Signal in + return .complete() + } + } +} diff --git a/TelegramCore/DeserializeFunctionResponse.swift b/TelegramCore/DeserializeFunctionResponse.swift new file mode 100644 index 0000000000..29774a9594 --- /dev/null +++ b/TelegramCore/DeserializeFunctionResponse.swift @@ -0,0 +1,13 @@ +import Foundation + +public final class DeserializeFunctionResponse { + private let f: (Buffer) -> T? + + public init(_ f: @escaping (Buffer) -> T?) { + self.f = f + } + + public func parse(_ buffer: Buffer) -> T? { + return self.f(buffer) + } +} diff --git a/TelegramCore/Download.swift b/TelegramCore/Download.swift index 40b84ae8c3..f043899b2e 100644 --- a/TelegramCore/Download.swift +++ b/TelegramCore/Download.swift @@ -88,7 +88,7 @@ class Download: NSObject, MTRequestMessageServiceDelegate { return Signal { subscriber in let request = MTRequest() - let saveFilePart: (CustomStringConvertible, Buffer, (Buffer) -> Api.Bool?) + let saveFilePart: (CustomStringConvertible, Buffer, DeserializeFunctionResponse) if asBigPart { let totalParts: Int32 if let bigTotalParts = bigTotalParts { @@ -101,8 +101,8 @@ class Download: NSObject, MTRequestMessageServiceDelegate { saveFilePart = Api.functions.upload.saveFilePart(fileId: fileId, filePart: Int32(index), bytes: Buffer(data: data)) } - request.setPayload(saveFilePart.1.makeData() as Data!, metadata: WrappedRequestMetadata(metadata: saveFilePart.0, tag: nil), responseParser: { response in - if let result = saveFilePart.2(Buffer(data: response)) { + request.setPayload(saveFilePart.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: saveFilePart.0, tag: nil), responseParser: { response in + if let result = saveFilePart.2.parse(Buffer(data: response)) { return BoxedMessage(result) } return nil @@ -145,8 +145,8 @@ class Download: NSObject, MTRequestMessageServiceDelegate { let data = Api.functions.upload.getWebFile(location: location, offset: Int32(offset), limit: Int32(updatedLength)) - request.setPayload(data.1.makeData() as Data!, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in - if let result = data.2(Buffer(data: response)) { + request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in + if let result = data.2.parse(Buffer(data: response)) { return BoxedMessage(result) } return nil @@ -192,8 +192,8 @@ class Download: NSObject, MTRequestMessageServiceDelegate { let data = Api.functions.upload.getFile(location: location, offset: Int32(offset), limit: Int32(updatedLength)) - request.setPayload(data.1.makeData() as Data!, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in - if let result = data.2(Buffer(data: response)) { + request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in + if let result = data.2.parse(Buffer(data: response)) { return BoxedMessage(result) } return nil @@ -230,13 +230,13 @@ class Download: NSObject, MTRequestMessageServiceDelegate { } |> retryRequest } - func request(_ data: (CustomStringConvertible, Buffer, (Buffer) -> T?)) -> Signal { + func request(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse)) -> Signal { let requestService = self.requestService return Signal { subscriber in let request = MTRequest() - request.setPayload(data.1.makeData() as Data!, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in - if let result = data.2(Buffer(data: response)) { + request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: nil), responseParser: { response in + if let result = data.2.parse(Buffer(data: response)) { return BoxedMessage(result) } return nil diff --git a/TelegramCore/Holes.swift b/TelegramCore/Holes.swift index e1149dda08..e5d2b9f619 100644 --- a/TelegramCore/Holes.swift +++ b/TelegramCore/Holes.swift @@ -29,7 +29,7 @@ enum FetchMessageHistoryHoleSource { case network(Network) case download(Download) - func request(_ data: (CustomStringConvertible, Buffer, (Buffer) -> T?)) -> Signal { + func request(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse)) -> Signal { switch self { case let .network(network): return network.request(data) diff --git a/TelegramCore/Network.swift b/TelegramCore/Network.swift index 948a9223cf..643e074135 100644 --- a/TelegramCore/Network.swift +++ b/TelegramCore/Network.swift @@ -626,13 +626,13 @@ public final class Network: NSObject, MTRequestMessageServiceDelegate { } } - public func request(_ data: (CustomStringConvertible, Buffer, (Buffer) -> T?), tag: NetworkRequestDependencyTag? = nil, automaticFloodWait: Bool = true) -> Signal { + public func request(_ data: (CustomStringConvertible, Buffer, DeserializeFunctionResponse), tag: NetworkRequestDependencyTag? = nil, automaticFloodWait: Bool = true) -> Signal { let requestService = self.requestService return Signal { subscriber in let request = MTRequest() - request.setPayload(data.1.makeData() as Data!, metadata: WrappedRequestMetadata(metadata: data.0, tag: tag), responseParser: { response in - if let result = data.2(Buffer(data: response)) { + request.setPayload(data.1.makeData() as Data, metadata: WrappedRequestMetadata(metadata: data.0, tag: tag), responseParser: { response in + if let result = data.2.parse(Buffer(data: response)) { return BoxedMessage(result) } return nil diff --git a/TelegramCore/PeerAdmins.swift b/TelegramCore/PeerAdmins.swift index b6dcf4e286..2a26a69d8d 100644 --- a/TelegramCore/PeerAdmins.swift +++ b/TelegramCore/PeerAdmins.swift @@ -227,102 +227,102 @@ public func fetchChannelParticipant(account: Account, peerId: PeerId, participan public func updatePeerAdminRights(account: Account, peerId: PeerId, adminId: PeerId, rights: TelegramChannelAdminRights) -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> { return fetchChannelParticipant(account: account, peerId: peerId, participantId: adminId) - |> mapError { error -> UpdatePeerAdminRightsError in - return .generic - } - |> mapToSignal { currentParticipant -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in - return account.postbox.modify { modifier -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in - - if let peer = modifier.getPeer(peerId), let adminPeer = modifier.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { - if let channel = peer as? TelegramChannel, let inputChannel = apiInputChannel(channel) { - let updatedParticipant: ChannelParticipant - if let currentParticipant = currentParticipant, case let .member(_, invitedAt, currentAdminInfo, _) = currentParticipant { - let adminInfo: ChannelParticipantAdminInfo? - if !rights.flags.isEmpty { - adminInfo = ChannelParticipantAdminInfo(rights: rights, promotedBy: currentAdminInfo?.promotedBy ?? account.peerId, canBeEditedByAccountPeer: true) - } else { - adminInfo = nil - } - updatedParticipant = ChannelParticipant.member(id: adminId, invitedAt: invitedAt, adminInfo: adminInfo, banInfo: nil) + |> mapError { error -> UpdatePeerAdminRightsError in + return .generic + } + |> mapToSignal { currentParticipant -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in + return account.postbox.modify { modifier -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in + + if let peer = modifier.getPeer(peerId), let adminPeer = modifier.getPeer(adminId), let inputUser = apiInputUser(adminPeer) { + if let channel = peer as? TelegramChannel, let inputChannel = apiInputChannel(channel) { + let updatedParticipant: ChannelParticipant + if let currentParticipant = currentParticipant, case let .member(_, invitedAt, currentAdminInfo, _) = currentParticipant { + let adminInfo: ChannelParticipantAdminInfo? + if !rights.flags.isEmpty { + adminInfo = ChannelParticipantAdminInfo(rights: rights, promotedBy: currentAdminInfo?.promotedBy ?? account.peerId, canBeEditedByAccountPeer: true) } else { - let adminInfo: ChannelParticipantAdminInfo? - if !rights.flags.isEmpty { - adminInfo = ChannelParticipantAdminInfo(rights: rights, promotedBy: account.peerId, canBeEditedByAccountPeer: true) - } else { - adminInfo = nil - } - updatedParticipant = ChannelParticipant.member(id: adminId, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: adminInfo, banInfo: nil) - } - return account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights.apiAdminRights)) - |> map { [$0] } - |> `catch` { error -> Signal<[Api.Updates], UpdatePeerAdminRightsError> in - if error.errorDescription == "USER_NOT_PARTICIPANT" { - return addPeerMember(account: account, peerId: peerId, memberId: adminId) - |> map { _ -> [Api.Updates] in - return [] - } - |> mapError { error -> UpdatePeerAdminRightsError in - return .addMemberError(error) - } - |> then(account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights.apiAdminRights)) - |> mapError { error -> UpdatePeerAdminRightsError in - return .generic - } - |> map { [$0] }) - } - return .fail(.generic) - } - |> mapToSignal { result -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in - for updates in result { - account.stateManager.addUpdates(updates) - } - return account.postbox.modify { modifier -> (ChannelParticipant?, RenderedChannelParticipant) in - modifier.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in - if let cachedData = cachedData as? CachedChannelData, let adminCount = cachedData.participantsSummary.adminCount { - var updatedAdminCount = adminCount - var wasAdmin = false - if let currentParticipant = currentParticipant { - switch currentParticipant { - case .creator: - wasAdmin = true - case let .member(_, _, adminInfo, _): - if let adminInfo = adminInfo, !adminInfo.rights.isEmpty { - wasAdmin = true - } - } - } - if wasAdmin && rights.isEmpty { - updatedAdminCount = max(1, adminCount - 1) - } else if !wasAdmin && !rights.isEmpty { - updatedAdminCount = adminCount + 1 - } - - return cachedData.withUpdatedParticipantsSummary(cachedData.participantsSummary.withUpdatedAdminCount(updatedAdminCount)) - } else { - return cachedData - } - }) - var peers: [PeerId: Peer] = [:] - var presences: [PeerId: PeerPresence] = [:] - peers[adminPeer.id] = adminPeer - if let presence = modifier.getPeerPresence(peerId: adminPeer.id) { - presences[adminPeer.id] = presence - } - if case let .member(_, _, maybeAdminInfo, _) = updatedParticipant, let adminInfo = maybeAdminInfo { - if let peer = modifier.getPeer(adminInfo.promotedBy) { - peers[peer.id] = peer - } - } - return (currentParticipant, RenderedChannelParticipant(participant: updatedParticipant, peer: adminPeer, peers: peers, presences: presences)) - } |> mapError { _ -> UpdatePeerAdminRightsError in return .generic } + adminInfo = nil } + updatedParticipant = ChannelParticipant.member(id: adminId, invitedAt: invitedAt, adminInfo: adminInfo, banInfo: nil) } else { - return .fail(.generic) + let adminInfo: ChannelParticipantAdminInfo? + if !rights.flags.isEmpty { + adminInfo = ChannelParticipantAdminInfo(rights: rights, promotedBy: account.peerId, canBeEditedByAccountPeer: true) + } else { + adminInfo = nil + } + updatedParticipant = ChannelParticipant.member(id: adminId, invitedAt: Int32(Date().timeIntervalSince1970), adminInfo: adminInfo, banInfo: nil) + } + return account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights.apiAdminRights)) + |> map { [$0] } + |> `catch` { error -> Signal<[Api.Updates], UpdatePeerAdminRightsError> in + if error.errorDescription == "USER_NOT_PARTICIPANT" { + return addPeerMember(account: account, peerId: peerId, memberId: adminId) + |> map { _ -> [Api.Updates] in + return [] + } + |> mapError { error -> UpdatePeerAdminRightsError in + return .addMemberError(error) + } + |> then(account.network.request(Api.functions.channels.editAdmin(channel: inputChannel, userId: inputUser, adminRights: rights.apiAdminRights)) + |> mapError { error -> UpdatePeerAdminRightsError in + return .generic + } + |> map { [$0] }) + } + return .fail(.generic) + } + |> mapToSignal { result -> Signal<(ChannelParticipant?, RenderedChannelParticipant), UpdatePeerAdminRightsError> in + for updates in result { + account.stateManager.addUpdates(updates) + } + return account.postbox.modify { modifier -> (ChannelParticipant?, RenderedChannelParticipant) in + modifier.updatePeerCachedData(peerIds: Set([peerId]), update: { _, cachedData -> CachedPeerData? in + if let cachedData = cachedData as? CachedChannelData, let adminCount = cachedData.participantsSummary.adminCount { + var updatedAdminCount = adminCount + var wasAdmin = false + if let currentParticipant = currentParticipant { + switch currentParticipant { + case .creator: + wasAdmin = true + case let .member(_, _, adminInfo, _): + if let adminInfo = adminInfo, !adminInfo.rights.isEmpty { + wasAdmin = true + } + } + } + if wasAdmin && rights.isEmpty { + updatedAdminCount = max(1, adminCount - 1) + } else if !wasAdmin && !rights.isEmpty { + updatedAdminCount = adminCount + 1 + } + + return cachedData.withUpdatedParticipantsSummary(cachedData.participantsSummary.withUpdatedAdminCount(updatedAdminCount)) + } else { + return cachedData + } + }) + var peers: [PeerId: Peer] = [:] + var presences: [PeerId: PeerPresence] = [:] + peers[adminPeer.id] = adminPeer + if let presence = modifier.getPeerPresence(peerId: adminPeer.id) { + presences[adminPeer.id] = presence + } + if case let .member(_, _, maybeAdminInfo, _) = updatedParticipant, let adminInfo = maybeAdminInfo { + if let peer = modifier.getPeer(adminInfo.promotedBy) { + peers[peer.id] = peer + } + } + return (currentParticipant, RenderedChannelParticipant(participant: updatedParticipant, peer: adminPeer, peers: peers, presences: presences)) + } |> mapError { _ -> UpdatePeerAdminRightsError in return .generic } } } else { return .fail(.generic) } - } |> mapError { _ -> UpdatePeerAdminRightsError in return .generic } |> switchToLatest + } else { + return .fail(.generic) + } + } |> mapError { _ -> UpdatePeerAdminRightsError in return .generic } |> switchToLatest } } diff --git a/TelegramCore/SearchGroupMembers.swift b/TelegramCore/SearchGroupMembers.swift index 2707988458..311b2ef577 100644 --- a/TelegramCore/SearchGroupMembers.swift +++ b/TelegramCore/SearchGroupMembers.swift @@ -37,7 +37,12 @@ public func searchGroupMembers(postbox: Postbox, network: Network, peerId: PeerI |> map { participants -> [Peer] in var result: [Peer] = local let existingIds = Set(local.map { $0.id }) - let filtered = participants.map({ $0.peer }).filter({ !existingIds.contains($0.id) }) + let filtered: [Peer] + if let participants = participants { + filtered = participants.map({ $0.peer }).filter({ !existingIds.contains($0.id) }) + } else { + filtered = [] + } result.append(contentsOf: filtered) return result }) diff --git a/TelegramCore/Serialization.swift b/TelegramCore/Serialization.swift index 1674b37502..03f1fb24e3 100644 --- a/TelegramCore/Serialization.swift +++ b/TelegramCore/Serialization.swift @@ -107,8 +107,8 @@ public class Serialization: NSObject, MTSerialization { { let functionContext = Api.functions.auth.exportAuthorization(dcId: datacenterId) data.pointee = functionContext.1.makeData() as NSData - return { data -> MTExportedAuthorizationData! in - if let exported = functionContext.2(Buffer(data: data)) { + return { data -> MTExportedAuthorizationData? in + if let exported = functionContext.2.parse(Buffer(data: data)) { switch exported { case let .exportedAuthorization(id, bytes): return MTExportedAuthorizationData(authorizationBytes: bytes.makeData(), authorizationId: id) @@ -124,10 +124,10 @@ public class Serialization: NSObject, MTSerialization { } public func requestDatacenterAddress(with data: AutoreleasingUnsafeMutablePointer) -> MTRequestDatacenterAddressListParser! { - let (_, buffer, parse) = Api.functions.help.getConfig() + let (_, buffer, parser) = Api.functions.help.getConfig() data.pointee = buffer.makeData() as NSData return { response -> MTDatacenterAddressListData? in - if let config = parse(Buffer(data: response)) { + if let config = parser.parse(Buffer(data: response)) { switch config { case let .config(config): var addressDict: [NSNumber: [Any]] = [:] @@ -154,10 +154,10 @@ public class Serialization: NSObject, MTSerialization { } public func requestDatacenterVerificationData(_ data: AutoreleasingUnsafeMutablePointer) -> MTDatacenterVerificationDataParser! { - let (_, buffer, parse) = Api.functions.help.getConfig() + let (_, buffer, parser) = Api.functions.help.getConfig() data.pointee = buffer.makeData() as NSData return { response -> MTDatacenterVerificationData? in - if let config = parse(Buffer(data: response)) { + if let config = parser.parse(Buffer(data: response)) { switch config { case let .config(config): return MTDatacenterVerificationData(datacenterId: Int(config.thisDc), isTestingEnvironment: config.testMode == .boolTrue) @@ -169,11 +169,11 @@ public class Serialization: NSObject, MTSerialization { } public func requestNoop(_ data: AutoreleasingUnsafeMutablePointer!) -> MTRequestNoopParser! { - let (_, buffer, parse) = Api.functions.help.test() + let (_, buffer, parser) = Api.functions.help.test() data.pointee = buffer.makeData() as NSData return { response -> AnyObject? in - if let _ = parse(Buffer(data: response)) { + if let _ = parser.parse(Buffer(data: response)) { return true as NSNumber } else { return nil diff --git a/TelegramCore/TermsOfService.swift b/TelegramCore/TermsOfService.swift new file mode 100644 index 0000000000..4b53eabcce --- /dev/null +++ b/TelegramCore/TermsOfService.swift @@ -0,0 +1,29 @@ +import Foundation +#if os(macOS) +import PostboxMac +import SwiftSignalKitMac +import MtProtoKitMac +#else +import Postbox +import SwiftSignalKit +import MtProtoKitDynamic +#endif + +public func requestTermsOfService(network: Network, countryCode: String) -> Signal { + let langCode: String + if let langPackCode = network.context.apiEnvironment.langPackCode, !langPackCode.isEmpty { + langCode = langPackCode + } else { + langCode = "en" + } + return network.request(Api.functions.help.getTermsOfService(countryIso2: countryCode, langCode: langCode)) + |> `catch` { _ -> Signal in + return .single(.termsOfService(text: "")) + } + |> map { result -> String in + switch result { + case let .termsOfService(text): + return text + } + } +}