diff --git a/Telegram/Telegram-iOS/en.lproj/Localizable.strings b/Telegram/Telegram-iOS/en.lproj/Localizable.strings index 5fdc64f920..75fb799b54 100644 --- a/Telegram/Telegram-iOS/en.lproj/Localizable.strings +++ b/Telegram/Telegram-iOS/en.lproj/Localizable.strings @@ -16172,7 +16172,30 @@ Error: %8$@"; "CreatePoll.QuestionNeeded" = "Enter a question"; "CreatePoll.OptionsNeeded" = "Add at least two options"; +"CreatePoll.OptionsNeededOne" = "Add at least one option"; "CreatePoll.QuizCorrectOptionNeeded" = "Select a correct option"; "CreatePoll.QuizCorrectOptionNeededMultiple" = "Select at least one correct option"; "Stars.Intro.Transaction.Commission.Title" = "%@ commission"; + +"Conversation.ViewPollStats" = "View Statistics"; +"PollStats.Title" = "Poll Stats"; +"PollStats.GraphHeader" = "VOTE TIMELINE"; + +"CreatePoll.RestrictToSubscribers" = "Restrict to Subscribers"; +"CreatePoll.RestrictToSubscribersInfo" = "Only subscribers who joined 24+ hours ago can vote"; + +"CreatePoll.LimitCountry" = "Limit by Country"; +"CreatePoll.LimitCountryInfo" = "Only users from selected countries can vote"; +"CreatePoll.AllowedCountries" = "Allowed Countries"; +"CreatePoll.AllowedCountries.Countries_1" = "%@ country"; +"CreatePoll.AllowedCountries.Countries_any" = "%@ countries"; + +"Chat.Poll.Restriction.Subscribers" = "Only subscribers of **%@** can vote"; +"Chat.Poll.Restriction.Subscribers.TimeLimit" = "Only subscribers who joined more than **24 hours** ago can vote."; +"Chat.Poll.Restriction.Country" = "Only users from %@ can vote."; +"Chat.Poll.Restriction.SubscribersCountry" = "Only subscribers of **%@** from %@ can vote."; +"Chat.Poll.Restriction.Country.CountriesDelimiter" = ", "; +"Chat.Poll.Restriction.Country.CountriesLastDelimiter" = " and "; + +"Conversation.MessageGuestChatForUser" = "for %@"; diff --git a/submodules/AccountContext/Sources/AccountContext.swift b/submodules/AccountContext/Sources/AccountContext.swift index 369c4d4c03..589bbbca27 100644 --- a/submodules/AccountContext/Sources/AccountContext.swift +++ b/submodules/AccountContext/Sources/AccountContext.swift @@ -1487,6 +1487,7 @@ public protocol SharedAccountContext: AnyObject { func makeInstalledStickerPacksController(context: AccountContext, mode: InstalledStickerPacksControllerMode, forceTheme: PresentationTheme?) -> ViewController func makeChannelStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, peerId: EnginePeer.Id, boosts: Bool, boostStatus: ChannelBoostStatus?) -> ViewController func makeMessagesStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, messageId: EngineMessage.Id) -> ViewController + func makePollStatsScreen(context: AccountContext, messageId: EngineMessage.Id) -> ViewController func makeStoryStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, peerId: EnginePeer.Id, storyId: Int32, storyItem: EngineStoryItem, fromStory: Bool) -> ViewController func makeStarsTransactionsScreen(context: AccountContext, starsContext: StarsContext) -> ViewController func makeStarsPurchaseScreen(context: AccountContext, starsContext: StarsContext, options: [Any], purpose: StarsPurchasePurpose, targetPeerId: EnginePeer.Id?, customTheme: PresentationTheme?, completion: @escaping (Int64) -> Void) -> ViewController diff --git a/submodules/GraphCore/Sources/Charts/Controllers/Lines/GeneralLinesChartController.swift b/submodules/GraphCore/Sources/Charts/Controllers/Lines/GeneralLinesChartController.swift index 4da43fc1a0..cf017eb9a0 100644 --- a/submodules/GraphCore/Sources/Charts/Controllers/Lines/GeneralLinesChartController.swift +++ b/submodules/GraphCore/Sources/Charts/Controllers/Lines/GeneralLinesChartController.swift @@ -34,6 +34,8 @@ public class GeneralLinesChartController: BaseLinesChartController { private var prevoiusHorizontalStrideInterval: Int = 1 private(set) var chartLines: [LinesChartRenderer.LineData] = [] + + public var min5 = false override public init(chartsCollection: ChartsCollection) { self.initialChartCollection = chartsCollection @@ -217,9 +219,18 @@ public class GeneralLinesChartController: BaseLinesChartController { } func updateHorizontalLimits(horizontalRange: ClosedRange, animated: Bool) { - if let (stride, labels) = horizontalLimitsLabels(horizontalRange: horizontalRange, - scaleType: isZoomed ? .hour : .day, - prevoiusHorizontalStrideInterval: prevoiusHorizontalStrideInterval) { + var scaleType: ChartScaleType = .day + if self.min5 { + scaleType = .minutes5 + } else if isZoomed { + scaleType = .hour + } + + if let (stride, labels) = horizontalLimitsLabels( + horizontalRange: horizontalRange, + scaleType: scaleType, + prevoiusHorizontalStrideInterval: prevoiusHorizontalStrideInterval + ) { self.horizontalScalesRenderer.setup(labels: labels, animated: animated) self.prevoiusHorizontalStrideInterval = stride } diff --git a/submodules/GraphUI/Sources/ChartNode.swift b/submodules/GraphUI/Sources/ChartNode.swift index 6391759d9f..bd8d521f40 100644 --- a/submodules/GraphUI/Sources/ChartNode.swift +++ b/submodules/GraphUI/Sources/ChartNode.swift @@ -20,6 +20,7 @@ public enum ChartType { case twoAxis5MinStep case currency case stars + case lines5Min } public extension ChartTheme { @@ -142,6 +143,11 @@ public func createChartController(_ data: String, type: ChartType, rate: Double stepController.min5 = true controller = stepController controller.isZoomable = false + case .lines5Min: + let linesController = GeneralLinesChartController(chartsCollection: collection) + linesController.min5 = true + controller = linesController + controller.isZoomable = false } controller.getDetailsData = { date, completion in getDetailsData(date, { detailsData in diff --git a/submodules/PremiumUI/Sources/CreateGiveawayController.swift b/submodules/PremiumUI/Sources/CreateGiveawayController.swift index 6271348638..c05f255806 100644 --- a/submodules/PremiumUI/Sources/CreateGiveawayController.swift +++ b/submodules/PremiumUI/Sources/CreateGiveawayController.swift @@ -1607,6 +1607,7 @@ public func createGiveawayController(context: AccountContext, updatedPresentatio let stateContext = CountriesMultiselectionScreen.StateContext( context: context, subject: .countries, + maxCount: context.userLimits.maxGiveawayCountriesCount, initialSelectedCountries: state.countries ) let _ = (stateContext.ready |> filter { $0 } |> take(1) |> deliverOnMainQueue).startStandalone(next: { _ in diff --git a/submodules/StatisticsUI/Sources/MessageStatsController.swift b/submodules/StatisticsUI/Sources/MessageStatsController.swift index a1d3cf316b..ccc32ba716 100644 --- a/submodules/StatisticsUI/Sources/MessageStatsController.swift +++ b/submodules/StatisticsUI/Sources/MessageStatsController.swift @@ -36,6 +36,7 @@ private final class MessageStatsControllerArguments { private enum StatsSection: Int32 { case overview + case votes case interactions case reactions case publicForwards @@ -45,6 +46,9 @@ private enum StatsEntry: ItemListNodeEntry { case overviewTitle(PresentationTheme, String) case overview(PresentationTheme, PostStats, EngineStoryItem.Views?, Int32?) + case votesTitle(PresentationTheme, String) + case votesGraph(PresentationTheme, PresentationStrings, PresentationDateTimeFormat, StatsGraph, ChartType, Bool) + case interactionsTitle(PresentationTheme, String) case interactionsGraph(PresentationTheme, PresentationStrings, PresentationDateTimeFormat, StatsGraph, ChartType, Bool) @@ -58,6 +62,8 @@ private enum StatsEntry: ItemListNodeEntry { switch self { case .overviewTitle, .overview: return StatsSection.overview.rawValue + case .votesTitle, .votesGraph: + return StatsSection.votes.rawValue case .interactionsTitle, .interactionsGraph: return StatsSection.interactions.rawValue case .reactionsTitle, .reactionsGraph: @@ -73,18 +79,22 @@ private enum StatsEntry: ItemListNodeEntry { return 0 case .overview: return 1 - case .interactionsTitle: + case .votesTitle: return 2 - case .interactionsGraph: + case .votesGraph: return 3 - case .reactionsTitle: + case .interactionsTitle: return 4 - case .reactionsGraph: + case .interactionsGraph: return 5 - case .publicForwardsTitle: + case .reactionsTitle: return 6 + case .reactionsGraph: + return 7 + case .publicForwardsTitle: + return 8 case let .publicForward(index, _, _, _, _): - return 7 + index + return 9 + index } } @@ -108,6 +118,18 @@ private enum StatsEntry: ItemListNodeEntry { } else { return false } + case let .votesTitle(lhsTheme, lhsText): + if case let .votesTitle(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText { + return true + } else { + return false + } + case let .votesGraph(lhsTheme, lhsStrings, lhsDateTimeFormat, lhsGraph, lhsType, lhsNoInitialZoom): + if case let .votesGraph(rhsTheme, rhsStrings, rhsDateTimeFormat, rhsGraph, rhsType, rhsNoInitialZoom) = rhs, lhsTheme === rhsTheme, lhsStrings === rhsStrings, lhsDateTimeFormat == rhsDateTimeFormat, lhsGraph == rhsGraph, lhsType == rhsType, lhsNoInitialZoom == rhsNoInitialZoom { + return true + } else { + return false + } case let .interactionsTitle(lhsTheme, lhsText): if case let .interactionsTitle(rhsTheme, rhsText) = rhs, lhsTheme === rhsTheme, lhsText == rhsText { return true @@ -155,13 +177,14 @@ private enum StatsEntry: ItemListNodeEntry { let arguments = arguments as! MessageStatsControllerArguments switch self { case let .overviewTitle(_, text), + let .votesTitle(_, text), let .interactionsTitle(_, text), let .reactionsTitle(_, text), let .publicForwardsTitle(_, text): return ItemListSectionHeaderItem(presentationData: presentationData, text: text, sectionId: self.section) case let .overview(_, stats, storyViews, publicShares): return StatsOverviewItem(context: arguments.context, presentationData: presentationData, systemStyle: .glass, isGroup: false, stats: stats as? Stats, storyViews: storyViews, publicShares: publicShares, sectionId: self.section, style: .blocks) - case let .interactionsGraph(_, _, _, graph, type, noInitialZoom), let .reactionsGraph(_, _, _, graph, type, noInitialZoom): + case let .votesGraph(_, _, _, graph, type, noInitialZoom), let .interactionsGraph(_, _, _, graph, type, noInitialZoom), let .reactionsGraph(_, _, _, graph, type, noInitialZoom): return StatsGraphItem(presentationData: presentationData, systemStyle: .glass, graph: graph, type: type, noInitialZoom: noInitialZoom, getDetailsData: { date, completion in let _ = arguments.loadDetailedGraph(graph, Int64(date.timeIntervalSince1970) * 1000).start(next: { graph in if let graph = graph, case let .Loaded(_, data) = graph { @@ -215,7 +238,7 @@ private enum StatsEntry: ItemListNodeEntry { } } -private func messageStatsControllerEntries(data: PostStats?, storyViews: EngineStoryItem.Views?, forwards: StoryStatsPublicForwardsContext.State?, presentationData: PresentationData) -> [StatsEntry] { +private func messageStatsControllerEntries(data: PostStats?, pollData: PollStats?, storyViews: EngineStoryItem.Views?, forwards: StoryStatsPublicForwardsContext.State?, presentationData: PresentationData) -> [StatsEntry] { var entries: [StatsEntry] = [] if let data = data { @@ -227,6 +250,11 @@ private func messageStatsControllerEntries(data: PostStats?, storyViews: EngineS } entries.append(.overview(presentationData.theme, data, storyViews, publicShares)) + if let pollData, !pollData.votesGraph.isEmpty { + entries.append(.votesTitle(presentationData.theme, presentationData.strings.PollStats_GraphHeader.uppercased())) + entries.append(.votesGraph(presentationData.theme, presentationData.strings, presentationData.dateTimeFormat, pollData.votesGraph, .lines5Min, false)) + } + var isStories = false if let _ = data as? StoryStats { isStories = true @@ -295,8 +323,10 @@ public func messageStatsController(context: AccountContext, updatedPresentationD let actionsDisposable = DisposableSet() let dataPromise = Promise(nil) let forwardsPromise = Promise(nil) + let pollDataPromise = Promise(nil) let anyStatsContext: Any + var pollStatsContext: Any? let dataSignal: Signal var loadDetailedGraphImpl: ((StatsGraph, Int64) -> Signal)? var openStoryImpl: ((EnginePeer.Id, EngineStoryItem, UIView) -> Void)? @@ -320,6 +350,31 @@ public func messageStatsController(context: AccountContext, updatedPresentationD anyStatsContext = statsContext forwardsContext = StoryStatsPublicForwardsContext(account: context.account, subject: .message(messageId: id)) + + pollDataPromise.set(context.engine.data.get(TelegramEngine.EngineData.Item.Messages.Message(id: id)) + |> map { message -> PollStatsContext? in + guard let message else { + return nil + } + for media in message.media { + if let poll = media as? TelegramMediaPoll, poll.results.canViewStats { + return PollStatsContext(account: context.account, messageId: message.id) + } + } + return nil + } + |> afterNext { statsContext in + pollStatsContext = statsContext + } + |> mapToSignal { pollStatsContext in + guard let pollStatsContext else { + return .single(nil) + } + return pollStatsContext.state + |> map { state in + return state.stats + } + }) case let .story(peerIdValue, id, item, _): peerId = peerIdValue storyItem = item @@ -338,13 +393,11 @@ public func messageStatsController(context: AccountContext, updatedPresentationD forwardsContext = StoryStatsPublicForwardsContext(account: context.account, subject: .story(peerId: peerId, id: id)) } - forwardsPromise.set( - .single(nil) - |> then( - forwardsContext.state - |> map(Optional.init) - ) - ) + forwardsPromise.set(.single(nil) + |> then( + forwardsContext.state + |> map(Optional.init) + )) let arguments = MessageStatsControllerArguments(context: context, loadDetailedGraph: { graph, x -> Signal in return loadDetailedGraphImpl?(graph, x) ?? .single(nil) @@ -384,12 +437,13 @@ public func messageStatsController(context: AccountContext, updatedPresentationD let signal = combineLatest( presentationData, dataPromise.get(), + pollDataPromise.get(), forwardsPromise.get(), longLoadingSignal, iconNodePromise.get() ) |> deliverOnMainQueue - |> map { presentationData, data, forwards, longLoading, iconNode -> (ItemListControllerState, (ItemListNodeState, Any)) in + |> map { presentationData, data, pollData, forwards, longLoading, iconNode -> (ItemListControllerState, (ItemListNodeState, Any)) in let previous = previousData.swap(data) var emptyStateItem: ItemListControllerEmptyStateItem? if data == nil { @@ -415,13 +469,14 @@ public func messageStatsController(context: AccountContext, updatedPresentationD openStoryImpl?(peerId, storyItem, iconNode.view) } }) }, backNavigationButton: ItemListBackButton(title: presentationData.strings.Common_Back), animateChanges: true) - let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: messageStatsControllerEntries(data: data, storyViews: storyViews, forwards: forwards, presentationData: presentationData), style: .blocks, emptyStateItem: emptyStateItem, crossfadeState: previous == nil, animateChanges: false) + let listState = ItemListNodeState(presentationData: ItemListPresentationData(presentationData), entries: messageStatsControllerEntries(data: data, pollData: pollData, storyViews: storyViews, forwards: forwards, presentationData: presentationData), style: .blocks, emptyStateItem: emptyStateItem, crossfadeState: previous == nil, animateChanges: false) return (controllerState, (listState, arguments)) } |> afterDisposed { actionsDisposable.dispose() let _ = anyStatsContext + let _ = pollStatsContext let _ = forwardsContext } diff --git a/submodules/TelegramApi/Sources/Api0.swift b/submodules/TelegramApi/Sources/Api0.swift index 6a56740d86..3028ad1ac0 100644 --- a/submodules/TelegramApi/Sources/Api0.swift +++ b/submodules/TelegramApi/Sources/Api0.swift @@ -1,6 +1,7 @@ public enum Api { public enum account {} + public enum aicompose {} public enum auth {} public enum bots {} public enum channels {} @@ -23,6 +24,7 @@ public enum Api { public enum users {} public enum functions { public enum account {} + public enum aicompose {} public enum auth {} public enum bots {} public enum channels {} @@ -55,6 +57,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[0x0929C32F] = { return parseInt256($0) } dict[-1255641564] = { return parseString($0) } dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) } + dict[317330533] = { return Api.AiComposeTone.parse_aiComposeTone($0) } + dict[-1683135468] = { return Api.AiComposeTone.parse_aiComposeToneDefault($0) } dict[-653423106] = { return Api.AttachMenuBot.parse_attachMenuBot($0) } dict[-1297663893] = { return Api.AttachMenuBotIcon.parse_attachMenuBotIcon($0) } dict[1165423600] = { return Api.AttachMenuBotIconColor.parse_attachMenuBotIconColor($0) } @@ -198,6 +202,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-531931925] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsMentions($0) } dict[-566281095] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsRecent($0) } dict[106343499] = { return Api.ChannelParticipantsFilter.parse_channelParticipantsSearch($0) } + dict[-1817845901] = { return Api.ChannelTopic.parse_channelTopic($0) } dict[473084188] = { return Api.Chat.parse_channel($0) } dict[399807445] = { return Api.Chat.parse_channelForbidden($0) } dict[1103884886] = { return Api.Chat.parse_chat($0) } @@ -321,6 +326,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1589952067] = { return Api.InlineQueryPeerType.parse_inlineQueryPeerTypeMegagroup($0) } dict[-2093215828] = { return Api.InlineQueryPeerType.parse_inlineQueryPeerTypePM($0) } dict[813821341] = { return Api.InlineQueryPeerType.parse_inlineQueryPeerTypeSameBotPM($0) } + dict[535407039] = { return Api.InputAiComposeTone.parse_inputAiComposeToneDefault($0) } + dict[125026432] = { return Api.InputAiComposeTone.parse_inputAiComposeToneID($0) } + dict[530584407] = { return Api.InputAiComposeTone.parse_inputAiComposeToneSlug($0) } dict[488313413] = { return Api.InputAppEvent.parse_inputAppEvent($0) } dict[-1457472134] = { return Api.InputBotApp.parse_inputBotAppID($0) } dict[-1869872121] = { return Api.InputBotApp.parse_inputBotAppShortName($0) } @@ -577,7 +585,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1098720356] = { return Api.MediaArea.parse_mediaAreaVenue($0) } dict[1235637404] = { return Api.MediaArea.parse_mediaAreaWeather($0) } dict[-808853502] = { return Api.MediaAreaCoordinates.parse_mediaAreaCoordinates($0) } - dict[988112002] = { return Api.Message.parse_message($0) } + dict[-1779470549] = { return Api.Message.parse_message($0) } dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) } dict[2055212554] = { return Api.Message.parse_messageService($0) } dict[-872240531] = { return Api.MessageAction.parse_messageActionBoostApply($0) } @@ -798,6 +806,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-193510921] = { return Api.PeerSettings.parse_peerSettings($0) } dict[-1707742823] = { return Api.PeerStories.parse_peerStories($0) } dict[-404214254] = { return Api.PendingSuggestion.parse_pendingSuggestion($0) } + dict[431767677] = { return Api.PersonalChannel.parse_personalChannel($0) } dict[810769141] = { return Api.PhoneCall.parse_phoneCall($0) } dict[912311057] = { return Api.PhoneCall.parse_phoneCallAccepted($0) } dict[1355435489] = { return Api.PhoneCall.parse_phoneCallDiscarded($0) } @@ -820,7 +829,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[236446268] = { return Api.PhotoSize.parse_photoSizeEmpty($0) } dict[-96535659] = { return Api.PhotoSize.parse_photoSizeProgressive($0) } dict[-525288402] = { return Api.PhotoSize.parse_photoStrippedSize($0) } - dict[-1203610647] = { return Api.Poll.parse_poll($0) } + dict[-1771164225] = { return Api.Poll.parse_poll($0) } dict[429911446] = { return Api.PollAnswer.parse_inputPollAnswer($0) } dict[1266514026] = { return Api.PollAnswer.parse_pollAnswer($0) } dict[910500618] = { return Api.PollAnswerVoters.parse_pollAnswerVoters($0) } @@ -1094,6 +1103,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-1122524854] = { return Api.TopPeerCategory.parse_topPeerCategoryGroups($0) } dict[511092620] = { return Api.TopPeerCategory.parse_topPeerCategoryPhoneCalls($0) } dict[-75283823] = { return Api.TopPeerCategoryPeers.parse_topPeerCategoryPeers($0) } + dict[-1945136645] = { return Api.Update.parse_updateAiComposeTones($0) } dict[397910539] = { return Api.Update.parse_updateAttachMenuBots($0) } dict[-335171433] = { return Api.Update.parse_updateAutoSaveSettings($0) } dict[-1964652166] = { return Api.Update.parse_updateBotBusinessConnect($0) } @@ -1103,6 +1113,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[1299263278] = { return Api.Update.parse_updateBotCommands($0) } dict[-1607821266] = { return Api.Update.parse_updateBotDeleteBusinessMessage($0) } dict[132077692] = { return Api.Update.parse_updateBotEditBusinessMessage($0) } + dict[-841742019] = { return Api.Update.parse_updateBotGuestChatQuery($0) } dict[1232025500] = { return Api.Update.parse_updateBotInlineQuery($0) } dict[317794823] = { return Api.Update.parse_updateBotInlineSend($0) } dict[347625491] = { return Api.Update.parse_updateBotMenuButton($0) } @@ -1329,6 +1340,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-842824308] = { return Api.account.WallPapers.parse_wallPapers($0) } dict[471437699] = { return Api.account.WallPapers.parse_wallPapersNotModified($0) } dict[-313079300] = { return Api.account.WebAuthorizations.parse_webAuthorizations($0) } + dict[1696028994] = { return Api.aicompose.Tones.parse_tones($0) } + dict[-1040948989] = { return Api.aicompose.Tones.parse_tonesNotModified($0) } dict[782418132] = { return Api.auth.Authorization.parse_authorization($0) } dict[1148485274] = { return Api.auth.Authorization.parse_authorizationSignUpRequired($0) } dict[1948046307] = { return Api.auth.CodeType.parse_codeTypeCall($0) } @@ -1366,6 +1379,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[-541588713] = { return Api.channels.ChannelParticipant.parse_channelParticipant($0) } dict[-1699676497] = { return Api.channels.ChannelParticipants.parse_channelParticipants($0) } dict[-266911767] = { return Api.channels.ChannelParticipants.parse_channelParticipantsNotModified($0) } + dict[824755388] = { return Api.channels.Found.parse_found($0) } + dict[-694491059] = { return Api.channels.PersonalChannels.parse_personalChannels($0) } dict[-191450938] = { return Api.channels.SendAsPeers.parse_sendAsPeers($0) } dict[1044107055] = { return Api.channels.SponsoredMessageReportResult.parse_sponsoredMessageReportResultAdsHidden($0) } dict[-2073059774] = { return Api.channels.SponsoredMessageReportResult.parse_sponsoredMessageReportResultChooseOption($0) } @@ -1568,6 +1583,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = { dict[963421692] = { return Api.stats.BroadcastStats.parse_broadcastStats($0) } dict[-276825834] = { return Api.stats.MegagroupStats.parse_megagroupStats($0) } dict[2145983508] = { return Api.stats.MessageStats.parse_messageStats($0) } + dict[697941741] = { return Api.stats.PollStats.parse_pollStats($0) } dict[-1828487648] = { return Api.stats.PublicForwards.parse_publicForwards($0) } dict[1355613820] = { return Api.stats.StoryStats.parse_storyStats($0) } dict[-2046910401] = { return Api.stickers.SuggestedShortName.parse_suggestedShortName($0) } @@ -1668,6 +1684,8 @@ public extension Api { switch object { case let _1 as Api.AccountDaysTTL: _1.serialize(buffer, boxed) + case let _1 as Api.AiComposeTone: + _1.serialize(buffer, boxed) case let _1 as Api.AttachMenuBot: _1.serialize(buffer, boxed) case let _1 as Api.AttachMenuBotIcon: @@ -1768,6 +1786,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.ChannelParticipantsFilter: _1.serialize(buffer, boxed) + case let _1 as Api.ChannelTopic: + _1.serialize(buffer, boxed) case let _1 as Api.Chat: _1.serialize(buffer, boxed) case let _1 as Api.ChatAdminRights: @@ -1908,6 +1928,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.InlineQueryPeerType: _1.serialize(buffer, boxed) + case let _1 as Api.InputAiComposeTone: + _1.serialize(buffer, boxed) case let _1 as Api.InputAppEvent: _1.serialize(buffer, boxed) case let _1 as Api.InputBotApp: @@ -2146,6 +2168,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.PendingSuggestion: _1.serialize(buffer, boxed) + case let _1 as Api.PersonalChannel: + _1.serialize(buffer, boxed) case let _1 as Api.PhoneCall: _1.serialize(buffer, boxed) case let _1 as Api.PhoneCallDiscardReason: @@ -2470,6 +2494,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.account.WebAuthorizations: _1.serialize(buffer, boxed) + case let _1 as Api.aicompose.Tones: + _1.serialize(buffer, boxed) case let _1 as Api.auth.Authorization: _1.serialize(buffer, boxed) case let _1 as Api.auth.CodeType: @@ -2504,6 +2530,10 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.channels.ChannelParticipants: _1.serialize(buffer, boxed) + case let _1 as Api.channels.Found: + _1.serialize(buffer, boxed) + case let _1 as Api.channels.PersonalChannels: + _1.serialize(buffer, boxed) case let _1 as Api.channels.SendAsPeers: _1.serialize(buffer, boxed) case let _1 as Api.channels.SponsoredMessageReportResult: @@ -2792,6 +2822,8 @@ public extension Api { _1.serialize(buffer, boxed) case let _1 as Api.stats.MessageStats: _1.serialize(buffer, boxed) + case let _1 as Api.stats.PollStats: + _1.serialize(buffer, boxed) case let _1 as Api.stats.PublicForwards: _1.serialize(buffer, boxed) case let _1 as Api.stats.StoryStats: diff --git a/submodules/TelegramApi/Sources/Api1.swift b/submodules/TelegramApi/Sources/Api1.swift index b7c6682f33..b5f8584bce 100644 --- a/submodules/TelegramApi/Sources/Api1.swift +++ b/submodules/TelegramApi/Sources/Api1.swift @@ -42,6 +42,151 @@ public extension Api { } } } +public extension Api { + enum AiComposeTone: TypeConstructorDescription { + public class Cons_aiComposeTone: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var slug: String + public var title: String + public var emojiId: Int64? + public var prompt: String + public var installsCount: Int32? + public var authorId: Int64? + public init(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, emojiId: Int64?, prompt: String, installsCount: Int32?, authorId: Int64?) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.slug = slug + self.title = title + self.emojiId = emojiId + self.prompt = prompt + self.installsCount = installsCount + self.authorId = authorId + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("aiComposeTone", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("slug", ConstructorParameterDescription(self.slug)), ("title", ConstructorParameterDescription(self.title)), ("emojiId", ConstructorParameterDescription(self.emojiId)), ("prompt", ConstructorParameterDescription(self.prompt)), ("installsCount", ConstructorParameterDescription(self.installsCount)), ("authorId", ConstructorParameterDescription(self.authorId))]) + } + } + public class Cons_aiComposeToneDefault: TypeConstructorDescription { + public var tone: String + public var emojiId: Int64 + public var title: String + public init(tone: String, emojiId: Int64, title: String) { + self.tone = tone + self.emojiId = emojiId + self.title = title + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("aiComposeToneDefault", [("tone", ConstructorParameterDescription(self.tone)), ("emojiId", ConstructorParameterDescription(self.emojiId)), ("title", ConstructorParameterDescription(self.title))]) + } + } + case aiComposeTone(Cons_aiComposeTone) + case aiComposeToneDefault(Cons_aiComposeToneDefault) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .aiComposeTone(let _data): + if boxed { + buffer.appendInt32(317330533) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeString(_data.slug, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt64(_data.emojiId!, buffer: buffer, boxed: false) + } + serializeString(_data.prompt, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt32(_data.installsCount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt64(_data.authorId!, buffer: buffer, boxed: false) + } + break + case .aiComposeToneDefault(let _data): + if boxed { + buffer.appendInt32(-1683135468) + } + serializeString(_data.tone, buffer: buffer, boxed: false) + serializeInt64(_data.emojiId, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .aiComposeTone(let _data): + return ("aiComposeTone", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("slug", ConstructorParameterDescription(_data.slug)), ("title", ConstructorParameterDescription(_data.title)), ("emojiId", ConstructorParameterDescription(_data.emojiId)), ("prompt", ConstructorParameterDescription(_data.prompt)), ("installsCount", ConstructorParameterDescription(_data.installsCount)), ("authorId", ConstructorParameterDescription(_data.authorId))]) + case .aiComposeToneDefault(let _data): + return ("aiComposeToneDefault", [("tone", ConstructorParameterDescription(_data.tone)), ("emojiId", ConstructorParameterDescription(_data.emojiId)), ("title", ConstructorParameterDescription(_data.title))]) + } + } + + public static func parse_aiComposeTone(_ reader: BufferReader) -> AiComposeTone? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: String? + _4 = parseString(reader) + var _5: String? + _5 = parseString(reader) + var _6: Int64? + if Int(_1!) & Int(1 << 1) != 0 { + _6 = reader.readInt64() + } + var _7: String? + _7 = parseString(reader) + var _8: Int32? + if Int(_1!) & Int(1 << 2) != 0 { + _8 = reader.readInt32() + } + var _9: Int64? + if Int(_1!) & Int(1 << 3) != 0 { + _9 = reader.readInt64() + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil + let _c7 = _7 != nil + let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { + return Api.AiComposeTone.aiComposeTone(Cons_aiComposeTone(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, emojiId: _6, prompt: _7!, installsCount: _8, authorId: _9)) + } + else { + return nil + } + } + public static func parse_aiComposeToneDefault(_ reader: BufferReader) -> AiComposeTone? { + var _1: String? + _1 = parseString(reader) + var _2: Int64? + _2 = reader.readInt64() + var _3: String? + _3 = parseString(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.AiComposeTone.aiComposeToneDefault(Cons_aiComposeToneDefault(tone: _1!, emojiId: _2!, title: _3!)) + } + else { + return nil + } + } + } +} public extension Api { enum AttachMenuBot: TypeConstructorDescription { public class Cons_attachMenuBot: TypeConstructorDescription { @@ -1465,97 +1610,3 @@ public extension Api { } } } -public extension Api { - enum BotAppSettings: TypeConstructorDescription { - public class Cons_botAppSettings: TypeConstructorDescription { - public var flags: Int32 - public var placeholderPath: Buffer? - public var backgroundColor: Int32? - public var backgroundDarkColor: Int32? - public var headerColor: Int32? - public var headerDarkColor: Int32? - public init(flags: Int32, placeholderPath: Buffer?, backgroundColor: Int32?, backgroundDarkColor: Int32?, headerColor: Int32?, headerDarkColor: Int32?) { - self.flags = flags - self.placeholderPath = placeholderPath - self.backgroundColor = backgroundColor - self.backgroundDarkColor = backgroundDarkColor - self.headerColor = headerColor - self.headerDarkColor = headerDarkColor - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("botAppSettings", [("flags", ConstructorParameterDescription(self.flags)), ("placeholderPath", ConstructorParameterDescription(self.placeholderPath)), ("backgroundColor", ConstructorParameterDescription(self.backgroundColor)), ("backgroundDarkColor", ConstructorParameterDescription(self.backgroundDarkColor)), ("headerColor", ConstructorParameterDescription(self.headerColor)), ("headerDarkColor", ConstructorParameterDescription(self.headerDarkColor))]) - } - } - case botAppSettings(Cons_botAppSettings) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .botAppSettings(let _data): - if boxed { - buffer.appendInt32(-912582320) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeBytes(_data.placeholderPath!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.backgroundColor!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt32(_data.backgroundDarkColor!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt32(_data.headerColor!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.headerDarkColor!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .botAppSettings(let _data): - return ("botAppSettings", [("flags", ConstructorParameterDescription(_data.flags)), ("placeholderPath", ConstructorParameterDescription(_data.placeholderPath)), ("backgroundColor", ConstructorParameterDescription(_data.backgroundColor)), ("backgroundDarkColor", ConstructorParameterDescription(_data.backgroundDarkColor)), ("headerColor", ConstructorParameterDescription(_data.headerColor)), ("headerDarkColor", ConstructorParameterDescription(_data.headerDarkColor))]) - } - } - - public static func parse_botAppSettings(_ reader: BufferReader) -> BotAppSettings? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Buffer? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = parseBytes(reader) - } - var _3: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _3 = reader.readInt32() - } - var _4: Int32? - if Int(_1!) & Int(1 << 2) != 0 { - _4 = reader.readInt32() - } - var _5: Int32? - if Int(_1!) & Int(1 << 3) != 0 { - _5 = reader.readInt32() - } - var _6: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _6 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.BotAppSettings.botAppSettings(Cons_botAppSettings(flags: _1!, placeholderPath: _2, backgroundColor: _3, backgroundDarkColor: _4, headerColor: _5, headerDarkColor: _6)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api15.swift b/submodules/TelegramApi/Sources/Api15.swift index 2fb0d8d59e..9e96c0ae9a 100644 --- a/submodules/TelegramApi/Sources/Api15.swift +++ b/submodules/TelegramApi/Sources/Api15.swift @@ -1086,6 +1086,7 @@ public extension Api { public var fwdFrom: Api.MessageFwdHeader? public var viaBotId: Int64? public var viaBusinessBotId: Int64? + public var guestchatViaFrom: Api.Peer? public var replyTo: Api.MessageReplyHeader? public var date: Int32 public var message: String @@ -1109,7 +1110,7 @@ public extension Api { public var suggestedPost: Api.SuggestedPost? public var scheduleRepeatPeriod: Int32? public var summaryFromLanguage: String? - public init(flags: Int32, flags2: Int32, id: Int32, fromId: Api.Peer?, fromBoostsApplied: Int32?, fromRank: String?, peerId: Api.Peer, savedPeerId: Api.Peer?, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, viaBusinessBotId: Int64?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, reactions: Api.MessageReactions?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?, quickReplyShortcutId: Int32?, effect: Int64?, factcheck: Api.FactCheck?, reportDeliveryUntilDate: Int32?, paidMessageStars: Int64?, suggestedPost: Api.SuggestedPost?, scheduleRepeatPeriod: Int32?, summaryFromLanguage: String?) { + public init(flags: Int32, flags2: Int32, id: Int32, fromId: Api.Peer?, fromBoostsApplied: Int32?, fromRank: String?, peerId: Api.Peer, savedPeerId: Api.Peer?, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int64?, viaBusinessBotId: Int64?, guestchatViaFrom: Api.Peer?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, reactions: Api.MessageReactions?, restrictionReason: [Api.RestrictionReason]?, ttlPeriod: Int32?, quickReplyShortcutId: Int32?, effect: Int64?, factcheck: Api.FactCheck?, reportDeliveryUntilDate: Int32?, paidMessageStars: Int64?, suggestedPost: Api.SuggestedPost?, scheduleRepeatPeriod: Int32?, summaryFromLanguage: String?) { self.flags = flags self.flags2 = flags2 self.id = id @@ -1121,6 +1122,7 @@ public extension Api { self.fwdFrom = fwdFrom self.viaBotId = viaBotId self.viaBusinessBotId = viaBusinessBotId + self.guestchatViaFrom = guestchatViaFrom self.replyTo = replyTo self.date = date self.message = message @@ -1146,7 +1148,7 @@ public extension Api { self.summaryFromLanguage = summaryFromLanguage } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("message", [("flags", ConstructorParameterDescription(self.flags)), ("flags2", ConstructorParameterDescription(self.flags2)), ("id", ConstructorParameterDescription(self.id)), ("fromId", ConstructorParameterDescription(self.fromId)), ("fromBoostsApplied", ConstructorParameterDescription(self.fromBoostsApplied)), ("fromRank", ConstructorParameterDescription(self.fromRank)), ("peerId", ConstructorParameterDescription(self.peerId)), ("savedPeerId", ConstructorParameterDescription(self.savedPeerId)), ("fwdFrom", ConstructorParameterDescription(self.fwdFrom)), ("viaBotId", ConstructorParameterDescription(self.viaBotId)), ("viaBusinessBotId", ConstructorParameterDescription(self.viaBusinessBotId)), ("replyTo", ConstructorParameterDescription(self.replyTo)), ("date", ConstructorParameterDescription(self.date)), ("message", ConstructorParameterDescription(self.message)), ("media", ConstructorParameterDescription(self.media)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("entities", ConstructorParameterDescription(self.entities)), ("views", ConstructorParameterDescription(self.views)), ("forwards", ConstructorParameterDescription(self.forwards)), ("replies", ConstructorParameterDescription(self.replies)), ("editDate", ConstructorParameterDescription(self.editDate)), ("postAuthor", ConstructorParameterDescription(self.postAuthor)), ("groupedId", ConstructorParameterDescription(self.groupedId)), ("reactions", ConstructorParameterDescription(self.reactions)), ("restrictionReason", ConstructorParameterDescription(self.restrictionReason)), ("ttlPeriod", ConstructorParameterDescription(self.ttlPeriod)), ("quickReplyShortcutId", ConstructorParameterDescription(self.quickReplyShortcutId)), ("effect", ConstructorParameterDescription(self.effect)), ("factcheck", ConstructorParameterDescription(self.factcheck)), ("reportDeliveryUntilDate", ConstructorParameterDescription(self.reportDeliveryUntilDate)), ("paidMessageStars", ConstructorParameterDescription(self.paidMessageStars)), ("suggestedPost", ConstructorParameterDescription(self.suggestedPost)), ("scheduleRepeatPeriod", ConstructorParameterDescription(self.scheduleRepeatPeriod)), ("summaryFromLanguage", ConstructorParameterDescription(self.summaryFromLanguage))]) + return ("message", [("flags", ConstructorParameterDescription(self.flags)), ("flags2", ConstructorParameterDescription(self.flags2)), ("id", ConstructorParameterDescription(self.id)), ("fromId", ConstructorParameterDescription(self.fromId)), ("fromBoostsApplied", ConstructorParameterDescription(self.fromBoostsApplied)), ("fromRank", ConstructorParameterDescription(self.fromRank)), ("peerId", ConstructorParameterDescription(self.peerId)), ("savedPeerId", ConstructorParameterDescription(self.savedPeerId)), ("fwdFrom", ConstructorParameterDescription(self.fwdFrom)), ("viaBotId", ConstructorParameterDescription(self.viaBotId)), ("viaBusinessBotId", ConstructorParameterDescription(self.viaBusinessBotId)), ("guestchatViaFrom", ConstructorParameterDescription(self.guestchatViaFrom)), ("replyTo", ConstructorParameterDescription(self.replyTo)), ("date", ConstructorParameterDescription(self.date)), ("message", ConstructorParameterDescription(self.message)), ("media", ConstructorParameterDescription(self.media)), ("replyMarkup", ConstructorParameterDescription(self.replyMarkup)), ("entities", ConstructorParameterDescription(self.entities)), ("views", ConstructorParameterDescription(self.views)), ("forwards", ConstructorParameterDescription(self.forwards)), ("replies", ConstructorParameterDescription(self.replies)), ("editDate", ConstructorParameterDescription(self.editDate)), ("postAuthor", ConstructorParameterDescription(self.postAuthor)), ("groupedId", ConstructorParameterDescription(self.groupedId)), ("reactions", ConstructorParameterDescription(self.reactions)), ("restrictionReason", ConstructorParameterDescription(self.restrictionReason)), ("ttlPeriod", ConstructorParameterDescription(self.ttlPeriod)), ("quickReplyShortcutId", ConstructorParameterDescription(self.quickReplyShortcutId)), ("effect", ConstructorParameterDescription(self.effect)), ("factcheck", ConstructorParameterDescription(self.factcheck)), ("reportDeliveryUntilDate", ConstructorParameterDescription(self.reportDeliveryUntilDate)), ("paidMessageStars", ConstructorParameterDescription(self.paidMessageStars)), ("suggestedPost", ConstructorParameterDescription(self.suggestedPost)), ("scheduleRepeatPeriod", ConstructorParameterDescription(self.scheduleRepeatPeriod)), ("summaryFromLanguage", ConstructorParameterDescription(self.summaryFromLanguage))]) } } public class Cons_messageEmpty: TypeConstructorDescription { @@ -1197,7 +1199,7 @@ public extension Api { switch self { case .message(let _data): if boxed { - buffer.appendInt32(988112002) + buffer.appendInt32(-1779470549) } serializeInt32(_data.flags, buffer: buffer, boxed: false) serializeInt32(_data.flags2, buffer: buffer, boxed: false) @@ -1224,6 +1226,9 @@ public extension Api { if Int(_data.flags2) & Int(1 << 0) != 0 { serializeInt64(_data.viaBusinessBotId!, buffer: buffer, boxed: false) } + if Int(_data.flags2) & Int(1 << 19) != 0 { + _data.guestchatViaFrom!.serialize(buffer, true) + } if Int(_data.flags) & Int(1 << 3) != 0 { _data.replyTo!.serialize(buffer, true) } @@ -1339,7 +1344,7 @@ public extension Api { public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { case .message(let _data): - return ("message", [("flags", ConstructorParameterDescription(_data.flags)), ("flags2", ConstructorParameterDescription(_data.flags2)), ("id", ConstructorParameterDescription(_data.id)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("fromBoostsApplied", ConstructorParameterDescription(_data.fromBoostsApplied)), ("fromRank", ConstructorParameterDescription(_data.fromRank)), ("peerId", ConstructorParameterDescription(_data.peerId)), ("savedPeerId", ConstructorParameterDescription(_data.savedPeerId)), ("fwdFrom", ConstructorParameterDescription(_data.fwdFrom)), ("viaBotId", ConstructorParameterDescription(_data.viaBotId)), ("viaBusinessBotId", ConstructorParameterDescription(_data.viaBusinessBotId)), ("replyTo", ConstructorParameterDescription(_data.replyTo)), ("date", ConstructorParameterDescription(_data.date)), ("message", ConstructorParameterDescription(_data.message)), ("media", ConstructorParameterDescription(_data.media)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("entities", ConstructorParameterDescription(_data.entities)), ("views", ConstructorParameterDescription(_data.views)), ("forwards", ConstructorParameterDescription(_data.forwards)), ("replies", ConstructorParameterDescription(_data.replies)), ("editDate", ConstructorParameterDescription(_data.editDate)), ("postAuthor", ConstructorParameterDescription(_data.postAuthor)), ("groupedId", ConstructorParameterDescription(_data.groupedId)), ("reactions", ConstructorParameterDescription(_data.reactions)), ("restrictionReason", ConstructorParameterDescription(_data.restrictionReason)), ("ttlPeriod", ConstructorParameterDescription(_data.ttlPeriod)), ("quickReplyShortcutId", ConstructorParameterDescription(_data.quickReplyShortcutId)), ("effect", ConstructorParameterDescription(_data.effect)), ("factcheck", ConstructorParameterDescription(_data.factcheck)), ("reportDeliveryUntilDate", ConstructorParameterDescription(_data.reportDeliveryUntilDate)), ("paidMessageStars", ConstructorParameterDescription(_data.paidMessageStars)), ("suggestedPost", ConstructorParameterDescription(_data.suggestedPost)), ("scheduleRepeatPeriod", ConstructorParameterDescription(_data.scheduleRepeatPeriod)), ("summaryFromLanguage", ConstructorParameterDescription(_data.summaryFromLanguage))]) + return ("message", [("flags", ConstructorParameterDescription(_data.flags)), ("flags2", ConstructorParameterDescription(_data.flags2)), ("id", ConstructorParameterDescription(_data.id)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("fromBoostsApplied", ConstructorParameterDescription(_data.fromBoostsApplied)), ("fromRank", ConstructorParameterDescription(_data.fromRank)), ("peerId", ConstructorParameterDescription(_data.peerId)), ("savedPeerId", ConstructorParameterDescription(_data.savedPeerId)), ("fwdFrom", ConstructorParameterDescription(_data.fwdFrom)), ("viaBotId", ConstructorParameterDescription(_data.viaBotId)), ("viaBusinessBotId", ConstructorParameterDescription(_data.viaBusinessBotId)), ("guestchatViaFrom", ConstructorParameterDescription(_data.guestchatViaFrom)), ("replyTo", ConstructorParameterDescription(_data.replyTo)), ("date", ConstructorParameterDescription(_data.date)), ("message", ConstructorParameterDescription(_data.message)), ("media", ConstructorParameterDescription(_data.media)), ("replyMarkup", ConstructorParameterDescription(_data.replyMarkup)), ("entities", ConstructorParameterDescription(_data.entities)), ("views", ConstructorParameterDescription(_data.views)), ("forwards", ConstructorParameterDescription(_data.forwards)), ("replies", ConstructorParameterDescription(_data.replies)), ("editDate", ConstructorParameterDescription(_data.editDate)), ("postAuthor", ConstructorParameterDescription(_data.postAuthor)), ("groupedId", ConstructorParameterDescription(_data.groupedId)), ("reactions", ConstructorParameterDescription(_data.reactions)), ("restrictionReason", ConstructorParameterDescription(_data.restrictionReason)), ("ttlPeriod", ConstructorParameterDescription(_data.ttlPeriod)), ("quickReplyShortcutId", ConstructorParameterDescription(_data.quickReplyShortcutId)), ("effect", ConstructorParameterDescription(_data.effect)), ("factcheck", ConstructorParameterDescription(_data.factcheck)), ("reportDeliveryUntilDate", ConstructorParameterDescription(_data.reportDeliveryUntilDate)), ("paidMessageStars", ConstructorParameterDescription(_data.paidMessageStars)), ("suggestedPost", ConstructorParameterDescription(_data.suggestedPost)), ("scheduleRepeatPeriod", ConstructorParameterDescription(_data.scheduleRepeatPeriod)), ("summaryFromLanguage", ConstructorParameterDescription(_data.summaryFromLanguage))]) case .messageEmpty(let _data): return ("messageEmpty", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("peerId", ConstructorParameterDescription(_data.peerId))]) case .messageService(let _data): @@ -1392,111 +1397,117 @@ public extension Api { if Int(_2!) & Int(1 << 0) != 0 { _11 = reader.readInt64() } - var _12: Api.MessageReplyHeader? + var _12: Api.Peer? + if Int(_2!) & Int(1 << 19) != 0 { + if let signature = reader.readInt32() { + _12 = Api.parse(reader, signature: signature) as? Api.Peer + } + } + var _13: Api.MessageReplyHeader? if Int(_1!) & Int(1 << 3) != 0 { if let signature = reader.readInt32() { - _12 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader + _13 = Api.parse(reader, signature: signature) as? Api.MessageReplyHeader } } - var _13: Int32? - _13 = reader.readInt32() - var _14: String? - _14 = parseString(reader) - var _15: Api.MessageMedia? + var _14: Int32? + _14 = reader.readInt32() + var _15: String? + _15 = parseString(reader) + var _16: Api.MessageMedia? if Int(_1!) & Int(1 << 9) != 0 { if let signature = reader.readInt32() { - _15 = Api.parse(reader, signature: signature) as? Api.MessageMedia + _16 = Api.parse(reader, signature: signature) as? Api.MessageMedia } } - var _16: Api.ReplyMarkup? + var _17: Api.ReplyMarkup? if Int(_1!) & Int(1 << 6) != 0 { if let signature = reader.readInt32() { - _16 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup + _17 = Api.parse(reader, signature: signature) as? Api.ReplyMarkup } } - var _17: [Api.MessageEntity]? + var _18: [Api.MessageEntity]? if Int(_1!) & Int(1 << 7) != 0 { if let _ = reader.readInt32() { - _17 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) + _18 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) } } - var _18: Int32? - if Int(_1!) & Int(1 << 10) != 0 { - _18 = reader.readInt32() - } var _19: Int32? if Int(_1!) & Int(1 << 10) != 0 { _19 = reader.readInt32() } - var _20: Api.MessageReplies? + var _20: Int32? + if Int(_1!) & Int(1 << 10) != 0 { + _20 = reader.readInt32() + } + var _21: Api.MessageReplies? if Int(_1!) & Int(1 << 23) != 0 { if let signature = reader.readInt32() { - _20 = Api.parse(reader, signature: signature) as? Api.MessageReplies + _21 = Api.parse(reader, signature: signature) as? Api.MessageReplies } } - var _21: Int32? + var _22: Int32? if Int(_1!) & Int(1 << 15) != 0 { - _21 = reader.readInt32() + _22 = reader.readInt32() } - var _22: String? + var _23: String? if Int(_1!) & Int(1 << 16) != 0 { - _22 = parseString(reader) + _23 = parseString(reader) } - var _23: Int64? + var _24: Int64? if Int(_1!) & Int(1 << 17) != 0 { - _23 = reader.readInt64() + _24 = reader.readInt64() } - var _24: Api.MessageReactions? + var _25: Api.MessageReactions? if Int(_1!) & Int(1 << 20) != 0 { if let signature = reader.readInt32() { - _24 = Api.parse(reader, signature: signature) as? Api.MessageReactions + _25 = Api.parse(reader, signature: signature) as? Api.MessageReactions } } - var _25: [Api.RestrictionReason]? + var _26: [Api.RestrictionReason]? if Int(_1!) & Int(1 << 22) != 0 { if let _ = reader.readInt32() { - _25 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RestrictionReason.self) + _26 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RestrictionReason.self) } } - var _26: Int32? - if Int(_1!) & Int(1 << 25) != 0 { - _26 = reader.readInt32() - } var _27: Int32? - if Int(_1!) & Int(1 << 30) != 0 { + if Int(_1!) & Int(1 << 25) != 0 { _27 = reader.readInt32() } - var _28: Int64? - if Int(_2!) & Int(1 << 2) != 0 { - _28 = reader.readInt64() + var _28: Int32? + if Int(_1!) & Int(1 << 30) != 0 { + _28 = reader.readInt32() } - var _29: Api.FactCheck? + var _29: Int64? + if Int(_2!) & Int(1 << 2) != 0 { + _29 = reader.readInt64() + } + var _30: Api.FactCheck? if Int(_2!) & Int(1 << 3) != 0 { if let signature = reader.readInt32() { - _29 = Api.parse(reader, signature: signature) as? Api.FactCheck + _30 = Api.parse(reader, signature: signature) as? Api.FactCheck } } - var _30: Int32? + var _31: Int32? if Int(_2!) & Int(1 << 5) != 0 { - _30 = reader.readInt32() + _31 = reader.readInt32() } - var _31: Int64? + var _32: Int64? if Int(_2!) & Int(1 << 6) != 0 { - _31 = reader.readInt64() + _32 = reader.readInt64() } - var _32: Api.SuggestedPost? + var _33: Api.SuggestedPost? if Int(_2!) & Int(1 << 7) != 0 { if let signature = reader.readInt32() { - _32 = Api.parse(reader, signature: signature) as? Api.SuggestedPost + _33 = Api.parse(reader, signature: signature) as? Api.SuggestedPost } } - var _33: Int32? + var _34: Int32? if Int(_2!) & Int(1 << 10) != 0 { - _33 = reader.readInt32() + _34 = reader.readInt32() } - var _34: String? + var _35: String? if Int(_2!) & Int(1 << 11) != 0 { - _34 = parseString(reader) + _35 = parseString(reader) } let _c1 = _1 != nil let _c2 = _2 != nil @@ -1509,31 +1520,32 @@ public extension Api { let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil let _c10 = (Int(_1!) & Int(1 << 11) == 0) || _10 != nil let _c11 = (Int(_2!) & Int(1 << 0) == 0) || _11 != nil - let _c12 = (Int(_1!) & Int(1 << 3) == 0) || _12 != nil - let _c13 = _13 != nil + let _c12 = (Int(_2!) & Int(1 << 19) == 0) || _12 != nil + let _c13 = (Int(_1!) & Int(1 << 3) == 0) || _13 != nil let _c14 = _14 != nil - let _c15 = (Int(_1!) & Int(1 << 9) == 0) || _15 != nil - let _c16 = (Int(_1!) & Int(1 << 6) == 0) || _16 != nil - let _c17 = (Int(_1!) & Int(1 << 7) == 0) || _17 != nil - let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil + let _c15 = _15 != nil + let _c16 = (Int(_1!) & Int(1 << 9) == 0) || _16 != nil + let _c17 = (Int(_1!) & Int(1 << 6) == 0) || _17 != nil + let _c18 = (Int(_1!) & Int(1 << 7) == 0) || _18 != nil let _c19 = (Int(_1!) & Int(1 << 10) == 0) || _19 != nil - let _c20 = (Int(_1!) & Int(1 << 23) == 0) || _20 != nil - let _c21 = (Int(_1!) & Int(1 << 15) == 0) || _21 != nil - let _c22 = (Int(_1!) & Int(1 << 16) == 0) || _22 != nil - let _c23 = (Int(_1!) & Int(1 << 17) == 0) || _23 != nil - let _c24 = (Int(_1!) & Int(1 << 20) == 0) || _24 != nil - let _c25 = (Int(_1!) & Int(1 << 22) == 0) || _25 != nil - let _c26 = (Int(_1!) & Int(1 << 25) == 0) || _26 != nil - let _c27 = (Int(_1!) & Int(1 << 30) == 0) || _27 != nil - let _c28 = (Int(_2!) & Int(1 << 2) == 0) || _28 != nil - let _c29 = (Int(_2!) & Int(1 << 3) == 0) || _29 != nil - let _c30 = (Int(_2!) & Int(1 << 5) == 0) || _30 != nil - let _c31 = (Int(_2!) & Int(1 << 6) == 0) || _31 != nil - let _c32 = (Int(_2!) & Int(1 << 7) == 0) || _32 != nil - let _c33 = (Int(_2!) & Int(1 << 10) == 0) || _33 != nil - let _c34 = (Int(_2!) & Int(1 << 11) == 0) || _34 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 { - return Api.Message.message(Cons_message(flags: _1!, flags2: _2!, id: _3!, fromId: _4, fromBoostsApplied: _5, fromRank: _6, peerId: _7!, savedPeerId: _8, fwdFrom: _9, viaBotId: _10, viaBusinessBotId: _11, replyTo: _12, date: _13!, message: _14!, media: _15, replyMarkup: _16, entities: _17, views: _18, forwards: _19, replies: _20, editDate: _21, postAuthor: _22, groupedId: _23, reactions: _24, restrictionReason: _25, ttlPeriod: _26, quickReplyShortcutId: _27, effect: _28, factcheck: _29, reportDeliveryUntilDate: _30, paidMessageStars: _31, suggestedPost: _32, scheduleRepeatPeriod: _33, summaryFromLanguage: _34)) + let _c20 = (Int(_1!) & Int(1 << 10) == 0) || _20 != nil + let _c21 = (Int(_1!) & Int(1 << 23) == 0) || _21 != nil + let _c22 = (Int(_1!) & Int(1 << 15) == 0) || _22 != nil + let _c23 = (Int(_1!) & Int(1 << 16) == 0) || _23 != nil + let _c24 = (Int(_1!) & Int(1 << 17) == 0) || _24 != nil + let _c25 = (Int(_1!) & Int(1 << 20) == 0) || _25 != nil + let _c26 = (Int(_1!) & Int(1 << 22) == 0) || _26 != nil + let _c27 = (Int(_1!) & Int(1 << 25) == 0) || _27 != nil + let _c28 = (Int(_1!) & Int(1 << 30) == 0) || _28 != nil + let _c29 = (Int(_2!) & Int(1 << 2) == 0) || _29 != nil + let _c30 = (Int(_2!) & Int(1 << 3) == 0) || _30 != nil + let _c31 = (Int(_2!) & Int(1 << 5) == 0) || _31 != nil + let _c32 = (Int(_2!) & Int(1 << 6) == 0) || _32 != nil + let _c33 = (Int(_2!) & Int(1 << 7) == 0) || _33 != nil + let _c34 = (Int(_2!) & Int(1 << 10) == 0) || _34 != nil + let _c35 = (Int(_2!) & Int(1 << 11) == 0) || _35 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 && _c20 && _c21 && _c22 && _c23 && _c24 && _c25 && _c26 && _c27 && _c28 && _c29 && _c30 && _c31 && _c32 && _c33 && _c34 && _c35 { + return Api.Message.message(Cons_message(flags: _1!, flags2: _2!, id: _3!, fromId: _4, fromBoostsApplied: _5, fromRank: _6, peerId: _7!, savedPeerId: _8, fwdFrom: _9, viaBotId: _10, viaBusinessBotId: _11, guestchatViaFrom: _12, replyTo: _13, date: _14!, message: _15!, media: _16, replyMarkup: _17, entities: _18, views: _19, forwards: _20, replies: _21, editDate: _22, postAuthor: _23, groupedId: _24, reactions: _25, restrictionReason: _26, ttlPeriod: _27, quickReplyShortcutId: _28, effect: _29, factcheck: _30, reportDeliveryUntilDate: _31, paidMessageStars: _32, suggestedPost: _33, scheduleRepeatPeriod: _34, summaryFromLanguage: _35)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api19.swift b/submodules/TelegramApi/Sources/Api19.swift index dad55093d8..613499dcde 100644 --- a/submodules/TelegramApi/Sources/Api19.swift +++ b/submodules/TelegramApi/Sources/Api19.swift @@ -1801,431 +1801,48 @@ public extension Api { } } public extension Api { - enum PhoneCall: TypeConstructorDescription { - public class Cons_phoneCall: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var accessHash: Int64 - public var date: Int32 - public var adminId: Int64 - public var participantId: Int64 - public var gAOrB: Buffer - public var keyFingerprint: Int64 - public var `protocol`: Api.PhoneCallProtocol - public var connections: [Api.PhoneConnection] - public var startDate: Int32 - public var customParameters: Api.DataJSON? - public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32, customParameters: Api.DataJSON?) { - self.flags = flags - self.id = id - self.accessHash = accessHash - self.date = date - self.adminId = adminId - self.participantId = participantId - self.gAOrB = gAOrB - self.keyFingerprint = keyFingerprint - self.`protocol` = `protocol` - self.connections = connections - self.startDate = startDate - self.customParameters = customParameters + enum PersonalChannel: TypeConstructorDescription { + public class Cons_personalChannel: TypeConstructorDescription { + public var userId: Int64 + public var channelId: Int64 + public init(userId: Int64, channelId: Int64) { + self.userId = userId + self.channelId = channelId } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCall", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAOrB", ConstructorParameterDescription(self.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(self.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("connections", ConstructorParameterDescription(self.connections)), ("startDate", ConstructorParameterDescription(self.startDate)), ("customParameters", ConstructorParameterDescription(self.customParameters))]) + return ("personalChannel", [("userId", ConstructorParameterDescription(self.userId)), ("channelId", ConstructorParameterDescription(self.channelId))]) } } - public class Cons_phoneCallAccepted: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var accessHash: Int64 - public var date: Int32 - public var adminId: Int64 - public var participantId: Int64 - public var gB: Buffer - public var `protocol`: Api.PhoneCallProtocol - public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, `protocol`: Api.PhoneCallProtocol) { - self.flags = flags - self.id = id - self.accessHash = accessHash - self.date = date - self.adminId = adminId - self.participantId = participantId - self.gB = gB - self.`protocol` = `protocol` - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gB", ConstructorParameterDescription(self.gB)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))]) - } - } - public class Cons_phoneCallDiscarded: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var reason: Api.PhoneCallDiscardReason? - public var duration: Int32? - public init(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) { - self.flags = flags - self.id = id - self.reason = reason - self.duration = duration - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("reason", ConstructorParameterDescription(self.reason)), ("duration", ConstructorParameterDescription(self.duration))]) - } - } - public class Cons_phoneCallEmpty: TypeConstructorDescription { - public var id: Int64 - public init(id: Int64) { - self.id = id - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCallEmpty", [("id", ConstructorParameterDescription(self.id))]) - } - } - public class Cons_phoneCallRequested: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var accessHash: Int64 - public var date: Int32 - public var adminId: Int64 - public var participantId: Int64 - public var gAHash: Buffer - public var `protocol`: Api.PhoneCallProtocol - public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) { - self.flags = flags - self.id = id - self.accessHash = accessHash - self.date = date - self.adminId = adminId - self.participantId = participantId - self.gAHash = gAHash - self.`protocol` = `protocol` - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCallRequested", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAHash", ConstructorParameterDescription(self.gAHash)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))]) - } - } - public class Cons_phoneCallWaiting: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var accessHash: Int64 - public var date: Int32 - public var adminId: Int64 - public var participantId: Int64 - public var `protocol`: Api.PhoneCallProtocol - public var receiveDate: Int32? - public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, `protocol`: Api.PhoneCallProtocol, receiveDate: Int32?) { - self.flags = flags - self.id = id - self.accessHash = accessHash - self.date = date - self.adminId = adminId - self.participantId = participantId - self.`protocol` = `protocol` - self.receiveDate = receiveDate - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("receiveDate", ConstructorParameterDescription(self.receiveDate))]) - } - } - case phoneCall(Cons_phoneCall) - case phoneCallAccepted(Cons_phoneCallAccepted) - case phoneCallDiscarded(Cons_phoneCallDiscarded) - case phoneCallEmpty(Cons_phoneCallEmpty) - case phoneCallRequested(Cons_phoneCallRequested) - case phoneCallWaiting(Cons_phoneCallWaiting) + case personalChannel(Cons_personalChannel) public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { - case .phoneCall(let _data): + case .personalChannel(let _data): if boxed { - buffer.appendInt32(810769141) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.adminId, buffer: buffer, boxed: false) - serializeInt64(_data.participantId, buffer: buffer, boxed: false) - serializeBytes(_data.gAOrB, buffer: buffer, boxed: false) - serializeInt64(_data.keyFingerprint, buffer: buffer, boxed: false) - _data.`protocol`.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.connections.count)) - for item in _data.connections { - item.serialize(buffer, true) - } - serializeInt32(_data.startDate, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 7) != 0 { - _data.customParameters!.serialize(buffer, true) - } - break - case .phoneCallAccepted(let _data): - if boxed { - buffer.appendInt32(912311057) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.adminId, buffer: buffer, boxed: false) - serializeInt64(_data.participantId, buffer: buffer, boxed: false) - serializeBytes(_data.gB, buffer: buffer, boxed: false) - _data.`protocol`.serialize(buffer, true) - break - case .phoneCallDiscarded(let _data): - if boxed { - buffer.appendInt32(1355435489) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.reason!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.duration!, buffer: buffer, boxed: false) - } - break - case .phoneCallEmpty(let _data): - if boxed { - buffer.appendInt32(1399245077) - } - serializeInt64(_data.id, buffer: buffer, boxed: false) - break - case .phoneCallRequested(let _data): - if boxed { - buffer.appendInt32(347139340) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.adminId, buffer: buffer, boxed: false) - serializeInt64(_data.participantId, buffer: buffer, boxed: false) - serializeBytes(_data.gAHash, buffer: buffer, boxed: false) - _data.`protocol`.serialize(buffer, true) - break - case .phoneCallWaiting(let _data): - if boxed { - buffer.appendInt32(-987599081) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.adminId, buffer: buffer, boxed: false) - serializeInt64(_data.participantId, buffer: buffer, boxed: false) - _data.`protocol`.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.receiveDate!, buffer: buffer, boxed: false) + buffer.appendInt32(431767677) } + serializeInt64(_data.userId, buffer: buffer, boxed: false) + serializeInt64(_data.channelId, buffer: buffer, boxed: false) break } } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { - case .phoneCall(let _data): - return ("phoneCall", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAOrB", ConstructorParameterDescription(_data.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(_data.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("connections", ConstructorParameterDescription(_data.connections)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("customParameters", ConstructorParameterDescription(_data.customParameters))]) - case .phoneCallAccepted(let _data): - return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gB", ConstructorParameterDescription(_data.gB)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))]) - case .phoneCallDiscarded(let _data): - return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("reason", ConstructorParameterDescription(_data.reason)), ("duration", ConstructorParameterDescription(_data.duration))]) - case .phoneCallEmpty(let _data): - return ("phoneCallEmpty", [("id", ConstructorParameterDescription(_data.id))]) - case .phoneCallRequested(let _data): - return ("phoneCallRequested", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAHash", ConstructorParameterDescription(_data.gAHash)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))]) - case .phoneCallWaiting(let _data): - return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("receiveDate", ConstructorParameterDescription(_data.receiveDate))]) + case .personalChannel(let _data): + return ("personalChannel", [("userId", ConstructorParameterDescription(_data.userId)), ("channelId", ConstructorParameterDescription(_data.channelId))]) } } - public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int64? - _5 = reader.readInt64() - var _6: Int64? - _6 = reader.readInt64() - var _7: Buffer? - _7 = parseBytes(reader) - var _8: Int64? - _8 = reader.readInt64() - var _9: Api.PhoneCallProtocol? - if let signature = reader.readInt32() { - _9 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol - } - var _10: [Api.PhoneConnection]? - if let _ = reader.readInt32() { - _10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhoneConnection.self) - } - var _11: Int32? - _11 = reader.readInt32() - var _12: Api.DataJSON? - if Int(_1!) & Int(1 << 7) != 0 { - if let signature = reader.readInt32() { - _12 = Api.parse(reader, signature: signature) as? Api.DataJSON - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - let _c8 = _8 != nil - let _c9 = _9 != nil - let _c10 = _10 != nil - let _c11 = _11 != nil - let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { - return Api.PhoneCall.phoneCall(Cons_phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12)) - } - else { - return nil - } - } - public static func parse_phoneCallAccepted(_ reader: BufferReader) -> PhoneCall? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int64? - _5 = reader.readInt64() - var _6: Int64? - _6 = reader.readInt64() - var _7: Buffer? - _7 = parseBytes(reader) - var _8: Api.PhoneCallProtocol? - if let signature = reader.readInt32() { - _8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - let _c8 = _8 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { - return Api.PhoneCall.phoneCallAccepted(Cons_phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!)) - } - else { - return nil - } - } - public static func parse_phoneCallDiscarded(_ reader: BufferReader) -> PhoneCall? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Api.PhoneCallDiscardReason? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.PhoneCallDiscardReason - } - } - var _4: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _4 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.PhoneCall.phoneCallDiscarded(Cons_phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4)) - } - else { - return nil - } - } - public static func parse_phoneCallEmpty(_ reader: BufferReader) -> PhoneCall? { + public static func parse_personalChannel(_ reader: BufferReader) -> PersonalChannel? { var _1: Int64? _1 = reader.readInt64() - let _c1 = _1 != nil - if _c1 { - return Api.PhoneCall.phoneCallEmpty(Cons_phoneCallEmpty(id: _1!)) - } - else { - return nil - } - } - public static func parse_phoneCallRequested(_ reader: BufferReader) -> PhoneCall? { - var _1: Int32? - _1 = reader.readInt32() var _2: Int64? _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int64? - _5 = reader.readInt64() - var _6: Int64? - _6 = reader.readInt64() - var _7: Buffer? - _7 = parseBytes(reader) - var _8: Api.PhoneCallProtocol? - if let signature = reader.readInt32() { - _8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol - } let _c1 = _1 != nil let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - let _c8 = _8 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { - return Api.PhoneCall.phoneCallRequested(Cons_phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!)) - } - else { - return nil - } - } - public static func parse_phoneCallWaiting(_ reader: BufferReader) -> PhoneCall? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int64? - _5 = reader.readInt64() - var _6: Int64? - _6 = reader.readInt64() - var _7: Api.PhoneCallProtocol? - if let signature = reader.readInt32() { - _7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol - } - var _8: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _8 = 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 - let _c7 = _7 != nil - let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { - return Api.PhoneCall.phoneCallWaiting(Cons_phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8)) + if _c1 && _c2 { + return Api.PersonalChannel.personalChannel(Cons_personalChannel(userId: _1!, channelId: _2!)) } else { return nil diff --git a/submodules/TelegramApi/Sources/Api2.swift b/submodules/TelegramApi/Sources/Api2.swift index f9f45b3af7..27c919d20b 100644 --- a/submodules/TelegramApi/Sources/Api2.swift +++ b/submodules/TelegramApi/Sources/Api2.swift @@ -1,3 +1,97 @@ +public extension Api { + enum BotAppSettings: TypeConstructorDescription { + public class Cons_botAppSettings: TypeConstructorDescription { + public var flags: Int32 + public var placeholderPath: Buffer? + public var backgroundColor: Int32? + public var backgroundDarkColor: Int32? + public var headerColor: Int32? + public var headerDarkColor: Int32? + public init(flags: Int32, placeholderPath: Buffer?, backgroundColor: Int32?, backgroundDarkColor: Int32?, headerColor: Int32?, headerDarkColor: Int32?) { + self.flags = flags + self.placeholderPath = placeholderPath + self.backgroundColor = backgroundColor + self.backgroundDarkColor = backgroundDarkColor + self.headerColor = headerColor + self.headerDarkColor = headerDarkColor + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("botAppSettings", [("flags", ConstructorParameterDescription(self.flags)), ("placeholderPath", ConstructorParameterDescription(self.placeholderPath)), ("backgroundColor", ConstructorParameterDescription(self.backgroundColor)), ("backgroundDarkColor", ConstructorParameterDescription(self.backgroundDarkColor)), ("headerColor", ConstructorParameterDescription(self.headerColor)), ("headerDarkColor", ConstructorParameterDescription(self.headerDarkColor))]) + } + } + case botAppSettings(Cons_botAppSettings) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .botAppSettings(let _data): + if boxed { + buffer.appendInt32(-912582320) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeBytes(_data.placeholderPath!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.backgroundColor!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt32(_data.backgroundDarkColor!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.headerColor!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.headerDarkColor!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .botAppSettings(let _data): + return ("botAppSettings", [("flags", ConstructorParameterDescription(_data.flags)), ("placeholderPath", ConstructorParameterDescription(_data.placeholderPath)), ("backgroundColor", ConstructorParameterDescription(_data.backgroundColor)), ("backgroundDarkColor", ConstructorParameterDescription(_data.backgroundDarkColor)), ("headerColor", ConstructorParameterDescription(_data.headerColor)), ("headerDarkColor", ConstructorParameterDescription(_data.headerDarkColor))]) + } + } + + public static func parse_botAppSettings(_ reader: BufferReader) -> BotAppSettings? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Buffer? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = parseBytes(reader) + } + var _3: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _3 = reader.readInt32() + } + var _4: Int32? + if Int(_1!) & Int(1 << 2) != 0 { + _4 = reader.readInt32() + } + var _5: Int32? + if Int(_1!) & Int(1 << 3) != 0 { + _5 = reader.readInt32() + } + var _6: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _6 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 4) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.BotAppSettings.botAppSettings(Cons_botAppSettings(flags: _1!, placeholderPath: _2, backgroundColor: _3, backgroundDarkColor: _4, headerColor: _5, headerDarkColor: _6)) + } + else { + return nil + } + } + } +} public extension Api { enum BotBusinessConnection: TypeConstructorDescription { public class Cons_botBusinessConnection: TypeConstructorDescription { @@ -1663,91 +1757,3 @@ public extension Api { } } } -public extension Api { - enum BusinessChatLink: TypeConstructorDescription { - public class Cons_businessChatLink: TypeConstructorDescription { - public var flags: Int32 - public var link: String - public var message: String - public var entities: [Api.MessageEntity]? - public var title: String? - public var views: Int32 - public init(flags: Int32, link: String, message: String, entities: [Api.MessageEntity]?, title: String?, views: Int32) { - self.flags = flags - self.link = link - self.message = message - self.entities = entities - self.title = title - self.views = views - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("businessChatLink", [("flags", ConstructorParameterDescription(self.flags)), ("link", ConstructorParameterDescription(self.link)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("title", ConstructorParameterDescription(self.title)), ("views", ConstructorParameterDescription(self.views))]) - } - } - case businessChatLink(Cons_businessChatLink) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .businessChatLink(let _data): - if boxed { - buffer.appendInt32(-1263638929) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.link, buffer: buffer, boxed: false) - serializeString(_data.message, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.entities!.count)) - for item in _data.entities! { - item.serialize(buffer, true) - } - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.title!, buffer: buffer, boxed: false) - } - serializeInt32(_data.views, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .businessChatLink(let _data): - return ("businessChatLink", [("flags", ConstructorParameterDescription(_data.flags)), ("link", ConstructorParameterDescription(_data.link)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("title", ConstructorParameterDescription(_data.title)), ("views", ConstructorParameterDescription(_data.views))]) - } - } - - public static func parse_businessChatLink(_ reader: BufferReader) -> BusinessChatLink? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: String? - _3 = parseString(reader) - var _4: [Api.MessageEntity]? - if Int(_1!) & Int(1 << 0) != 0 { - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) - } - } - var _5: String? - if Int(_1!) & Int(1 << 1) != 0 { - _5 = parseString(reader) - } - var _6: Int32? - _6 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil - let _c6 = _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.BusinessChatLink.businessChatLink(Cons_businessChatLink(flags: _1!, link: _2!, message: _3!, entities: _4, title: _5, views: _6!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api20.swift b/submodules/TelegramApi/Sources/Api20.swift index 5b522e41e1..b3327597a5 100644 --- a/submodules/TelegramApi/Sources/Api20.swift +++ b/submodules/TelegramApi/Sources/Api20.swift @@ -1,3 +1,436 @@ +public extension Api { + enum PhoneCall: TypeConstructorDescription { + public class Cons_phoneCall: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var date: Int32 + public var adminId: Int64 + public var participantId: Int64 + public var gAOrB: Buffer + public var keyFingerprint: Int64 + public var `protocol`: Api.PhoneCallProtocol + public var connections: [Api.PhoneConnection] + public var startDate: Int32 + public var customParameters: Api.DataJSON? + public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAOrB: Buffer, keyFingerprint: Int64, `protocol`: Api.PhoneCallProtocol, connections: [Api.PhoneConnection], startDate: Int32, customParameters: Api.DataJSON?) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.date = date + self.adminId = adminId + self.participantId = participantId + self.gAOrB = gAOrB + self.keyFingerprint = keyFingerprint + self.`protocol` = `protocol` + self.connections = connections + self.startDate = startDate + self.customParameters = customParameters + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCall", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAOrB", ConstructorParameterDescription(self.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(self.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("connections", ConstructorParameterDescription(self.connections)), ("startDate", ConstructorParameterDescription(self.startDate)), ("customParameters", ConstructorParameterDescription(self.customParameters))]) + } + } + public class Cons_phoneCallAccepted: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var date: Int32 + public var adminId: Int64 + public var participantId: Int64 + public var gB: Buffer + public var `protocol`: Api.PhoneCallProtocol + public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gB: Buffer, `protocol`: Api.PhoneCallProtocol) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.date = date + self.adminId = adminId + self.participantId = participantId + self.gB = gB + self.`protocol` = `protocol` + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gB", ConstructorParameterDescription(self.gB)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))]) + } + } + public class Cons_phoneCallDiscarded: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var reason: Api.PhoneCallDiscardReason? + public var duration: Int32? + public init(flags: Int32, id: Int64, reason: Api.PhoneCallDiscardReason?, duration: Int32?) { + self.flags = flags + self.id = id + self.reason = reason + self.duration = duration + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("reason", ConstructorParameterDescription(self.reason)), ("duration", ConstructorParameterDescription(self.duration))]) + } + } + public class Cons_phoneCallEmpty: TypeConstructorDescription { + public var id: Int64 + public init(id: Int64) { + self.id = id + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCallEmpty", [("id", ConstructorParameterDescription(self.id))]) + } + } + public class Cons_phoneCallRequested: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var date: Int32 + public var adminId: Int64 + public var participantId: Int64 + public var gAHash: Buffer + public var `protocol`: Api.PhoneCallProtocol + public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, gAHash: Buffer, `protocol`: Api.PhoneCallProtocol) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.date = date + self.adminId = adminId + self.participantId = participantId + self.gAHash = gAHash + self.`protocol` = `protocol` + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCallRequested", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("gAHash", ConstructorParameterDescription(self.gAHash)), ("`protocol`", ConstructorParameterDescription(self.`protocol`))]) + } + } + public class Cons_phoneCallWaiting: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var date: Int32 + public var adminId: Int64 + public var participantId: Int64 + public var `protocol`: Api.PhoneCallProtocol + public var receiveDate: Int32? + public init(flags: Int32, id: Int64, accessHash: Int64, date: Int32, adminId: Int64, participantId: Int64, `protocol`: Api.PhoneCallProtocol, receiveDate: Int32?) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.date = date + self.adminId = adminId + self.participantId = participantId + self.`protocol` = `protocol` + self.receiveDate = receiveDate + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("date", ConstructorParameterDescription(self.date)), ("adminId", ConstructorParameterDescription(self.adminId)), ("participantId", ConstructorParameterDescription(self.participantId)), ("`protocol`", ConstructorParameterDescription(self.`protocol`)), ("receiveDate", ConstructorParameterDescription(self.receiveDate))]) + } + } + case phoneCall(Cons_phoneCall) + case phoneCallAccepted(Cons_phoneCallAccepted) + case phoneCallDiscarded(Cons_phoneCallDiscarded) + case phoneCallEmpty(Cons_phoneCallEmpty) + case phoneCallRequested(Cons_phoneCallRequested) + case phoneCallWaiting(Cons_phoneCallWaiting) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .phoneCall(let _data): + if boxed { + buffer.appendInt32(810769141) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.adminId, buffer: buffer, boxed: false) + serializeInt64(_data.participantId, buffer: buffer, boxed: false) + serializeBytes(_data.gAOrB, buffer: buffer, boxed: false) + serializeInt64(_data.keyFingerprint, buffer: buffer, boxed: false) + _data.`protocol`.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.connections.count)) + for item in _data.connections { + item.serialize(buffer, true) + } + serializeInt32(_data.startDate, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 7) != 0 { + _data.customParameters!.serialize(buffer, true) + } + break + case .phoneCallAccepted(let _data): + if boxed { + buffer.appendInt32(912311057) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.adminId, buffer: buffer, boxed: false) + serializeInt64(_data.participantId, buffer: buffer, boxed: false) + serializeBytes(_data.gB, buffer: buffer, boxed: false) + _data.`protocol`.serialize(buffer, true) + break + case .phoneCallDiscarded(let _data): + if boxed { + buffer.appendInt32(1355435489) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.reason!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.duration!, buffer: buffer, boxed: false) + } + break + case .phoneCallEmpty(let _data): + if boxed { + buffer.appendInt32(1399245077) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + break + case .phoneCallRequested(let _data): + if boxed { + buffer.appendInt32(347139340) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.adminId, buffer: buffer, boxed: false) + serializeInt64(_data.participantId, buffer: buffer, boxed: false) + serializeBytes(_data.gAHash, buffer: buffer, boxed: false) + _data.`protocol`.serialize(buffer, true) + break + case .phoneCallWaiting(let _data): + if boxed { + buffer.appendInt32(-987599081) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.adminId, buffer: buffer, boxed: false) + serializeInt64(_data.participantId, buffer: buffer, boxed: false) + _data.`protocol`.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.receiveDate!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .phoneCall(let _data): + return ("phoneCall", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAOrB", ConstructorParameterDescription(_data.gAOrB)), ("keyFingerprint", ConstructorParameterDescription(_data.keyFingerprint)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("connections", ConstructorParameterDescription(_data.connections)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("customParameters", ConstructorParameterDescription(_data.customParameters))]) + case .phoneCallAccepted(let _data): + return ("phoneCallAccepted", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gB", ConstructorParameterDescription(_data.gB)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))]) + case .phoneCallDiscarded(let _data): + return ("phoneCallDiscarded", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("reason", ConstructorParameterDescription(_data.reason)), ("duration", ConstructorParameterDescription(_data.duration))]) + case .phoneCallEmpty(let _data): + return ("phoneCallEmpty", [("id", ConstructorParameterDescription(_data.id))]) + case .phoneCallRequested(let _data): + return ("phoneCallRequested", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("gAHash", ConstructorParameterDescription(_data.gAHash)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`))]) + case .phoneCallWaiting(let _data): + return ("phoneCallWaiting", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("date", ConstructorParameterDescription(_data.date)), ("adminId", ConstructorParameterDescription(_data.adminId)), ("participantId", ConstructorParameterDescription(_data.participantId)), ("`protocol`", ConstructorParameterDescription(_data.`protocol`)), ("receiveDate", ConstructorParameterDescription(_data.receiveDate))]) + } + } + + public static func parse_phoneCall(_ reader: BufferReader) -> PhoneCall? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() + var _7: Buffer? + _7 = parseBytes(reader) + var _8: Int64? + _8 = reader.readInt64() + var _9: Api.PhoneCallProtocol? + if let signature = reader.readInt32() { + _9 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol + } + var _10: [Api.PhoneConnection]? + if let _ = reader.readInt32() { + _10 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhoneConnection.self) + } + var _11: Int32? + _11 = reader.readInt32() + var _12: Api.DataJSON? + if Int(_1!) & Int(1 << 7) != 0 { + if let signature = reader.readInt32() { + _12 = Api.parse(reader, signature: signature) as? Api.DataJSON + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + let _c9 = _9 != nil + let _c10 = _10 != nil + let _c11 = _11 != nil + let _c12 = (Int(_1!) & Int(1 << 7) == 0) || _12 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { + return Api.PhoneCall.phoneCall(Cons_phoneCall(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAOrB: _7!, keyFingerprint: _8!, protocol: _9!, connections: _10!, startDate: _11!, customParameters: _12)) + } + else { + return nil + } + } + public static func parse_phoneCallAccepted(_ reader: BufferReader) -> PhoneCall? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() + var _7: Buffer? + _7 = parseBytes(reader) + var _8: Api.PhoneCallProtocol? + if let signature = reader.readInt32() { + _8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.PhoneCall.phoneCallAccepted(Cons_phoneCallAccepted(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gB: _7!, protocol: _8!)) + } + else { + return nil + } + } + public static func parse_phoneCallDiscarded(_ reader: BufferReader) -> PhoneCall? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Api.PhoneCallDiscardReason? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.PhoneCallDiscardReason + } + } + var _4: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _4 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.PhoneCall.phoneCallDiscarded(Cons_phoneCallDiscarded(flags: _1!, id: _2!, reason: _3, duration: _4)) + } + else { + return nil + } + } + public static func parse_phoneCallEmpty(_ reader: BufferReader) -> PhoneCall? { + var _1: Int64? + _1 = reader.readInt64() + let _c1 = _1 != nil + if _c1 { + return Api.PhoneCall.phoneCallEmpty(Cons_phoneCallEmpty(id: _1!)) + } + else { + return nil + } + } + public static func parse_phoneCallRequested(_ reader: BufferReader) -> PhoneCall? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() + var _7: Buffer? + _7 = parseBytes(reader) + var _8: Api.PhoneCallProtocol? + if let signature = reader.readInt32() { + _8 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.PhoneCall.phoneCallRequested(Cons_phoneCallRequested(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, gAHash: _7!, protocol: _8!)) + } + else { + return nil + } + } + public static func parse_phoneCallWaiting(_ reader: BufferReader) -> PhoneCall? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() + var _7: Api.PhoneCallProtocol? + if let signature = reader.readInt32() { + _7 = Api.parse(reader, signature: signature) as? Api.PhoneCallProtocol + } + var _8: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _8 = 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 + let _c7 = _7 != nil + let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.PhoneCall.phoneCallWaiting(Cons_phoneCallWaiting(flags: _1!, id: _2!, accessHash: _3!, date: _4!, adminId: _5!, participantId: _6!, protocol: _7!, receiveDate: _8)) + } + else { + return nil + } + } + } +} public extension Api { enum PhoneCallDiscardReason: TypeConstructorDescription { public class Cons_phoneCallDiscardReasonMigrateConferenceCall: TypeConstructorDescription { @@ -694,18 +1127,20 @@ public extension Api { public var answers: [Api.PollAnswer] public var closePeriod: Int32? public var closeDate: Int32? + public var countriesIso2: [String]? public var hash: Int64 - public init(id: Int64, flags: Int32, question: Api.TextWithEntities, answers: [Api.PollAnswer], closePeriod: Int32?, closeDate: Int32?, hash: Int64) { + public init(id: Int64, flags: Int32, question: Api.TextWithEntities, answers: [Api.PollAnswer], closePeriod: Int32?, closeDate: Int32?, countriesIso2: [String]?, hash: Int64) { self.id = id self.flags = flags self.question = question self.answers = answers self.closePeriod = closePeriod self.closeDate = closeDate + self.countriesIso2 = countriesIso2 self.hash = hash } public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("poll", [("id", ConstructorParameterDescription(self.id)), ("flags", ConstructorParameterDescription(self.flags)), ("question", ConstructorParameterDescription(self.question)), ("answers", ConstructorParameterDescription(self.answers)), ("closePeriod", ConstructorParameterDescription(self.closePeriod)), ("closeDate", ConstructorParameterDescription(self.closeDate)), ("hash", ConstructorParameterDescription(self.hash))]) + return ("poll", [("id", ConstructorParameterDescription(self.id)), ("flags", ConstructorParameterDescription(self.flags)), ("question", ConstructorParameterDescription(self.question)), ("answers", ConstructorParameterDescription(self.answers)), ("closePeriod", ConstructorParameterDescription(self.closePeriod)), ("closeDate", ConstructorParameterDescription(self.closeDate)), ("countriesIso2", ConstructorParameterDescription(self.countriesIso2)), ("hash", ConstructorParameterDescription(self.hash))]) } } case poll(Cons_poll) @@ -714,7 +1149,7 @@ public extension Api { switch self { case .poll(let _data): if boxed { - buffer.appendInt32(-1203610647) + buffer.appendInt32(-1771164225) } serializeInt64(_data.id, buffer: buffer, boxed: false) serializeInt32(_data.flags, buffer: buffer, boxed: false) @@ -730,6 +1165,13 @@ public extension Api { if Int(_data.flags) & Int(1 << 5) != 0 { serializeInt32(_data.closeDate!, buffer: buffer, boxed: false) } + if Int(_data.flags) & Int(1 << 12) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.countriesIso2!.count)) + for item in _data.countriesIso2! { + serializeString(item, buffer: buffer, boxed: false) + } + } serializeInt64(_data.hash, buffer: buffer, boxed: false) break } @@ -738,7 +1180,7 @@ public extension Api { public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { case .poll(let _data): - return ("poll", [("id", ConstructorParameterDescription(_data.id)), ("flags", ConstructorParameterDescription(_data.flags)), ("question", ConstructorParameterDescription(_data.question)), ("answers", ConstructorParameterDescription(_data.answers)), ("closePeriod", ConstructorParameterDescription(_data.closePeriod)), ("closeDate", ConstructorParameterDescription(_data.closeDate)), ("hash", ConstructorParameterDescription(_data.hash))]) + return ("poll", [("id", ConstructorParameterDescription(_data.id)), ("flags", ConstructorParameterDescription(_data.flags)), ("question", ConstructorParameterDescription(_data.question)), ("answers", ConstructorParameterDescription(_data.answers)), ("closePeriod", ConstructorParameterDescription(_data.closePeriod)), ("closeDate", ConstructorParameterDescription(_data.closeDate)), ("countriesIso2", ConstructorParameterDescription(_data.countriesIso2)), ("hash", ConstructorParameterDescription(_data.hash))]) } } @@ -763,17 +1205,24 @@ public extension Api { if Int(_2!) & Int(1 << 5) != 0 { _6 = reader.readInt32() } - var _7: Int64? - _7 = reader.readInt64() + var _7: [String]? + if Int(_2!) & Int(1 << 12) != 0 { + if let _ = reader.readInt32() { + _7 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self) + } + } + var _8: Int64? + _8 = reader.readInt64() let _c1 = _1 != nil let _c2 = _2 != nil let _c3 = _3 != nil let _c4 = _4 != nil let _c5 = (Int(_2!) & Int(1 << 4) == 0) || _5 != nil let _c6 = (Int(_2!) & Int(1 << 5) == 0) || _6 != nil - let _c7 = _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.Poll.poll(Cons_poll(id: _1!, flags: _2!, question: _3!, answers: _4!, closePeriod: _5, closeDate: _6, hash: _7!)) + let _c7 = (Int(_2!) & Int(1 << 12) == 0) || _7 != nil + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.Poll.poll(Cons_poll(id: _1!, flags: _2!, question: _3!, answers: _4!, closePeriod: _5, closeDate: _6, countriesIso2: _7, hash: _8!)) } else { return nil @@ -1443,375 +1892,3 @@ public extension Api { } } } -public extension Api { - enum PremiumSubscriptionOption: TypeConstructorDescription { - public class Cons_premiumSubscriptionOption: TypeConstructorDescription { - public var flags: Int32 - public var transaction: String? - public var months: Int32 - public var currency: String - public var amount: Int64 - public var botUrl: String - public var storeProduct: String? - public init(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) { - self.flags = flags - self.transaction = transaction - self.months = months - self.currency = currency - self.amount = amount - self.botUrl = botUrl - self.storeProduct = storeProduct - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(self.flags)), ("transaction", ConstructorParameterDescription(self.transaction)), ("months", ConstructorParameterDescription(self.months)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("botUrl", ConstructorParameterDescription(self.botUrl)), ("storeProduct", ConstructorParameterDescription(self.storeProduct))]) - } - } - case premiumSubscriptionOption(Cons_premiumSubscriptionOption) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .premiumSubscriptionOption(let _data): - if boxed { - buffer.appendInt32(1596792306) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeString(_data.transaction!, buffer: buffer, boxed: false) - } - serializeInt32(_data.months, buffer: buffer, boxed: false) - serializeString(_data.currency, buffer: buffer, boxed: false) - serializeInt64(_data.amount, buffer: buffer, boxed: false) - serializeString(_data.botUrl, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.storeProduct!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .premiumSubscriptionOption(let _data): - return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(_data.flags)), ("transaction", ConstructorParameterDescription(_data.transaction)), ("months", ConstructorParameterDescription(_data.months)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("botUrl", ConstructorParameterDescription(_data.botUrl)), ("storeProduct", ConstructorParameterDescription(_data.storeProduct))]) - } - } - - public static func parse_premiumSubscriptionOption(_ reader: BufferReader) -> PremiumSubscriptionOption? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - if Int(_1!) & Int(1 << 3) != 0 { - _2 = parseString(reader) - } - var _3: Int32? - _3 = reader.readInt32() - var _4: String? - _4 = parseString(reader) - var _5: Int64? - _5 = reader.readInt64() - var _6: String? - _6 = parseString(reader) - var _7: String? - if Int(_1!) & Int(1 << 0) != 0 { - _7 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.PremiumSubscriptionOption.premiumSubscriptionOption(Cons_premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7)) - } - else { - return nil - } - } - } -} -public extension Api { - enum PrepaidGiveaway: TypeConstructorDescription { - public class Cons_prepaidGiveaway: TypeConstructorDescription { - public var id: Int64 - public var months: Int32 - public var quantity: Int32 - public var date: Int32 - public init(id: Int64, months: Int32, quantity: Int32, date: Int32) { - self.id = id - self.months = months - self.quantity = quantity - self.date = date - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("prepaidGiveaway", [("id", ConstructorParameterDescription(self.id)), ("months", ConstructorParameterDescription(self.months)), ("quantity", ConstructorParameterDescription(self.quantity)), ("date", ConstructorParameterDescription(self.date))]) - } - } - public class Cons_prepaidStarsGiveaway: TypeConstructorDescription { - public var id: Int64 - public var stars: Int64 - public var quantity: Int32 - public var boosts: Int32 - public var date: Int32 - public init(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) { - self.id = id - self.stars = stars - self.quantity = quantity - self.boosts = boosts - self.date = date - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(self.id)), ("stars", ConstructorParameterDescription(self.stars)), ("quantity", ConstructorParameterDescription(self.quantity)), ("boosts", ConstructorParameterDescription(self.boosts)), ("date", ConstructorParameterDescription(self.date))]) - } - } - case prepaidGiveaway(Cons_prepaidGiveaway) - case prepaidStarsGiveaway(Cons_prepaidStarsGiveaway) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .prepaidGiveaway(let _data): - if boxed { - buffer.appendInt32(-1303143084) - } - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt32(_data.months, buffer: buffer, boxed: false) - serializeInt32(_data.quantity, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - break - case .prepaidStarsGiveaway(let _data): - if boxed { - buffer.appendInt32(-1700956192) - } - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.stars, buffer: buffer, boxed: false) - serializeInt32(_data.quantity, buffer: buffer, boxed: false) - serializeInt32(_data.boosts, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .prepaidGiveaway(let _data): - return ("prepaidGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("months", ConstructorParameterDescription(_data.months)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("date", ConstructorParameterDescription(_data.date))]) - case .prepaidStarsGiveaway(let _data): - return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("stars", ConstructorParameterDescription(_data.stars)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("boosts", ConstructorParameterDescription(_data.boosts)), ("date", ConstructorParameterDescription(_data.date))]) - } - } - - public static func parse_prepaidGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.PrepaidGiveaway.prepaidGiveaway(Cons_prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!)) - } - else { - return nil - } - } - public static func parse_prepaidStarsGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int64? - _2 = reader.readInt64() - 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.PrepaidGiveaway.prepaidStarsGiveaway(Cons_prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum PrivacyKey: TypeConstructorDescription { - case privacyKeyAbout - case privacyKeyAddedByPhone - case privacyKeyBirthday - case privacyKeyChatInvite - case privacyKeyForwards - case privacyKeyNoPaidMessages - case privacyKeyPhoneCall - case privacyKeyPhoneNumber - case privacyKeyPhoneP2P - case privacyKeyProfilePhoto - case privacyKeySavedMusic - case privacyKeyStarGiftsAutoSave - case privacyKeyStatusTimestamp - case privacyKeyVoiceMessages - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .privacyKeyAbout: - if boxed { - buffer.appendInt32(-1534675103) - } - break - case .privacyKeyAddedByPhone: - if boxed { - buffer.appendInt32(1124062251) - } - break - case .privacyKeyBirthday: - if boxed { - buffer.appendInt32(536913176) - } - break - case .privacyKeyChatInvite: - if boxed { - buffer.appendInt32(1343122938) - } - break - case .privacyKeyForwards: - if boxed { - buffer.appendInt32(1777096355) - } - break - case .privacyKeyNoPaidMessages: - if boxed { - buffer.appendInt32(399722706) - } - break - case .privacyKeyPhoneCall: - if boxed { - buffer.appendInt32(1030105979) - } - break - case .privacyKeyPhoneNumber: - if boxed { - buffer.appendInt32(-778378131) - } - break - case .privacyKeyPhoneP2P: - if boxed { - buffer.appendInt32(961092808) - } - break - case .privacyKeyProfilePhoto: - if boxed { - buffer.appendInt32(-1777000467) - } - break - case .privacyKeySavedMusic: - if boxed { - buffer.appendInt32(-8759525) - } - break - case .privacyKeyStarGiftsAutoSave: - if boxed { - buffer.appendInt32(749010424) - } - break - case .privacyKeyStatusTimestamp: - if boxed { - buffer.appendInt32(-1137792208) - } - break - case .privacyKeyVoiceMessages: - if boxed { - buffer.appendInt32(110621716) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .privacyKeyAbout: - return ("privacyKeyAbout", []) - case .privacyKeyAddedByPhone: - return ("privacyKeyAddedByPhone", []) - case .privacyKeyBirthday: - return ("privacyKeyBirthday", []) - case .privacyKeyChatInvite: - return ("privacyKeyChatInvite", []) - case .privacyKeyForwards: - return ("privacyKeyForwards", []) - case .privacyKeyNoPaidMessages: - return ("privacyKeyNoPaidMessages", []) - case .privacyKeyPhoneCall: - return ("privacyKeyPhoneCall", []) - case .privacyKeyPhoneNumber: - return ("privacyKeyPhoneNumber", []) - case .privacyKeyPhoneP2P: - return ("privacyKeyPhoneP2P", []) - case .privacyKeyProfilePhoto: - return ("privacyKeyProfilePhoto", []) - case .privacyKeySavedMusic: - return ("privacyKeySavedMusic", []) - case .privacyKeyStarGiftsAutoSave: - return ("privacyKeyStarGiftsAutoSave", []) - case .privacyKeyStatusTimestamp: - return ("privacyKeyStatusTimestamp", []) - case .privacyKeyVoiceMessages: - return ("privacyKeyVoiceMessages", []) - } - } - - public static func parse_privacyKeyAbout(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyAbout - } - public static func parse_privacyKeyAddedByPhone(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyAddedByPhone - } - public static func parse_privacyKeyBirthday(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyBirthday - } - public static func parse_privacyKeyChatInvite(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyChatInvite - } - public static func parse_privacyKeyForwards(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyForwards - } - public static func parse_privacyKeyNoPaidMessages(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyNoPaidMessages - } - public static func parse_privacyKeyPhoneCall(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyPhoneCall - } - public static func parse_privacyKeyPhoneNumber(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyPhoneNumber - } - public static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyPhoneP2P - } - public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyProfilePhoto - } - public static func parse_privacyKeySavedMusic(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeySavedMusic - } - public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyStarGiftsAutoSave - } - public static func parse_privacyKeyStatusTimestamp(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyStatusTimestamp - } - public static func parse_privacyKeyVoiceMessages(_ reader: BufferReader) -> PrivacyKey? { - return Api.PrivacyKey.privacyKeyVoiceMessages - } - } -} diff --git a/submodules/TelegramApi/Sources/Api21.swift b/submodules/TelegramApi/Sources/Api21.swift index a14d943b32..0e6203ff98 100644 --- a/submodules/TelegramApi/Sources/Api21.swift +++ b/submodules/TelegramApi/Sources/Api21.swift @@ -1,3 +1,375 @@ +public extension Api { + enum PremiumSubscriptionOption: TypeConstructorDescription { + public class Cons_premiumSubscriptionOption: TypeConstructorDescription { + public var flags: Int32 + public var transaction: String? + public var months: Int32 + public var currency: String + public var amount: Int64 + public var botUrl: String + public var storeProduct: String? + public init(flags: Int32, transaction: String?, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?) { + self.flags = flags + self.transaction = transaction + self.months = months + self.currency = currency + self.amount = amount + self.botUrl = botUrl + self.storeProduct = storeProduct + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(self.flags)), ("transaction", ConstructorParameterDescription(self.transaction)), ("months", ConstructorParameterDescription(self.months)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("botUrl", ConstructorParameterDescription(self.botUrl)), ("storeProduct", ConstructorParameterDescription(self.storeProduct))]) + } + } + case premiumSubscriptionOption(Cons_premiumSubscriptionOption) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .premiumSubscriptionOption(let _data): + if boxed { + buffer.appendInt32(1596792306) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeString(_data.transaction!, buffer: buffer, boxed: false) + } + serializeInt32(_data.months, buffer: buffer, boxed: false) + serializeString(_data.currency, buffer: buffer, boxed: false) + serializeInt64(_data.amount, buffer: buffer, boxed: false) + serializeString(_data.botUrl, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.storeProduct!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .premiumSubscriptionOption(let _data): + return ("premiumSubscriptionOption", [("flags", ConstructorParameterDescription(_data.flags)), ("transaction", ConstructorParameterDescription(_data.transaction)), ("months", ConstructorParameterDescription(_data.months)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("botUrl", ConstructorParameterDescription(_data.botUrl)), ("storeProduct", ConstructorParameterDescription(_data.storeProduct))]) + } + } + + public static func parse_premiumSubscriptionOption(_ reader: BufferReader) -> PremiumSubscriptionOption? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + if Int(_1!) & Int(1 << 3) != 0 { + _2 = parseString(reader) + } + var _3: Int32? + _3 = reader.readInt32() + var _4: String? + _4 = parseString(reader) + var _5: Int64? + _5 = reader.readInt64() + var _6: String? + _6 = parseString(reader) + var _7: String? + if Int(_1!) & Int(1 << 0) != 0 { + _7 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { + return Api.PremiumSubscriptionOption.premiumSubscriptionOption(Cons_premiumSubscriptionOption(flags: _1!, transaction: _2, months: _3!, currency: _4!, amount: _5!, botUrl: _6!, storeProduct: _7)) + } + else { + return nil + } + } + } +} +public extension Api { + enum PrepaidGiveaway: TypeConstructorDescription { + public class Cons_prepaidGiveaway: TypeConstructorDescription { + public var id: Int64 + public var months: Int32 + public var quantity: Int32 + public var date: Int32 + public init(id: Int64, months: Int32, quantity: Int32, date: Int32) { + self.id = id + self.months = months + self.quantity = quantity + self.date = date + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("prepaidGiveaway", [("id", ConstructorParameterDescription(self.id)), ("months", ConstructorParameterDescription(self.months)), ("quantity", ConstructorParameterDescription(self.quantity)), ("date", ConstructorParameterDescription(self.date))]) + } + } + public class Cons_prepaidStarsGiveaway: TypeConstructorDescription { + public var id: Int64 + public var stars: Int64 + public var quantity: Int32 + public var boosts: Int32 + public var date: Int32 + public init(id: Int64, stars: Int64, quantity: Int32, boosts: Int32, date: Int32) { + self.id = id + self.stars = stars + self.quantity = quantity + self.boosts = boosts + self.date = date + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(self.id)), ("stars", ConstructorParameterDescription(self.stars)), ("quantity", ConstructorParameterDescription(self.quantity)), ("boosts", ConstructorParameterDescription(self.boosts)), ("date", ConstructorParameterDescription(self.date))]) + } + } + case prepaidGiveaway(Cons_prepaidGiveaway) + case prepaidStarsGiveaway(Cons_prepaidStarsGiveaway) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .prepaidGiveaway(let _data): + if boxed { + buffer.appendInt32(-1303143084) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt32(_data.months, buffer: buffer, boxed: false) + serializeInt32(_data.quantity, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + break + case .prepaidStarsGiveaway(let _data): + if boxed { + buffer.appendInt32(-1700956192) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.stars, buffer: buffer, boxed: false) + serializeInt32(_data.quantity, buffer: buffer, boxed: false) + serializeInt32(_data.boosts, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .prepaidGiveaway(let _data): + return ("prepaidGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("months", ConstructorParameterDescription(_data.months)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("date", ConstructorParameterDescription(_data.date))]) + case .prepaidStarsGiveaway(let _data): + return ("prepaidStarsGiveaway", [("id", ConstructorParameterDescription(_data.id)), ("stars", ConstructorParameterDescription(_data.stars)), ("quantity", ConstructorParameterDescription(_data.quantity)), ("boosts", ConstructorParameterDescription(_data.boosts)), ("date", ConstructorParameterDescription(_data.date))]) + } + } + + public static func parse_prepaidGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.PrepaidGiveaway.prepaidGiveaway(Cons_prepaidGiveaway(id: _1!, months: _2!, quantity: _3!, date: _4!)) + } + else { + return nil + } + } + public static func parse_prepaidStarsGiveaway(_ reader: BufferReader) -> PrepaidGiveaway? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() + 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.PrepaidGiveaway.prepaidStarsGiveaway(Cons_prepaidStarsGiveaway(id: _1!, stars: _2!, quantity: _3!, boosts: _4!, date: _5!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum PrivacyKey: TypeConstructorDescription { + case privacyKeyAbout + case privacyKeyAddedByPhone + case privacyKeyBirthday + case privacyKeyChatInvite + case privacyKeyForwards + case privacyKeyNoPaidMessages + case privacyKeyPhoneCall + case privacyKeyPhoneNumber + case privacyKeyPhoneP2P + case privacyKeyProfilePhoto + case privacyKeySavedMusic + case privacyKeyStarGiftsAutoSave + case privacyKeyStatusTimestamp + case privacyKeyVoiceMessages + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .privacyKeyAbout: + if boxed { + buffer.appendInt32(-1534675103) + } + break + case .privacyKeyAddedByPhone: + if boxed { + buffer.appendInt32(1124062251) + } + break + case .privacyKeyBirthday: + if boxed { + buffer.appendInt32(536913176) + } + break + case .privacyKeyChatInvite: + if boxed { + buffer.appendInt32(1343122938) + } + break + case .privacyKeyForwards: + if boxed { + buffer.appendInt32(1777096355) + } + break + case .privacyKeyNoPaidMessages: + if boxed { + buffer.appendInt32(399722706) + } + break + case .privacyKeyPhoneCall: + if boxed { + buffer.appendInt32(1030105979) + } + break + case .privacyKeyPhoneNumber: + if boxed { + buffer.appendInt32(-778378131) + } + break + case .privacyKeyPhoneP2P: + if boxed { + buffer.appendInt32(961092808) + } + break + case .privacyKeyProfilePhoto: + if boxed { + buffer.appendInt32(-1777000467) + } + break + case .privacyKeySavedMusic: + if boxed { + buffer.appendInt32(-8759525) + } + break + case .privacyKeyStarGiftsAutoSave: + if boxed { + buffer.appendInt32(749010424) + } + break + case .privacyKeyStatusTimestamp: + if boxed { + buffer.appendInt32(-1137792208) + } + break + case .privacyKeyVoiceMessages: + if boxed { + buffer.appendInt32(110621716) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .privacyKeyAbout: + return ("privacyKeyAbout", []) + case .privacyKeyAddedByPhone: + return ("privacyKeyAddedByPhone", []) + case .privacyKeyBirthday: + return ("privacyKeyBirthday", []) + case .privacyKeyChatInvite: + return ("privacyKeyChatInvite", []) + case .privacyKeyForwards: + return ("privacyKeyForwards", []) + case .privacyKeyNoPaidMessages: + return ("privacyKeyNoPaidMessages", []) + case .privacyKeyPhoneCall: + return ("privacyKeyPhoneCall", []) + case .privacyKeyPhoneNumber: + return ("privacyKeyPhoneNumber", []) + case .privacyKeyPhoneP2P: + return ("privacyKeyPhoneP2P", []) + case .privacyKeyProfilePhoto: + return ("privacyKeyProfilePhoto", []) + case .privacyKeySavedMusic: + return ("privacyKeySavedMusic", []) + case .privacyKeyStarGiftsAutoSave: + return ("privacyKeyStarGiftsAutoSave", []) + case .privacyKeyStatusTimestamp: + return ("privacyKeyStatusTimestamp", []) + case .privacyKeyVoiceMessages: + return ("privacyKeyVoiceMessages", []) + } + } + + public static func parse_privacyKeyAbout(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyAbout + } + public static func parse_privacyKeyAddedByPhone(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyAddedByPhone + } + public static func parse_privacyKeyBirthday(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyBirthday + } + public static func parse_privacyKeyChatInvite(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyChatInvite + } + public static func parse_privacyKeyForwards(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyForwards + } + public static func parse_privacyKeyNoPaidMessages(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyNoPaidMessages + } + public static func parse_privacyKeyPhoneCall(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyPhoneCall + } + public static func parse_privacyKeyPhoneNumber(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyPhoneNumber + } + public static func parse_privacyKeyPhoneP2P(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyPhoneP2P + } + public static func parse_privacyKeyProfilePhoto(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyProfilePhoto + } + public static func parse_privacyKeySavedMusic(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeySavedMusic + } + public static func parse_privacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyStarGiftsAutoSave + } + public static func parse_privacyKeyStatusTimestamp(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyStatusTimestamp + } + public static func parse_privacyKeyVoiceMessages(_ reader: BufferReader) -> PrivacyKey? { + return Api.PrivacyKey.privacyKeyVoiceMessages + } + } +} public extension Api { enum PrivacyRule: TypeConstructorDescription { public class Cons_privacyValueAllowChatParticipants: TypeConstructorDescription { @@ -344,496 +716,3 @@ public extension Api { } } } -public extension Api { - indirect enum PublicForward: TypeConstructorDescription { - public class Cons_publicForwardMessage: TypeConstructorDescription { - public var message: Api.Message - public init(message: Api.Message) { - self.message = message - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("publicForwardMessage", [("message", ConstructorParameterDescription(self.message))]) - } - } - public class Cons_publicForwardStory: TypeConstructorDescription { - public var peer: Api.Peer - public var story: Api.StoryItem - public init(peer: Api.Peer, story: Api.StoryItem) { - self.peer = peer - self.story = story - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("publicForwardStory", [("peer", ConstructorParameterDescription(self.peer)), ("story", ConstructorParameterDescription(self.story))]) - } - } - case publicForwardMessage(Cons_publicForwardMessage) - case publicForwardStory(Cons_publicForwardStory) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .publicForwardMessage(let _data): - if boxed { - buffer.appendInt32(32685898) - } - _data.message.serialize(buffer, true) - break - case .publicForwardStory(let _data): - if boxed { - buffer.appendInt32(-302797360) - } - _data.peer.serialize(buffer, true) - _data.story.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .publicForwardMessage(let _data): - return ("publicForwardMessage", [("message", ConstructorParameterDescription(_data.message))]) - case .publicForwardStory(let _data): - return ("publicForwardStory", [("peer", ConstructorParameterDescription(_data.peer)), ("story", ConstructorParameterDescription(_data.story))]) - } - } - - public static func parse_publicForwardMessage(_ reader: BufferReader) -> PublicForward? { - var _1: Api.Message? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.Message - } - let _c1 = _1 != nil - if _c1 { - return Api.PublicForward.publicForwardMessage(Cons_publicForwardMessage(message: _1!)) - } - else { - return nil - } - } - public static func parse_publicForwardStory(_ reader: BufferReader) -> PublicForward? { - var _1: Api.Peer? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.Peer - } - var _2: Api.StoryItem? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.StoryItem - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.PublicForward.publicForwardStory(Cons_publicForwardStory(peer: _1!, story: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum QuickReply: TypeConstructorDescription { - public class Cons_quickReply: TypeConstructorDescription { - public var shortcutId: Int32 - public var shortcut: String - public var topMessage: Int32 - public var count: Int32 - public init(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32) { - self.shortcutId = shortcutId - self.shortcut = shortcut - self.topMessage = topMessage - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("quickReply", [("shortcutId", ConstructorParameterDescription(self.shortcutId)), ("shortcut", ConstructorParameterDescription(self.shortcut)), ("topMessage", ConstructorParameterDescription(self.topMessage)), ("count", ConstructorParameterDescription(self.count))]) - } - } - case quickReply(Cons_quickReply) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .quickReply(let _data): - if boxed { - buffer.appendInt32(110563371) - } - serializeInt32(_data.shortcutId, buffer: buffer, boxed: false) - serializeString(_data.shortcut, buffer: buffer, boxed: false) - serializeInt32(_data.topMessage, buffer: buffer, boxed: false) - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .quickReply(let _data): - return ("quickReply", [("shortcutId", ConstructorParameterDescription(_data.shortcutId)), ("shortcut", ConstructorParameterDescription(_data.shortcut)), ("topMessage", ConstructorParameterDescription(_data.topMessage)), ("count", ConstructorParameterDescription(_data.count))]) - } - } - - public static func parse_quickReply(_ reader: BufferReader) -> QuickReply? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.QuickReply.quickReply(Cons_quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum Reaction: TypeConstructorDescription { - public class Cons_reactionCustomEmoji: TypeConstructorDescription { - public var documentId: Int64 - public init(documentId: Int64) { - self.documentId = documentId - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(self.documentId))]) - } - } - public class Cons_reactionEmoji: TypeConstructorDescription { - public var emoticon: String - public init(emoticon: String) { - self.emoticon = emoticon - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(self.emoticon))]) - } - } - case reactionCustomEmoji(Cons_reactionCustomEmoji) - case reactionEmoji(Cons_reactionEmoji) - case reactionEmpty - case reactionPaid - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reactionCustomEmoji(let _data): - if boxed { - buffer.appendInt32(-1992950669) - } - serializeInt64(_data.documentId, buffer: buffer, boxed: false) - break - case .reactionEmoji(let _data): - if boxed { - buffer.appendInt32(455247544) - } - serializeString(_data.emoticon, buffer: buffer, boxed: false) - break - case .reactionEmpty: - if boxed { - buffer.appendInt32(2046153753) - } - break - case .reactionPaid: - if boxed { - buffer.appendInt32(1379771627) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reactionCustomEmoji(let _data): - return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(_data.documentId))]) - case .reactionEmoji(let _data): - return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(_data.emoticon))]) - case .reactionEmpty: - return ("reactionEmpty", []) - case .reactionPaid: - return ("reactionPaid", []) - } - } - - public static func parse_reactionCustomEmoji(_ reader: BufferReader) -> Reaction? { - var _1: Int64? - _1 = reader.readInt64() - let _c1 = _1 != nil - if _c1 { - return Api.Reaction.reactionCustomEmoji(Cons_reactionCustomEmoji(documentId: _1!)) - } - else { - return nil - } - } - public static func parse_reactionEmoji(_ reader: BufferReader) -> Reaction? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.Reaction.reactionEmoji(Cons_reactionEmoji(emoticon: _1!)) - } - else { - return nil - } - } - public static func parse_reactionEmpty(_ reader: BufferReader) -> Reaction? { - return Api.Reaction.reactionEmpty - } - public static func parse_reactionPaid(_ reader: BufferReader) -> Reaction? { - return Api.Reaction.reactionPaid - } - } -} -public extension Api { - enum ReactionCount: TypeConstructorDescription { - public class Cons_reactionCount: TypeConstructorDescription { - public var flags: Int32 - public var chosenOrder: Int32? - public var reaction: Api.Reaction - public var count: Int32 - public init(flags: Int32, chosenOrder: Int32?, reaction: Api.Reaction, count: Int32) { - self.flags = flags - self.chosenOrder = chosenOrder - self.reaction = reaction - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reactionCount", [("flags", ConstructorParameterDescription(self.flags)), ("chosenOrder", ConstructorParameterDescription(self.chosenOrder)), ("reaction", ConstructorParameterDescription(self.reaction)), ("count", ConstructorParameterDescription(self.count))]) - } - } - case reactionCount(Cons_reactionCount) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reactionCount(let _data): - if boxed { - buffer.appendInt32(-1546531968) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.chosenOrder!, buffer: buffer, boxed: false) - } - _data.reaction.serialize(buffer, true) - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reactionCount(let _data): - return ("reactionCount", [("flags", ConstructorParameterDescription(_data.flags)), ("chosenOrder", ConstructorParameterDescription(_data.chosenOrder)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("count", ConstructorParameterDescription(_data.count))]) - } - } - - public static func parse_reactionCount(_ reader: BufferReader) -> ReactionCount? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = reader.readInt32() - } - var _3: Api.Reaction? - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.Reaction - } - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.ReactionCount.reactionCount(Cons_reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum ReactionNotificationsFrom: TypeConstructorDescription { - case reactionNotificationsFromAll - case reactionNotificationsFromContacts - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reactionNotificationsFromAll: - if boxed { - buffer.appendInt32(1268654752) - } - break - case .reactionNotificationsFromContacts: - if boxed { - buffer.appendInt32(-1161583078) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reactionNotificationsFromAll: - return ("reactionNotificationsFromAll", []) - case .reactionNotificationsFromContacts: - return ("reactionNotificationsFromContacts", []) - } - } - - public static func parse_reactionNotificationsFromAll(_ reader: BufferReader) -> ReactionNotificationsFrom? { - return Api.ReactionNotificationsFrom.reactionNotificationsFromAll - } - public static func parse_reactionNotificationsFromContacts(_ reader: BufferReader) -> ReactionNotificationsFrom? { - return Api.ReactionNotificationsFrom.reactionNotificationsFromContacts - } - } -} -public extension Api { - enum ReactionsNotifySettings: TypeConstructorDescription { - public class Cons_reactionsNotifySettings: TypeConstructorDescription { - public var flags: Int32 - public var messagesNotifyFrom: Api.ReactionNotificationsFrom? - public var storiesNotifyFrom: Api.ReactionNotificationsFrom? - public var pollVotesNotifyFrom: Api.ReactionNotificationsFrom? - public var sound: Api.NotificationSound - public var showPreviews: Api.Bool - public init(flags: Int32, messagesNotifyFrom: Api.ReactionNotificationsFrom?, storiesNotifyFrom: Api.ReactionNotificationsFrom?, pollVotesNotifyFrom: Api.ReactionNotificationsFrom?, sound: Api.NotificationSound, showPreviews: Api.Bool) { - self.flags = flags - self.messagesNotifyFrom = messagesNotifyFrom - self.storiesNotifyFrom = storiesNotifyFrom - self.pollVotesNotifyFrom = pollVotesNotifyFrom - self.sound = sound - self.showPreviews = showPreviews - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(self.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(self.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(self.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(self.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(self.sound)), ("showPreviews", ConstructorParameterDescription(self.showPreviews))]) - } - } - case reactionsNotifySettings(Cons_reactionsNotifySettings) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reactionsNotifySettings(let _data): - if boxed { - buffer.appendInt32(1910827608) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.messagesNotifyFrom!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.storiesNotifyFrom!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.pollVotesNotifyFrom!.serialize(buffer, true) - } - _data.sound.serialize(buffer, true) - _data.showPreviews.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reactionsNotifySettings(let _data): - return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(_data.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(_data.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(_data.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(_data.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(_data.sound)), ("showPreviews", ConstructorParameterDescription(_data.showPreviews))]) - } - } - - public static func parse_reactionsNotifySettings(_ reader: BufferReader) -> ReactionsNotifySettings? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.ReactionNotificationsFrom? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom - } - } - var _3: Api.ReactionNotificationsFrom? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom - } - } - var _4: Api.ReactionNotificationsFrom? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom - } - } - var _5: Api.NotificationSound? - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.NotificationSound - } - var _6: Api.Bool? - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.Bool - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.ReactionsNotifySettings.reactionsNotifySettings(Cons_reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, pollVotesNotifyFrom: _4, sound: _5!, showPreviews: _6!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum ReadParticipantDate: TypeConstructorDescription { - public class Cons_readParticipantDate: TypeConstructorDescription { - public var userId: Int64 - public var date: Int32 - public init(userId: Int64, date: Int32) { - self.userId = userId - self.date = date - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("readParticipantDate", [("userId", ConstructorParameterDescription(self.userId)), ("date", ConstructorParameterDescription(self.date))]) - } - } - case readParticipantDate(Cons_readParticipantDate) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .readParticipantDate(let _data): - if boxed { - buffer.appendInt32(1246753138) - } - serializeInt64(_data.userId, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .readParticipantDate(let _data): - return ("readParticipantDate", [("userId", ConstructorParameterDescription(_data.userId)), ("date", ConstructorParameterDescription(_data.date))]) - } - } - - public static func parse_readParticipantDate(_ reader: BufferReader) -> ReadParticipantDate? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.ReadParticipantDate.readParticipantDate(Cons_readParticipantDate(userId: _1!, date: _2!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api22.swift b/submodules/TelegramApi/Sources/Api22.swift index 200a882362..176147f8b7 100644 --- a/submodules/TelegramApi/Sources/Api22.swift +++ b/submodules/TelegramApi/Sources/Api22.swift @@ -1,3 +1,496 @@ +public extension Api { + indirect enum PublicForward: TypeConstructorDescription { + public class Cons_publicForwardMessage: TypeConstructorDescription { + public var message: Api.Message + public init(message: Api.Message) { + self.message = message + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("publicForwardMessage", [("message", ConstructorParameterDescription(self.message))]) + } + } + public class Cons_publicForwardStory: TypeConstructorDescription { + public var peer: Api.Peer + public var story: Api.StoryItem + public init(peer: Api.Peer, story: Api.StoryItem) { + self.peer = peer + self.story = story + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("publicForwardStory", [("peer", ConstructorParameterDescription(self.peer)), ("story", ConstructorParameterDescription(self.story))]) + } + } + case publicForwardMessage(Cons_publicForwardMessage) + case publicForwardStory(Cons_publicForwardStory) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .publicForwardMessage(let _data): + if boxed { + buffer.appendInt32(32685898) + } + _data.message.serialize(buffer, true) + break + case .publicForwardStory(let _data): + if boxed { + buffer.appendInt32(-302797360) + } + _data.peer.serialize(buffer, true) + _data.story.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .publicForwardMessage(let _data): + return ("publicForwardMessage", [("message", ConstructorParameterDescription(_data.message))]) + case .publicForwardStory(let _data): + return ("publicForwardStory", [("peer", ConstructorParameterDescription(_data.peer)), ("story", ConstructorParameterDescription(_data.story))]) + } + } + + public static func parse_publicForwardMessage(_ reader: BufferReader) -> PublicForward? { + var _1: Api.Message? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Message + } + let _c1 = _1 != nil + if _c1 { + return Api.PublicForward.publicForwardMessage(Cons_publicForwardMessage(message: _1!)) + } + else { + return nil + } + } + public static func parse_publicForwardStory(_ reader: BufferReader) -> PublicForward? { + var _1: Api.Peer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _2: Api.StoryItem? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.StoryItem + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.PublicForward.publicForwardStory(Cons_publicForwardStory(peer: _1!, story: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum QuickReply: TypeConstructorDescription { + public class Cons_quickReply: TypeConstructorDescription { + public var shortcutId: Int32 + public var shortcut: String + public var topMessage: Int32 + public var count: Int32 + public init(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32) { + self.shortcutId = shortcutId + self.shortcut = shortcut + self.topMessage = topMessage + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("quickReply", [("shortcutId", ConstructorParameterDescription(self.shortcutId)), ("shortcut", ConstructorParameterDescription(self.shortcut)), ("topMessage", ConstructorParameterDescription(self.topMessage)), ("count", ConstructorParameterDescription(self.count))]) + } + } + case quickReply(Cons_quickReply) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .quickReply(let _data): + if boxed { + buffer.appendInt32(110563371) + } + serializeInt32(_data.shortcutId, buffer: buffer, boxed: false) + serializeString(_data.shortcut, buffer: buffer, boxed: false) + serializeInt32(_data.topMessage, buffer: buffer, boxed: false) + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .quickReply(let _data): + return ("quickReply", [("shortcutId", ConstructorParameterDescription(_data.shortcutId)), ("shortcut", ConstructorParameterDescription(_data.shortcut)), ("topMessage", ConstructorParameterDescription(_data.topMessage)), ("count", ConstructorParameterDescription(_data.count))]) + } + } + + public static func parse_quickReply(_ reader: BufferReader) -> QuickReply? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.QuickReply.quickReply(Cons_quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum Reaction: TypeConstructorDescription { + public class Cons_reactionCustomEmoji: TypeConstructorDescription { + public var documentId: Int64 + public init(documentId: Int64) { + self.documentId = documentId + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(self.documentId))]) + } + } + public class Cons_reactionEmoji: TypeConstructorDescription { + public var emoticon: String + public init(emoticon: String) { + self.emoticon = emoticon + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(self.emoticon))]) + } + } + case reactionCustomEmoji(Cons_reactionCustomEmoji) + case reactionEmoji(Cons_reactionEmoji) + case reactionEmpty + case reactionPaid + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reactionCustomEmoji(let _data): + if boxed { + buffer.appendInt32(-1992950669) + } + serializeInt64(_data.documentId, buffer: buffer, boxed: false) + break + case .reactionEmoji(let _data): + if boxed { + buffer.appendInt32(455247544) + } + serializeString(_data.emoticon, buffer: buffer, boxed: false) + break + case .reactionEmpty: + if boxed { + buffer.appendInt32(2046153753) + } + break + case .reactionPaid: + if boxed { + buffer.appendInt32(1379771627) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reactionCustomEmoji(let _data): + return ("reactionCustomEmoji", [("documentId", ConstructorParameterDescription(_data.documentId))]) + case .reactionEmoji(let _data): + return ("reactionEmoji", [("emoticon", ConstructorParameterDescription(_data.emoticon))]) + case .reactionEmpty: + return ("reactionEmpty", []) + case .reactionPaid: + return ("reactionPaid", []) + } + } + + public static func parse_reactionCustomEmoji(_ reader: BufferReader) -> Reaction? { + var _1: Int64? + _1 = reader.readInt64() + let _c1 = _1 != nil + if _c1 { + return Api.Reaction.reactionCustomEmoji(Cons_reactionCustomEmoji(documentId: _1!)) + } + else { + return nil + } + } + public static func parse_reactionEmoji(_ reader: BufferReader) -> Reaction? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.Reaction.reactionEmoji(Cons_reactionEmoji(emoticon: _1!)) + } + else { + return nil + } + } + public static func parse_reactionEmpty(_ reader: BufferReader) -> Reaction? { + return Api.Reaction.reactionEmpty + } + public static func parse_reactionPaid(_ reader: BufferReader) -> Reaction? { + return Api.Reaction.reactionPaid + } + } +} +public extension Api { + enum ReactionCount: TypeConstructorDescription { + public class Cons_reactionCount: TypeConstructorDescription { + public var flags: Int32 + public var chosenOrder: Int32? + public var reaction: Api.Reaction + public var count: Int32 + public init(flags: Int32, chosenOrder: Int32?, reaction: Api.Reaction, count: Int32) { + self.flags = flags + self.chosenOrder = chosenOrder + self.reaction = reaction + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reactionCount", [("flags", ConstructorParameterDescription(self.flags)), ("chosenOrder", ConstructorParameterDescription(self.chosenOrder)), ("reaction", ConstructorParameterDescription(self.reaction)), ("count", ConstructorParameterDescription(self.count))]) + } + } + case reactionCount(Cons_reactionCount) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reactionCount(let _data): + if boxed { + buffer.appendInt32(-1546531968) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.chosenOrder!, buffer: buffer, boxed: false) + } + _data.reaction.serialize(buffer, true) + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reactionCount(let _data): + return ("reactionCount", [("flags", ConstructorParameterDescription(_data.flags)), ("chosenOrder", ConstructorParameterDescription(_data.chosenOrder)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("count", ConstructorParameterDescription(_data.count))]) + } + } + + public static func parse_reactionCount(_ reader: BufferReader) -> ReactionCount? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = reader.readInt32() + } + var _3: Api.Reaction? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.Reaction + } + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.ReactionCount.reactionCount(Cons_reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum ReactionNotificationsFrom: TypeConstructorDescription { + case reactionNotificationsFromAll + case reactionNotificationsFromContacts + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reactionNotificationsFromAll: + if boxed { + buffer.appendInt32(1268654752) + } + break + case .reactionNotificationsFromContacts: + if boxed { + buffer.appendInt32(-1161583078) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reactionNotificationsFromAll: + return ("reactionNotificationsFromAll", []) + case .reactionNotificationsFromContacts: + return ("reactionNotificationsFromContacts", []) + } + } + + public static func parse_reactionNotificationsFromAll(_ reader: BufferReader) -> ReactionNotificationsFrom? { + return Api.ReactionNotificationsFrom.reactionNotificationsFromAll + } + public static func parse_reactionNotificationsFromContacts(_ reader: BufferReader) -> ReactionNotificationsFrom? { + return Api.ReactionNotificationsFrom.reactionNotificationsFromContacts + } + } +} +public extension Api { + enum ReactionsNotifySettings: TypeConstructorDescription { + public class Cons_reactionsNotifySettings: TypeConstructorDescription { + public var flags: Int32 + public var messagesNotifyFrom: Api.ReactionNotificationsFrom? + public var storiesNotifyFrom: Api.ReactionNotificationsFrom? + public var pollVotesNotifyFrom: Api.ReactionNotificationsFrom? + public var sound: Api.NotificationSound + public var showPreviews: Api.Bool + public init(flags: Int32, messagesNotifyFrom: Api.ReactionNotificationsFrom?, storiesNotifyFrom: Api.ReactionNotificationsFrom?, pollVotesNotifyFrom: Api.ReactionNotificationsFrom?, sound: Api.NotificationSound, showPreviews: Api.Bool) { + self.flags = flags + self.messagesNotifyFrom = messagesNotifyFrom + self.storiesNotifyFrom = storiesNotifyFrom + self.pollVotesNotifyFrom = pollVotesNotifyFrom + self.sound = sound + self.showPreviews = showPreviews + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(self.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(self.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(self.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(self.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(self.sound)), ("showPreviews", ConstructorParameterDescription(self.showPreviews))]) + } + } + case reactionsNotifySettings(Cons_reactionsNotifySettings) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reactionsNotifySettings(let _data): + if boxed { + buffer.appendInt32(1910827608) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.messagesNotifyFrom!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.storiesNotifyFrom!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.pollVotesNotifyFrom!.serialize(buffer, true) + } + _data.sound.serialize(buffer, true) + _data.showPreviews.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reactionsNotifySettings(let _data): + return ("reactionsNotifySettings", [("flags", ConstructorParameterDescription(_data.flags)), ("messagesNotifyFrom", ConstructorParameterDescription(_data.messagesNotifyFrom)), ("storiesNotifyFrom", ConstructorParameterDescription(_data.storiesNotifyFrom)), ("pollVotesNotifyFrom", ConstructorParameterDescription(_data.pollVotesNotifyFrom)), ("sound", ConstructorParameterDescription(_data.sound)), ("showPreviews", ConstructorParameterDescription(_data.showPreviews))]) + } + } + + public static func parse_reactionsNotifySettings(_ reader: BufferReader) -> ReactionsNotifySettings? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.ReactionNotificationsFrom? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom + } + } + var _3: Api.ReactionNotificationsFrom? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom + } + } + var _4: Api.ReactionNotificationsFrom? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom + } + } + var _5: Api.NotificationSound? + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.NotificationSound + } + var _6: Api.Bool? + if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.Bool + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.ReactionsNotifySettings.reactionsNotifySettings(Cons_reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, pollVotesNotifyFrom: _4, sound: _5!, showPreviews: _6!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum ReadParticipantDate: TypeConstructorDescription { + public class Cons_readParticipantDate: TypeConstructorDescription { + public var userId: Int64 + public var date: Int32 + public init(userId: Int64, date: Int32) { + self.userId = userId + self.date = date + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("readParticipantDate", [("userId", ConstructorParameterDescription(self.userId)), ("date", ConstructorParameterDescription(self.date))]) + } + } + case readParticipantDate(Cons_readParticipantDate) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .readParticipantDate(let _data): + if boxed { + buffer.appendInt32(1246753138) + } + serializeInt64(_data.userId, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .readParticipantDate(let _data): + return ("readParticipantDate", [("userId", ConstructorParameterDescription(_data.userId)), ("date", ConstructorParameterDescription(_data.date))]) + } + } + + public static func parse_readParticipantDate(_ reader: BufferReader) -> ReadParticipantDate? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.ReadParticipantDate.readParticipantDate(Cons_readParticipantDate(userId: _1!, date: _2!)) + } + else { + return nil + } + } + } +} public extension Api { enum ReceivedNotifyMessage: TypeConstructorDescription { public class Cons_receivedNotifyMessage: TypeConstructorDescription { @@ -584,646 +1077,3 @@ public extension Api { } } } -public extension Api { - enum ReportResult: TypeConstructorDescription { - public class Cons_reportResultAddComment: TypeConstructorDescription { - public var flags: Int32 - public var option: Buffer - public init(flags: Int32, option: Buffer) { - self.flags = flags - self.option = option - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reportResultAddComment", [("flags", ConstructorParameterDescription(self.flags)), ("option", ConstructorParameterDescription(self.option))]) - } - } - public class Cons_reportResultChooseOption: TypeConstructorDescription { - public var title: String - public var options: [Api.MessageReportOption] - public init(title: String, options: [Api.MessageReportOption]) { - self.title = title - self.options = options - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reportResultChooseOption", [("title", ConstructorParameterDescription(self.title)), ("options", ConstructorParameterDescription(self.options))]) - } - } - case reportResultAddComment(Cons_reportResultAddComment) - case reportResultChooseOption(Cons_reportResultChooseOption) - case reportResultReported - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reportResultAddComment(let _data): - if boxed { - buffer.appendInt32(1862904881) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeBytes(_data.option, buffer: buffer, boxed: false) - break - case .reportResultChooseOption(let _data): - if boxed { - buffer.appendInt32(-253435722) - } - serializeString(_data.title, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.options.count)) - for item in _data.options { - item.serialize(buffer, true) - } - break - case .reportResultReported: - if boxed { - buffer.appendInt32(-1917633461) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reportResultAddComment(let _data): - return ("reportResultAddComment", [("flags", ConstructorParameterDescription(_data.flags)), ("option", ConstructorParameterDescription(_data.option))]) - case .reportResultChooseOption(let _data): - return ("reportResultChooseOption", [("title", ConstructorParameterDescription(_data.title)), ("options", ConstructorParameterDescription(_data.options))]) - case .reportResultReported: - return ("reportResultReported", []) - } - } - - public static func parse_reportResultAddComment(_ reader: BufferReader) -> ReportResult? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Buffer? - _2 = parseBytes(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.ReportResult.reportResultAddComment(Cons_reportResultAddComment(flags: _1!, option: _2!)) - } - else { - return nil - } - } - public static func parse_reportResultChooseOption(_ reader: BufferReader) -> ReportResult? { - var _1: String? - _1 = parseString(reader) - var _2: [Api.MessageReportOption]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageReportOption.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.ReportResult.reportResultChooseOption(Cons_reportResultChooseOption(title: _1!, options: _2!)) - } - else { - return nil - } - } - public static func parse_reportResultReported(_ reader: BufferReader) -> ReportResult? { - return Api.ReportResult.reportResultReported - } - } -} -public extension Api { - enum RequestPeerType: TypeConstructorDescription { - public class Cons_requestPeerTypeBroadcast: TypeConstructorDescription { - public var flags: Int32 - public var hasUsername: Api.Bool? - public var userAdminRights: Api.ChatAdminRights? - public var botAdminRights: Api.ChatAdminRights? - public init(flags: Int32, hasUsername: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?) { - self.flags = flags - self.hasUsername = hasUsername - self.userAdminRights = userAdminRights - self.botAdminRights = botAdminRights - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestPeerTypeBroadcast", [("flags", ConstructorParameterDescription(self.flags)), ("hasUsername", ConstructorParameterDescription(self.hasUsername)), ("userAdminRights", ConstructorParameterDescription(self.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(self.botAdminRights))]) - } - } - public class Cons_requestPeerTypeChat: TypeConstructorDescription { - public var flags: Int32 - public var hasUsername: Api.Bool? - public var forum: Api.Bool? - public var userAdminRights: Api.ChatAdminRights? - public var botAdminRights: Api.ChatAdminRights? - public init(flags: Int32, hasUsername: Api.Bool?, forum: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?) { - self.flags = flags - self.hasUsername = hasUsername - self.forum = forum - self.userAdminRights = userAdminRights - self.botAdminRights = botAdminRights - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestPeerTypeChat", [("flags", ConstructorParameterDescription(self.flags)), ("hasUsername", ConstructorParameterDescription(self.hasUsername)), ("forum", ConstructorParameterDescription(self.forum)), ("userAdminRights", ConstructorParameterDescription(self.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(self.botAdminRights))]) - } - } - public class Cons_requestPeerTypeCreateBot: TypeConstructorDescription { - public var flags: Int32 - public var suggestedName: String? - public var suggestedUsername: String? - public init(flags: Int32, suggestedName: String?, suggestedUsername: String?) { - self.flags = flags - self.suggestedName = suggestedName - self.suggestedUsername = suggestedUsername - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestPeerTypeCreateBot", [("flags", ConstructorParameterDescription(self.flags)), ("suggestedName", ConstructorParameterDescription(self.suggestedName)), ("suggestedUsername", ConstructorParameterDescription(self.suggestedUsername))]) - } - } - public class Cons_requestPeerTypeUser: TypeConstructorDescription { - public var flags: Int32 - public var bot: Api.Bool? - public var premium: Api.Bool? - public init(flags: Int32, bot: Api.Bool?, premium: Api.Bool?) { - self.flags = flags - self.bot = bot - self.premium = premium - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestPeerTypeUser", [("flags", ConstructorParameterDescription(self.flags)), ("bot", ConstructorParameterDescription(self.bot)), ("premium", ConstructorParameterDescription(self.premium))]) - } - } - case requestPeerTypeBroadcast(Cons_requestPeerTypeBroadcast) - case requestPeerTypeChat(Cons_requestPeerTypeChat) - case requestPeerTypeCreateBot(Cons_requestPeerTypeCreateBot) - case requestPeerTypeUser(Cons_requestPeerTypeUser) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .requestPeerTypeBroadcast(let _data): - if boxed { - buffer.appendInt32(865857388) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 3) != 0 { - _data.hasUsername!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.userAdminRights!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.botAdminRights!.serialize(buffer, true) - } - break - case .requestPeerTypeChat(let _data): - if boxed { - buffer.appendInt32(-906990053) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 3) != 0 { - _data.hasUsername!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - _data.forum!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.userAdminRights!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.botAdminRights!.serialize(buffer, true) - } - break - case .requestPeerTypeCreateBot(let _data): - if boxed { - buffer.appendInt32(1048699000) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.suggestedName!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeString(_data.suggestedUsername!, buffer: buffer, boxed: false) - } - break - case .requestPeerTypeUser(let _data): - if boxed { - buffer.appendInt32(1597737472) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.bot!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.premium!.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .requestPeerTypeBroadcast(let _data): - return ("requestPeerTypeBroadcast", [("flags", ConstructorParameterDescription(_data.flags)), ("hasUsername", ConstructorParameterDescription(_data.hasUsername)), ("userAdminRights", ConstructorParameterDescription(_data.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(_data.botAdminRights))]) - case .requestPeerTypeChat(let _data): - return ("requestPeerTypeChat", [("flags", ConstructorParameterDescription(_data.flags)), ("hasUsername", ConstructorParameterDescription(_data.hasUsername)), ("forum", ConstructorParameterDescription(_data.forum)), ("userAdminRights", ConstructorParameterDescription(_data.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(_data.botAdminRights))]) - case .requestPeerTypeCreateBot(let _data): - return ("requestPeerTypeCreateBot", [("flags", ConstructorParameterDescription(_data.flags)), ("suggestedName", ConstructorParameterDescription(_data.suggestedName)), ("suggestedUsername", ConstructorParameterDescription(_data.suggestedUsername))]) - case .requestPeerTypeUser(let _data): - return ("requestPeerTypeUser", [("flags", ConstructorParameterDescription(_data.flags)), ("bot", ConstructorParameterDescription(_data.bot)), ("premium", ConstructorParameterDescription(_data.premium))]) - } - } - - public static func parse_requestPeerTypeBroadcast(_ reader: BufferReader) -> RequestPeerType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Bool? - if Int(_1!) & Int(1 << 3) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Bool - } - } - var _3: Api.ChatAdminRights? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights - } - } - var _4: Api.ChatAdminRights? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights - } - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.RequestPeerType.requestPeerTypeBroadcast(Cons_requestPeerTypeBroadcast(flags: _1!, hasUsername: _2, userAdminRights: _3, botAdminRights: _4)) - } - else { - return nil - } - } - public static func parse_requestPeerTypeChat(_ reader: BufferReader) -> RequestPeerType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Bool? - if Int(_1!) & Int(1 << 3) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Bool - } - } - var _3: Api.Bool? - if Int(_1!) & Int(1 << 4) != 0 { - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.Bool - } - } - var _4: Api.ChatAdminRights? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights - } - } - var _5: Api.ChatAdminRights? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights - } - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 4) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.RequestPeerType.requestPeerTypeChat(Cons_requestPeerTypeChat(flags: _1!, hasUsername: _2, forum: _3, userAdminRights: _4, botAdminRights: _5)) - } - else { - return nil - } - } - public static func parse_requestPeerTypeCreateBot(_ reader: BufferReader) -> RequestPeerType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - if Int(_1!) & Int(1 << 1) != 0 { - _2 = parseString(reader) - } - var _3: String? - if Int(_1!) & Int(1 << 2) != 0 { - _3 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil - if _c1 && _c2 && _c3 { - return Api.RequestPeerType.requestPeerTypeCreateBot(Cons_requestPeerTypeCreateBot(flags: _1!, suggestedName: _2, suggestedUsername: _3)) - } - else { - return nil - } - } - public static func parse_requestPeerTypeUser(_ reader: BufferReader) -> RequestPeerType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Bool? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Bool - } - } - var _3: Api.Bool? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.Bool - } - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - if _c1 && _c2 && _c3 { - return Api.RequestPeerType.requestPeerTypeUser(Cons_requestPeerTypeUser(flags: _1!, bot: _2, premium: _3)) - } - else { - return nil - } - } - } -} -public extension Api { - enum RequestedPeer: TypeConstructorDescription { - public class Cons_requestedPeerChannel: TypeConstructorDescription { - public var flags: Int32 - public var channelId: Int64 - public var title: String? - public var username: String? - public var photo: Api.Photo? - public init(flags: Int32, channelId: Int64, title: String?, username: String?, photo: Api.Photo?) { - self.flags = flags - self.channelId = channelId - self.title = title - self.username = username - self.photo = photo - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestedPeerChannel", [("flags", ConstructorParameterDescription(self.flags)), ("channelId", ConstructorParameterDescription(self.channelId)), ("title", ConstructorParameterDescription(self.title)), ("username", ConstructorParameterDescription(self.username)), ("photo", ConstructorParameterDescription(self.photo))]) - } - } - public class Cons_requestedPeerChat: TypeConstructorDescription { - public var flags: Int32 - public var chatId: Int64 - public var title: String? - public var photo: Api.Photo? - public init(flags: Int32, chatId: Int64, title: String?, photo: Api.Photo?) { - self.flags = flags - self.chatId = chatId - self.title = title - self.photo = photo - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestedPeerChat", [("flags", ConstructorParameterDescription(self.flags)), ("chatId", ConstructorParameterDescription(self.chatId)), ("title", ConstructorParameterDescription(self.title)), ("photo", ConstructorParameterDescription(self.photo))]) - } - } - public class Cons_requestedPeerUser: TypeConstructorDescription { - public var flags: Int32 - public var userId: Int64 - public var firstName: String? - public var lastName: String? - public var username: String? - public var photo: Api.Photo? - public init(flags: Int32, userId: Int64, firstName: String?, lastName: String?, username: String?, photo: Api.Photo?) { - self.flags = flags - self.userId = userId - self.firstName = firstName - self.lastName = lastName - self.username = username - self.photo = photo - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requestedPeerUser", [("flags", ConstructorParameterDescription(self.flags)), ("userId", ConstructorParameterDescription(self.userId)), ("firstName", ConstructorParameterDescription(self.firstName)), ("lastName", ConstructorParameterDescription(self.lastName)), ("username", ConstructorParameterDescription(self.username)), ("photo", ConstructorParameterDescription(self.photo))]) - } - } - case requestedPeerChannel(Cons_requestedPeerChannel) - case requestedPeerChat(Cons_requestedPeerChat) - case requestedPeerUser(Cons_requestedPeerUser) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .requestedPeerChannel(let _data): - if boxed { - buffer.appendInt32(-1952185372) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.channelId, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.title!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.username!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.photo!.serialize(buffer, true) - } - break - case .requestedPeerChat(let _data): - if boxed { - buffer.appendInt32(1929860175) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.chatId, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.title!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.photo!.serialize(buffer, true) - } - break - case .requestedPeerUser(let _data): - if boxed { - buffer.appendInt32(-701500310) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.userId, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.firstName!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.lastName!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.username!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.photo!.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .requestedPeerChannel(let _data): - return ("requestedPeerChannel", [("flags", ConstructorParameterDescription(_data.flags)), ("channelId", ConstructorParameterDescription(_data.channelId)), ("title", ConstructorParameterDescription(_data.title)), ("username", ConstructorParameterDescription(_data.username)), ("photo", ConstructorParameterDescription(_data.photo))]) - case .requestedPeerChat(let _data): - return ("requestedPeerChat", [("flags", ConstructorParameterDescription(_data.flags)), ("chatId", ConstructorParameterDescription(_data.chatId)), ("title", ConstructorParameterDescription(_data.title)), ("photo", ConstructorParameterDescription(_data.photo))]) - case .requestedPeerUser(let _data): - return ("requestedPeerUser", [("flags", ConstructorParameterDescription(_data.flags)), ("userId", ConstructorParameterDescription(_data.userId)), ("firstName", ConstructorParameterDescription(_data.firstName)), ("lastName", ConstructorParameterDescription(_data.lastName)), ("username", ConstructorParameterDescription(_data.username)), ("photo", ConstructorParameterDescription(_data.photo))]) - } - } - - public static func parse_requestedPeerChannel(_ reader: BufferReader) -> RequestedPeer? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: String? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = parseString(reader) - } - var _4: String? - if Int(_1!) & Int(1 << 1) != 0 { - _4 = parseString(reader) - } - var _5: Api.Photo? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.Photo - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.RequestedPeer.requestedPeerChannel(Cons_requestedPeerChannel(flags: _1!, channelId: _2!, title: _3, username: _4, photo: _5)) - } - else { - return nil - } - } - public static func parse_requestedPeerChat(_ reader: BufferReader) -> RequestedPeer? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: String? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = parseString(reader) - } - var _4: Api.Photo? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.Photo - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.RequestedPeer.requestedPeerChat(Cons_requestedPeerChat(flags: _1!, chatId: _2!, title: _3, photo: _4)) - } - else { - return nil - } - } - public static func parse_requestedPeerUser(_ reader: BufferReader) -> RequestedPeer? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: String? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = parseString(reader) - } - var _4: String? - if Int(_1!) & Int(1 << 0) != 0 { - _4 = parseString(reader) - } - var _5: String? - if Int(_1!) & Int(1 << 1) != 0 { - _5 = parseString(reader) - } - var _6: Api.Photo? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.Photo - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.RequestedPeer.requestedPeerUser(Cons_requestedPeerUser(flags: _1!, userId: _2!, firstName: _3, lastName: _4, username: _5, photo: _6)) - } - else { - return nil - } - } - } -} -public extension Api { - enum RequirementToContact: TypeConstructorDescription { - public class Cons_requirementToContactPaidMessages: TypeConstructorDescription { - public var starsAmount: Int64 - public init(starsAmount: Int64) { - self.starsAmount = starsAmount - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("requirementToContactPaidMessages", [("starsAmount", ConstructorParameterDescription(self.starsAmount))]) - } - } - case requirementToContactEmpty - case requirementToContactPaidMessages(Cons_requirementToContactPaidMessages) - case requirementToContactPremium - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .requirementToContactEmpty: - if boxed { - buffer.appendInt32(84580409) - } - break - case .requirementToContactPaidMessages(let _data): - if boxed { - buffer.appendInt32(-1258914157) - } - serializeInt64(_data.starsAmount, buffer: buffer, boxed: false) - break - case .requirementToContactPremium: - if boxed { - buffer.appendInt32(-444472087) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .requirementToContactEmpty: - return ("requirementToContactEmpty", []) - case .requirementToContactPaidMessages(let _data): - return ("requirementToContactPaidMessages", [("starsAmount", ConstructorParameterDescription(_data.starsAmount))]) - case .requirementToContactPremium: - return ("requirementToContactPremium", []) - } - } - - public static func parse_requirementToContactEmpty(_ reader: BufferReader) -> RequirementToContact? { - return Api.RequirementToContact.requirementToContactEmpty - } - public static func parse_requirementToContactPaidMessages(_ reader: BufferReader) -> RequirementToContact? { - var _1: Int64? - _1 = reader.readInt64() - let _c1 = _1 != nil - if _c1 { - return Api.RequirementToContact.requirementToContactPaidMessages(Cons_requirementToContactPaidMessages(starsAmount: _1!)) - } - else { - return nil - } - } - public static func parse_requirementToContactPremium(_ reader: BufferReader) -> RequirementToContact? { - return Api.RequirementToContact.requirementToContactPremium - } - } -} diff --git a/submodules/TelegramApi/Sources/Api23.swift b/submodules/TelegramApi/Sources/Api23.swift index 9e9f2b2b5c..fd9129f79e 100644 --- a/submodules/TelegramApi/Sources/Api23.swift +++ b/submodules/TelegramApi/Sources/Api23.swift @@ -1,3 +1,646 @@ +public extension Api { + enum ReportResult: TypeConstructorDescription { + public class Cons_reportResultAddComment: TypeConstructorDescription { + public var flags: Int32 + public var option: Buffer + public init(flags: Int32, option: Buffer) { + self.flags = flags + self.option = option + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reportResultAddComment", [("flags", ConstructorParameterDescription(self.flags)), ("option", ConstructorParameterDescription(self.option))]) + } + } + public class Cons_reportResultChooseOption: TypeConstructorDescription { + public var title: String + public var options: [Api.MessageReportOption] + public init(title: String, options: [Api.MessageReportOption]) { + self.title = title + self.options = options + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reportResultChooseOption", [("title", ConstructorParameterDescription(self.title)), ("options", ConstructorParameterDescription(self.options))]) + } + } + case reportResultAddComment(Cons_reportResultAddComment) + case reportResultChooseOption(Cons_reportResultChooseOption) + case reportResultReported + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reportResultAddComment(let _data): + if boxed { + buffer.appendInt32(1862904881) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeBytes(_data.option, buffer: buffer, boxed: false) + break + case .reportResultChooseOption(let _data): + if boxed { + buffer.appendInt32(-253435722) + } + serializeString(_data.title, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.options.count)) + for item in _data.options { + item.serialize(buffer, true) + } + break + case .reportResultReported: + if boxed { + buffer.appendInt32(-1917633461) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reportResultAddComment(let _data): + return ("reportResultAddComment", [("flags", ConstructorParameterDescription(_data.flags)), ("option", ConstructorParameterDescription(_data.option))]) + case .reportResultChooseOption(let _data): + return ("reportResultChooseOption", [("title", ConstructorParameterDescription(_data.title)), ("options", ConstructorParameterDescription(_data.options))]) + case .reportResultReported: + return ("reportResultReported", []) + } + } + + public static func parse_reportResultAddComment(_ reader: BufferReader) -> ReportResult? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Buffer? + _2 = parseBytes(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.ReportResult.reportResultAddComment(Cons_reportResultAddComment(flags: _1!, option: _2!)) + } + else { + return nil + } + } + public static func parse_reportResultChooseOption(_ reader: BufferReader) -> ReportResult? { + var _1: String? + _1 = parseString(reader) + var _2: [Api.MessageReportOption]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageReportOption.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.ReportResult.reportResultChooseOption(Cons_reportResultChooseOption(title: _1!, options: _2!)) + } + else { + return nil + } + } + public static func parse_reportResultReported(_ reader: BufferReader) -> ReportResult? { + return Api.ReportResult.reportResultReported + } + } +} +public extension Api { + enum RequestPeerType: TypeConstructorDescription { + public class Cons_requestPeerTypeBroadcast: TypeConstructorDescription { + public var flags: Int32 + public var hasUsername: Api.Bool? + public var userAdminRights: Api.ChatAdminRights? + public var botAdminRights: Api.ChatAdminRights? + public init(flags: Int32, hasUsername: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?) { + self.flags = flags + self.hasUsername = hasUsername + self.userAdminRights = userAdminRights + self.botAdminRights = botAdminRights + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestPeerTypeBroadcast", [("flags", ConstructorParameterDescription(self.flags)), ("hasUsername", ConstructorParameterDescription(self.hasUsername)), ("userAdminRights", ConstructorParameterDescription(self.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(self.botAdminRights))]) + } + } + public class Cons_requestPeerTypeChat: TypeConstructorDescription { + public var flags: Int32 + public var hasUsername: Api.Bool? + public var forum: Api.Bool? + public var userAdminRights: Api.ChatAdminRights? + public var botAdminRights: Api.ChatAdminRights? + public init(flags: Int32, hasUsername: Api.Bool?, forum: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?) { + self.flags = flags + self.hasUsername = hasUsername + self.forum = forum + self.userAdminRights = userAdminRights + self.botAdminRights = botAdminRights + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestPeerTypeChat", [("flags", ConstructorParameterDescription(self.flags)), ("hasUsername", ConstructorParameterDescription(self.hasUsername)), ("forum", ConstructorParameterDescription(self.forum)), ("userAdminRights", ConstructorParameterDescription(self.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(self.botAdminRights))]) + } + } + public class Cons_requestPeerTypeCreateBot: TypeConstructorDescription { + public var flags: Int32 + public var suggestedName: String? + public var suggestedUsername: String? + public init(flags: Int32, suggestedName: String?, suggestedUsername: String?) { + self.flags = flags + self.suggestedName = suggestedName + self.suggestedUsername = suggestedUsername + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestPeerTypeCreateBot", [("flags", ConstructorParameterDescription(self.flags)), ("suggestedName", ConstructorParameterDescription(self.suggestedName)), ("suggestedUsername", ConstructorParameterDescription(self.suggestedUsername))]) + } + } + public class Cons_requestPeerTypeUser: TypeConstructorDescription { + public var flags: Int32 + public var bot: Api.Bool? + public var premium: Api.Bool? + public init(flags: Int32, bot: Api.Bool?, premium: Api.Bool?) { + self.flags = flags + self.bot = bot + self.premium = premium + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestPeerTypeUser", [("flags", ConstructorParameterDescription(self.flags)), ("bot", ConstructorParameterDescription(self.bot)), ("premium", ConstructorParameterDescription(self.premium))]) + } + } + case requestPeerTypeBroadcast(Cons_requestPeerTypeBroadcast) + case requestPeerTypeChat(Cons_requestPeerTypeChat) + case requestPeerTypeCreateBot(Cons_requestPeerTypeCreateBot) + case requestPeerTypeUser(Cons_requestPeerTypeUser) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .requestPeerTypeBroadcast(let _data): + if boxed { + buffer.appendInt32(865857388) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 3) != 0 { + _data.hasUsername!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.userAdminRights!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.botAdminRights!.serialize(buffer, true) + } + break + case .requestPeerTypeChat(let _data): + if boxed { + buffer.appendInt32(-906990053) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 3) != 0 { + _data.hasUsername!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + _data.forum!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.userAdminRights!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.botAdminRights!.serialize(buffer, true) + } + break + case .requestPeerTypeCreateBot(let _data): + if boxed { + buffer.appendInt32(1048699000) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.suggestedName!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeString(_data.suggestedUsername!, buffer: buffer, boxed: false) + } + break + case .requestPeerTypeUser(let _data): + if boxed { + buffer.appendInt32(1597737472) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.bot!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.premium!.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .requestPeerTypeBroadcast(let _data): + return ("requestPeerTypeBroadcast", [("flags", ConstructorParameterDescription(_data.flags)), ("hasUsername", ConstructorParameterDescription(_data.hasUsername)), ("userAdminRights", ConstructorParameterDescription(_data.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(_data.botAdminRights))]) + case .requestPeerTypeChat(let _data): + return ("requestPeerTypeChat", [("flags", ConstructorParameterDescription(_data.flags)), ("hasUsername", ConstructorParameterDescription(_data.hasUsername)), ("forum", ConstructorParameterDescription(_data.forum)), ("userAdminRights", ConstructorParameterDescription(_data.userAdminRights)), ("botAdminRights", ConstructorParameterDescription(_data.botAdminRights))]) + case .requestPeerTypeCreateBot(let _data): + return ("requestPeerTypeCreateBot", [("flags", ConstructorParameterDescription(_data.flags)), ("suggestedName", ConstructorParameterDescription(_data.suggestedName)), ("suggestedUsername", ConstructorParameterDescription(_data.suggestedUsername))]) + case .requestPeerTypeUser(let _data): + return ("requestPeerTypeUser", [("flags", ConstructorParameterDescription(_data.flags)), ("bot", ConstructorParameterDescription(_data.bot)), ("premium", ConstructorParameterDescription(_data.premium))]) + } + } + + public static func parse_requestPeerTypeBroadcast(_ reader: BufferReader) -> RequestPeerType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Bool? + if Int(_1!) & Int(1 << 3) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Bool + } + } + var _3: Api.ChatAdminRights? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + } + } + var _4: Api.ChatAdminRights? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + } + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.RequestPeerType.requestPeerTypeBroadcast(Cons_requestPeerTypeBroadcast(flags: _1!, hasUsername: _2, userAdminRights: _3, botAdminRights: _4)) + } + else { + return nil + } + } + public static func parse_requestPeerTypeChat(_ reader: BufferReader) -> RequestPeerType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Bool? + if Int(_1!) & Int(1 << 3) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Bool + } + } + var _3: Api.Bool? + if Int(_1!) & Int(1 << 4) != 0 { + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.Bool + } + } + var _4: Api.ChatAdminRights? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + } + } + var _5: Api.ChatAdminRights? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights + } + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 4) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.RequestPeerType.requestPeerTypeChat(Cons_requestPeerTypeChat(flags: _1!, hasUsername: _2, forum: _3, userAdminRights: _4, botAdminRights: _5)) + } + else { + return nil + } + } + public static func parse_requestPeerTypeCreateBot(_ reader: BufferReader) -> RequestPeerType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + if Int(_1!) & Int(1 << 1) != 0 { + _2 = parseString(reader) + } + var _3: String? + if Int(_1!) & Int(1 << 2) != 0 { + _3 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.RequestPeerType.requestPeerTypeCreateBot(Cons_requestPeerTypeCreateBot(flags: _1!, suggestedName: _2, suggestedUsername: _3)) + } + else { + return nil + } + } + public static func parse_requestPeerTypeUser(_ reader: BufferReader) -> RequestPeerType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Bool? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Bool + } + } + var _3: Api.Bool? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.Bool + } + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.RequestPeerType.requestPeerTypeUser(Cons_requestPeerTypeUser(flags: _1!, bot: _2, premium: _3)) + } + else { + return nil + } + } + } +} +public extension Api { + enum RequestedPeer: TypeConstructorDescription { + public class Cons_requestedPeerChannel: TypeConstructorDescription { + public var flags: Int32 + public var channelId: Int64 + public var title: String? + public var username: String? + public var photo: Api.Photo? + public init(flags: Int32, channelId: Int64, title: String?, username: String?, photo: Api.Photo?) { + self.flags = flags + self.channelId = channelId + self.title = title + self.username = username + self.photo = photo + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestedPeerChannel", [("flags", ConstructorParameterDescription(self.flags)), ("channelId", ConstructorParameterDescription(self.channelId)), ("title", ConstructorParameterDescription(self.title)), ("username", ConstructorParameterDescription(self.username)), ("photo", ConstructorParameterDescription(self.photo))]) + } + } + public class Cons_requestedPeerChat: TypeConstructorDescription { + public var flags: Int32 + public var chatId: Int64 + public var title: String? + public var photo: Api.Photo? + public init(flags: Int32, chatId: Int64, title: String?, photo: Api.Photo?) { + self.flags = flags + self.chatId = chatId + self.title = title + self.photo = photo + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestedPeerChat", [("flags", ConstructorParameterDescription(self.flags)), ("chatId", ConstructorParameterDescription(self.chatId)), ("title", ConstructorParameterDescription(self.title)), ("photo", ConstructorParameterDescription(self.photo))]) + } + } + public class Cons_requestedPeerUser: TypeConstructorDescription { + public var flags: Int32 + public var userId: Int64 + public var firstName: String? + public var lastName: String? + public var username: String? + public var photo: Api.Photo? + public init(flags: Int32, userId: Int64, firstName: String?, lastName: String?, username: String?, photo: Api.Photo?) { + self.flags = flags + self.userId = userId + self.firstName = firstName + self.lastName = lastName + self.username = username + self.photo = photo + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requestedPeerUser", [("flags", ConstructorParameterDescription(self.flags)), ("userId", ConstructorParameterDescription(self.userId)), ("firstName", ConstructorParameterDescription(self.firstName)), ("lastName", ConstructorParameterDescription(self.lastName)), ("username", ConstructorParameterDescription(self.username)), ("photo", ConstructorParameterDescription(self.photo))]) + } + } + case requestedPeerChannel(Cons_requestedPeerChannel) + case requestedPeerChat(Cons_requestedPeerChat) + case requestedPeerUser(Cons_requestedPeerUser) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .requestedPeerChannel(let _data): + if boxed { + buffer.appendInt32(-1952185372) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.channelId, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.title!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.username!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.photo!.serialize(buffer, true) + } + break + case .requestedPeerChat(let _data): + if boxed { + buffer.appendInt32(1929860175) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.chatId, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.title!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.photo!.serialize(buffer, true) + } + break + case .requestedPeerUser(let _data): + if boxed { + buffer.appendInt32(-701500310) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.userId, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.firstName!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.lastName!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.username!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.photo!.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .requestedPeerChannel(let _data): + return ("requestedPeerChannel", [("flags", ConstructorParameterDescription(_data.flags)), ("channelId", ConstructorParameterDescription(_data.channelId)), ("title", ConstructorParameterDescription(_data.title)), ("username", ConstructorParameterDescription(_data.username)), ("photo", ConstructorParameterDescription(_data.photo))]) + case .requestedPeerChat(let _data): + return ("requestedPeerChat", [("flags", ConstructorParameterDescription(_data.flags)), ("chatId", ConstructorParameterDescription(_data.chatId)), ("title", ConstructorParameterDescription(_data.title)), ("photo", ConstructorParameterDescription(_data.photo))]) + case .requestedPeerUser(let _data): + return ("requestedPeerUser", [("flags", ConstructorParameterDescription(_data.flags)), ("userId", ConstructorParameterDescription(_data.userId)), ("firstName", ConstructorParameterDescription(_data.firstName)), ("lastName", ConstructorParameterDescription(_data.lastName)), ("username", ConstructorParameterDescription(_data.username)), ("photo", ConstructorParameterDescription(_data.photo))]) + } + } + + public static func parse_requestedPeerChannel(_ reader: BufferReader) -> RequestedPeer? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: String? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = parseString(reader) + } + var _4: String? + if Int(_1!) & Int(1 << 1) != 0 { + _4 = parseString(reader) + } + var _5: Api.Photo? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.Photo + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.RequestedPeer.requestedPeerChannel(Cons_requestedPeerChannel(flags: _1!, channelId: _2!, title: _3, username: _4, photo: _5)) + } + else { + return nil + } + } + public static func parse_requestedPeerChat(_ reader: BufferReader) -> RequestedPeer? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: String? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = parseString(reader) + } + var _4: Api.Photo? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.Photo + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.RequestedPeer.requestedPeerChat(Cons_requestedPeerChat(flags: _1!, chatId: _2!, title: _3, photo: _4)) + } + else { + return nil + } + } + public static func parse_requestedPeerUser(_ reader: BufferReader) -> RequestedPeer? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: String? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = parseString(reader) + } + var _4: String? + if Int(_1!) & Int(1 << 0) != 0 { + _4 = parseString(reader) + } + var _5: String? + if Int(_1!) & Int(1 << 1) != 0 { + _5 = parseString(reader) + } + var _6: Api.Photo? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.Photo + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.RequestedPeer.requestedPeerUser(Cons_requestedPeerUser(flags: _1!, userId: _2!, firstName: _3, lastName: _4, username: _5, photo: _6)) + } + else { + return nil + } + } + } +} +public extension Api { + enum RequirementToContact: TypeConstructorDescription { + public class Cons_requirementToContactPaidMessages: TypeConstructorDescription { + public var starsAmount: Int64 + public init(starsAmount: Int64) { + self.starsAmount = starsAmount + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("requirementToContactPaidMessages", [("starsAmount", ConstructorParameterDescription(self.starsAmount))]) + } + } + case requirementToContactEmpty + case requirementToContactPaidMessages(Cons_requirementToContactPaidMessages) + case requirementToContactPremium + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .requirementToContactEmpty: + if boxed { + buffer.appendInt32(84580409) + } + break + case .requirementToContactPaidMessages(let _data): + if boxed { + buffer.appendInt32(-1258914157) + } + serializeInt64(_data.starsAmount, buffer: buffer, boxed: false) + break + case .requirementToContactPremium: + if boxed { + buffer.appendInt32(-444472087) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .requirementToContactEmpty: + return ("requirementToContactEmpty", []) + case .requirementToContactPaidMessages(let _data): + return ("requirementToContactPaidMessages", [("starsAmount", ConstructorParameterDescription(_data.starsAmount))]) + case .requirementToContactPremium: + return ("requirementToContactPremium", []) + } + } + + public static func parse_requirementToContactEmpty(_ reader: BufferReader) -> RequirementToContact? { + return Api.RequirementToContact.requirementToContactEmpty + } + public static func parse_requirementToContactPaidMessages(_ reader: BufferReader) -> RequirementToContact? { + var _1: Int64? + _1 = reader.readInt64() + let _c1 = _1 != nil + if _c1 { + return Api.RequirementToContact.requirementToContactPaidMessages(Cons_requirementToContactPaidMessages(starsAmount: _1!)) + } + else { + return nil + } + } + public static func parse_requirementToContactPremium(_ reader: BufferReader) -> RequirementToContact? { + return Api.RequirementToContact.requirementToContactPremium + } + } +} public extension Api { enum RestrictionReason: TypeConstructorDescription { public class Cons_restrictionReason: TypeConstructorDescription { @@ -786,766 +1429,3 @@ public extension Api { } } } -public extension Api { - enum SavedReactionTag: TypeConstructorDescription { - public class Cons_savedReactionTag: TypeConstructorDescription { - public var flags: Int32 - public var reaction: Api.Reaction - public var title: String? - public var count: Int32 - public init(flags: Int32, reaction: Api.Reaction, title: String?, count: Int32) { - self.flags = flags - self.reaction = reaction - self.title = title - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("savedReactionTag", [("flags", ConstructorParameterDescription(self.flags)), ("reaction", ConstructorParameterDescription(self.reaction)), ("title", ConstructorParameterDescription(self.title)), ("count", ConstructorParameterDescription(self.count))]) - } - } - case savedReactionTag(Cons_savedReactionTag) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .savedReactionTag(let _data): - if boxed { - buffer.appendInt32(-881854424) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.reaction.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.title!, buffer: buffer, boxed: false) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .savedReactionTag(let _data): - return ("savedReactionTag", [("flags", ConstructorParameterDescription(_data.flags)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("title", ConstructorParameterDescription(_data.title)), ("count", ConstructorParameterDescription(_data.count))]) - } - } - - public static func parse_savedReactionTag(_ reader: BufferReader) -> SavedReactionTag? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Reaction? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Reaction - } - var _3: String? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = parseString(reader) - } - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.SavedReactionTag.savedReactionTag(Cons_savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SavedStarGift: TypeConstructorDescription { - public class Cons_savedStarGift: TypeConstructorDescription { - public var flags: Int32 - public var fromId: Api.Peer? - public var date: Int32 - public var gift: Api.StarGift - public var message: Api.TextWithEntities? - public var msgId: Int32? - public var savedId: Int64? - public var convertStars: Int64? - public var upgradeStars: Int64? - public var canExportAt: Int32? - public var transferStars: Int64? - public var canTransferAt: Int32? - public var canResellAt: Int32? - public var collectionId: [Int32]? - public var prepaidUpgradeHash: String? - public var dropOriginalDetailsStars: Int64? - public var giftNum: Int32? - public var canCraftAt: Int32? - public init(flags: Int32, fromId: Api.Peer?, date: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, msgId: Int32?, savedId: Int64?, convertStars: Int64?, upgradeStars: Int64?, canExportAt: Int32?, transferStars: Int64?, canTransferAt: Int32?, canResellAt: Int32?, collectionId: [Int32]?, prepaidUpgradeHash: String?, dropOriginalDetailsStars: Int64?, giftNum: Int32?, canCraftAt: Int32?) { - self.flags = flags - self.fromId = fromId - self.date = date - self.gift = gift - self.message = message - self.msgId = msgId - self.savedId = savedId - self.convertStars = convertStars - self.upgradeStars = upgradeStars - self.canExportAt = canExportAt - self.transferStars = transferStars - self.canTransferAt = canTransferAt - self.canResellAt = canResellAt - self.collectionId = collectionId - self.prepaidUpgradeHash = prepaidUpgradeHash - self.dropOriginalDetailsStars = dropOriginalDetailsStars - self.giftNum = giftNum - self.canCraftAt = canCraftAt - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("savedStarGift", [("flags", ConstructorParameterDescription(self.flags)), ("fromId", ConstructorParameterDescription(self.fromId)), ("date", ConstructorParameterDescription(self.date)), ("gift", ConstructorParameterDescription(self.gift)), ("message", ConstructorParameterDescription(self.message)), ("msgId", ConstructorParameterDescription(self.msgId)), ("savedId", ConstructorParameterDescription(self.savedId)), ("convertStars", ConstructorParameterDescription(self.convertStars)), ("upgradeStars", ConstructorParameterDescription(self.upgradeStars)), ("canExportAt", ConstructorParameterDescription(self.canExportAt)), ("transferStars", ConstructorParameterDescription(self.transferStars)), ("canTransferAt", ConstructorParameterDescription(self.canTransferAt)), ("canResellAt", ConstructorParameterDescription(self.canResellAt)), ("collectionId", ConstructorParameterDescription(self.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(self.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(self.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(self.giftNum)), ("canCraftAt", ConstructorParameterDescription(self.canCraftAt))]) - } - } - case savedStarGift(Cons_savedStarGift) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .savedStarGift(let _data): - if boxed { - buffer.appendInt32(1105150972) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.fromId!.serialize(buffer, true) - } - serializeInt32(_data.date, buffer: buffer, boxed: false) - _data.gift.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.message!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt32(_data.msgId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 11) != 0 { - serializeInt64(_data.savedId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt64(_data.convertStars!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 6) != 0 { - serializeInt64(_data.upgradeStars!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 7) != 0 { - serializeInt32(_data.canExportAt!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 8) != 0 { - serializeInt64(_data.transferStars!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 13) != 0 { - serializeInt32(_data.canTransferAt!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 14) != 0 { - serializeInt32(_data.canResellAt!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 15) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.collectionId!.count)) - for item in _data.collectionId! { - serializeInt32(item, buffer: buffer, boxed: false) - } - } - if Int(_data.flags) & Int(1 << 16) != 0 { - serializeString(_data.prepaidUpgradeHash!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 18) != 0 { - serializeInt64(_data.dropOriginalDetailsStars!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 19) != 0 { - serializeInt32(_data.giftNum!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 20) != 0 { - serializeInt32(_data.canCraftAt!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .savedStarGift(let _data): - return ("savedStarGift", [("flags", ConstructorParameterDescription(_data.flags)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("date", ConstructorParameterDescription(_data.date)), ("gift", ConstructorParameterDescription(_data.gift)), ("message", ConstructorParameterDescription(_data.message)), ("msgId", ConstructorParameterDescription(_data.msgId)), ("savedId", ConstructorParameterDescription(_data.savedId)), ("convertStars", ConstructorParameterDescription(_data.convertStars)), ("upgradeStars", ConstructorParameterDescription(_data.upgradeStars)), ("canExportAt", ConstructorParameterDescription(_data.canExportAt)), ("transferStars", ConstructorParameterDescription(_data.transferStars)), ("canTransferAt", ConstructorParameterDescription(_data.canTransferAt)), ("canResellAt", ConstructorParameterDescription(_data.canResellAt)), ("collectionId", ConstructorParameterDescription(_data.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(_data.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(_data.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(_data.giftNum)), ("canCraftAt", ConstructorParameterDescription(_data.canCraftAt))]) - } - } - - public static func parse_savedStarGift(_ reader: BufferReader) -> SavedStarGift? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - } - var _3: Int32? - _3 = reader.readInt32() - var _4: Api.StarGift? - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.StarGift - } - var _5: Api.TextWithEntities? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - } - var _6: Int32? - if Int(_1!) & Int(1 << 3) != 0 { - _6 = reader.readInt32() - } - var _7: Int64? - if Int(_1!) & Int(1 << 11) != 0 { - _7 = reader.readInt64() - } - var _8: Int64? - if Int(_1!) & Int(1 << 4) != 0 { - _8 = reader.readInt64() - } - var _9: Int64? - if Int(_1!) & Int(1 << 6) != 0 { - _9 = reader.readInt64() - } - var _10: Int32? - if Int(_1!) & Int(1 << 7) != 0 { - _10 = reader.readInt32() - } - var _11: Int64? - if Int(_1!) & Int(1 << 8) != 0 { - _11 = reader.readInt64() - } - var _12: Int32? - if Int(_1!) & Int(1 << 13) != 0 { - _12 = reader.readInt32() - } - var _13: Int32? - if Int(_1!) & Int(1 << 14) != 0 { - _13 = reader.readInt32() - } - var _14: [Int32]? - if Int(_1!) & Int(1 << 15) != 0 { - if let _ = reader.readInt32() { - _14 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) - } - } - var _15: String? - if Int(_1!) & Int(1 << 16) != 0 { - _15 = parseString(reader) - } - var _16: Int64? - if Int(_1!) & Int(1 << 18) != 0 { - _16 = reader.readInt64() - } - var _17: Int32? - if Int(_1!) & Int(1 << 19) != 0 { - _17 = reader.readInt32() - } - var _18: Int32? - if Int(_1!) & Int(1 << 20) != 0 { - _18 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil - let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil - let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil - let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil - let _c10 = (Int(_1!) & Int(1 << 7) == 0) || _10 != nil - let _c11 = (Int(_1!) & Int(1 << 8) == 0) || _11 != nil - let _c12 = (Int(_1!) & Int(1 << 13) == 0) || _12 != nil - let _c13 = (Int(_1!) & Int(1 << 14) == 0) || _13 != nil - let _c14 = (Int(_1!) & Int(1 << 15) == 0) || _14 != nil - let _c15 = (Int(_1!) & Int(1 << 16) == 0) || _15 != nil - let _c16 = (Int(_1!) & Int(1 << 18) == 0) || _16 != nil - let _c17 = (Int(_1!) & Int(1 << 19) == 0) || _17 != nil - let _c18 = (Int(_1!) & Int(1 << 20) == 0) || _18 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 { - return Api.SavedStarGift.savedStarGift(Cons_savedStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, savedId: _7, convertStars: _8, upgradeStars: _9, canExportAt: _10, transferStars: _11, canTransferAt: _12, canResellAt: _13, collectionId: _14, prepaidUpgradeHash: _15, dropOriginalDetailsStars: _16, giftNum: _17, canCraftAt: _18)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SearchPostsFlood: TypeConstructorDescription { - public class Cons_searchPostsFlood: TypeConstructorDescription { - public var flags: Int32 - public var totalDaily: Int32 - public var remains: Int32 - public var waitTill: Int32? - public var starsAmount: Int64 - public init(flags: Int32, totalDaily: Int32, remains: Int32, waitTill: Int32?, starsAmount: Int64) { - self.flags = flags - self.totalDaily = totalDaily - self.remains = remains - self.waitTill = waitTill - self.starsAmount = starsAmount - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("searchPostsFlood", [("flags", ConstructorParameterDescription(self.flags)), ("totalDaily", ConstructorParameterDescription(self.totalDaily)), ("remains", ConstructorParameterDescription(self.remains)), ("waitTill", ConstructorParameterDescription(self.waitTill)), ("starsAmount", ConstructorParameterDescription(self.starsAmount))]) - } - } - case searchPostsFlood(Cons_searchPostsFlood) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .searchPostsFlood(let _data): - if boxed { - buffer.appendInt32(1040931690) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.totalDaily, buffer: buffer, boxed: false) - serializeInt32(_data.remains, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.waitTill!, buffer: buffer, boxed: false) - } - serializeInt64(_data.starsAmount, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .searchPostsFlood(let _data): - return ("searchPostsFlood", [("flags", ConstructorParameterDescription(_data.flags)), ("totalDaily", ConstructorParameterDescription(_data.totalDaily)), ("remains", ConstructorParameterDescription(_data.remains)), ("waitTill", ConstructorParameterDescription(_data.waitTill)), ("starsAmount", ConstructorParameterDescription(_data.starsAmount))]) - } - } - - public static func parse_searchPostsFlood(_ reader: BufferReader) -> SearchPostsFlood? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _4 = reader.readInt32() - } - var _5: Int64? - _5 = reader.readInt64() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil - let _c5 = _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.SearchPostsFlood.searchPostsFlood(Cons_searchPostsFlood(flags: _1!, totalDaily: _2!, remains: _3!, waitTill: _4, starsAmount: _5!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SearchResultsCalendarPeriod: TypeConstructorDescription { - public class Cons_searchResultsCalendarPeriod: TypeConstructorDescription { - public var date: Int32 - public var minMsgId: Int32 - public var maxMsgId: Int32 - public var count: Int32 - public init(date: Int32, minMsgId: Int32, maxMsgId: Int32, count: Int32) { - self.date = date - self.minMsgId = minMsgId - self.maxMsgId = maxMsgId - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(self.date)), ("minMsgId", ConstructorParameterDescription(self.minMsgId)), ("maxMsgId", ConstructorParameterDescription(self.maxMsgId)), ("count", ConstructorParameterDescription(self.count))]) - } - } - case searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .searchResultsCalendarPeriod(let _data): - if boxed { - buffer.appendInt32(-911191137) - } - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt32(_data.minMsgId, buffer: buffer, boxed: false) - serializeInt32(_data.maxMsgId, buffer: buffer, boxed: false) - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .searchResultsCalendarPeriod(let _data): - return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(_data.date)), ("minMsgId", ConstructorParameterDescription(_data.minMsgId)), ("maxMsgId", ConstructorParameterDescription(_data.maxMsgId)), ("count", ConstructorParameterDescription(_data.count))]) - } - } - - public static func parse_searchResultsCalendarPeriod(_ reader: BufferReader) -> SearchResultsCalendarPeriod? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.SearchResultsCalendarPeriod.searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod(date: _1!, minMsgId: _2!, maxMsgId: _3!, count: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SearchResultsPosition: TypeConstructorDescription { - public class Cons_searchResultPosition: TypeConstructorDescription { - public var msgId: Int32 - public var date: Int32 - public var offset: Int32 - public init(msgId: Int32, date: Int32, offset: Int32) { - self.msgId = msgId - self.date = date - self.offset = offset - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("searchResultPosition", [("msgId", ConstructorParameterDescription(self.msgId)), ("date", ConstructorParameterDescription(self.date)), ("offset", ConstructorParameterDescription(self.offset))]) - } - } - case searchResultPosition(Cons_searchResultPosition) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .searchResultPosition(let _data): - if boxed { - buffer.appendInt32(2137295719) - } - serializeInt32(_data.msgId, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt32(_data.offset, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .searchResultPosition(let _data): - return ("searchResultPosition", [("msgId", ConstructorParameterDescription(_data.msgId)), ("date", ConstructorParameterDescription(_data.date)), ("offset", ConstructorParameterDescription(_data.offset))]) - } - } - - public static func parse_searchResultPosition(_ reader: BufferReader) -> SearchResultsPosition? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.SearchResultsPosition.searchResultPosition(Cons_searchResultPosition(msgId: _1!, date: _2!, offset: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SecureCredentialsEncrypted: TypeConstructorDescription { - public class Cons_secureCredentialsEncrypted: TypeConstructorDescription { - public var data: Buffer - public var hash: Buffer - public var secret: Buffer - public init(data: Buffer, hash: Buffer, secret: Buffer) { - self.data = data - self.hash = hash - self.secret = secret - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(self.data)), ("hash", ConstructorParameterDescription(self.hash)), ("secret", ConstructorParameterDescription(self.secret))]) - } - } - case secureCredentialsEncrypted(Cons_secureCredentialsEncrypted) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .secureCredentialsEncrypted(let _data): - if boxed { - buffer.appendInt32(871426631) - } - serializeBytes(_data.data, buffer: buffer, boxed: false) - serializeBytes(_data.hash, buffer: buffer, boxed: false) - serializeBytes(_data.secret, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .secureCredentialsEncrypted(let _data): - return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(_data.data)), ("hash", ConstructorParameterDescription(_data.hash)), ("secret", ConstructorParameterDescription(_data.secret))]) - } - } - - public static func parse_secureCredentialsEncrypted(_ reader: BufferReader) -> SecureCredentialsEncrypted? { - var _1: Buffer? - _1 = parseBytes(reader) - var _2: Buffer? - _2 = parseBytes(reader) - var _3: Buffer? - _3 = parseBytes(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.SecureCredentialsEncrypted.secureCredentialsEncrypted(Cons_secureCredentialsEncrypted(data: _1!, hash: _2!, secret: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SecureData: TypeConstructorDescription { - public class Cons_secureData: TypeConstructorDescription { - public var data: Buffer - public var dataHash: Buffer - public var secret: Buffer - public init(data: Buffer, dataHash: Buffer, secret: Buffer) { - self.data = data - self.dataHash = dataHash - self.secret = secret - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("secureData", [("data", ConstructorParameterDescription(self.data)), ("dataHash", ConstructorParameterDescription(self.dataHash)), ("secret", ConstructorParameterDescription(self.secret))]) - } - } - case secureData(Cons_secureData) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .secureData(let _data): - if boxed { - buffer.appendInt32(-1964327229) - } - serializeBytes(_data.data, buffer: buffer, boxed: false) - serializeBytes(_data.dataHash, buffer: buffer, boxed: false) - serializeBytes(_data.secret, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .secureData(let _data): - return ("secureData", [("data", ConstructorParameterDescription(_data.data)), ("dataHash", ConstructorParameterDescription(_data.dataHash)), ("secret", ConstructorParameterDescription(_data.secret))]) - } - } - - public static func parse_secureData(_ reader: BufferReader) -> SecureData? { - var _1: Buffer? - _1 = parseBytes(reader) - var _2: Buffer? - _2 = parseBytes(reader) - var _3: Buffer? - _3 = parseBytes(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.SecureData.secureData(Cons_secureData(data: _1!, dataHash: _2!, secret: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SecureFile: TypeConstructorDescription { - public class Cons_secureFile: TypeConstructorDescription { - public var id: Int64 - public var accessHash: Int64 - public var size: Int64 - public var dcId: Int32 - public var date: Int32 - public var fileHash: Buffer - public var secret: Buffer - public init(id: Int64, accessHash: Int64, size: Int64, dcId: Int32, date: Int32, fileHash: Buffer, secret: Buffer) { - self.id = id - self.accessHash = accessHash - self.size = size - self.dcId = dcId - self.date = date - self.fileHash = fileHash - self.secret = secret - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("secureFile", [("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("size", ConstructorParameterDescription(self.size)), ("dcId", ConstructorParameterDescription(self.dcId)), ("date", ConstructorParameterDescription(self.date)), ("fileHash", ConstructorParameterDescription(self.fileHash)), ("secret", ConstructorParameterDescription(self.secret))]) - } - } - case secureFile(Cons_secureFile) - case secureFileEmpty - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .secureFile(let _data): - if boxed { - buffer.appendInt32(2097791614) - } - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeInt64(_data.size, buffer: buffer, boxed: false) - serializeInt32(_data.dcId, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeBytes(_data.fileHash, buffer: buffer, boxed: false) - serializeBytes(_data.secret, buffer: buffer, boxed: false) - break - case .secureFileEmpty: - if boxed { - buffer.appendInt32(1679398724) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .secureFile(let _data): - return ("secureFile", [("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("size", ConstructorParameterDescription(_data.size)), ("dcId", ConstructorParameterDescription(_data.dcId)), ("date", ConstructorParameterDescription(_data.date)), ("fileHash", ConstructorParameterDescription(_data.fileHash)), ("secret", ConstructorParameterDescription(_data.secret))]) - case .secureFileEmpty: - return ("secureFileEmpty", []) - } - } - - public static func parse_secureFile(_ reader: BufferReader) -> SecureFile? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int32? - _5 = reader.readInt32() - var _6: Buffer? - _6 = parseBytes(reader) - var _7: Buffer? - _7 = parseBytes(reader) - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.SecureFile.secureFile(Cons_secureFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, date: _5!, fileHash: _6!, secret: _7!)) - } - else { - return nil - } - } - public static func parse_secureFileEmpty(_ reader: BufferReader) -> SecureFile? { - return Api.SecureFile.secureFileEmpty - } - } -} -public extension Api { - enum SecurePasswordKdfAlgo: TypeConstructorDescription { - public class Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000: TypeConstructorDescription { - public var salt: Buffer - public init(salt: Buffer) { - self.salt = salt - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("securePasswordKdfAlgoPBKDF2HMACSHA512iter100000", [("salt", ConstructorParameterDescription(self.salt))]) - } - } - public class Cons_securePasswordKdfAlgoSHA512: TypeConstructorDescription { - public var salt: Buffer - public init(salt: Buffer) { - self.salt = salt - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("securePasswordKdfAlgoSHA512", [("salt", ConstructorParameterDescription(self.salt))]) - } - } - case securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) - case securePasswordKdfAlgoSHA512(Cons_securePasswordKdfAlgoSHA512) - case securePasswordKdfAlgoUnknown - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(let _data): - if boxed { - buffer.appendInt32(-1141711456) - } - serializeBytes(_data.salt, buffer: buffer, boxed: false) - break - case .securePasswordKdfAlgoSHA512(let _data): - if boxed { - buffer.appendInt32(-2042159726) - } - serializeBytes(_data.salt, buffer: buffer, boxed: false) - break - case .securePasswordKdfAlgoUnknown: - if boxed { - buffer.appendInt32(4883767) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(let _data): - return ("securePasswordKdfAlgoPBKDF2HMACSHA512iter100000", [("salt", ConstructorParameterDescription(_data.salt))]) - case .securePasswordKdfAlgoSHA512(let _data): - return ("securePasswordKdfAlgoSHA512", [("salt", ConstructorParameterDescription(_data.salt))]) - case .securePasswordKdfAlgoUnknown: - return ("securePasswordKdfAlgoUnknown", []) - } - } - - public static func parse_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { - var _1: Buffer? - _1 = parseBytes(reader) - let _c1 = _1 != nil - if _c1 { - return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(salt: _1!)) - } - else { - return nil - } - } - public static func parse_securePasswordKdfAlgoSHA512(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { - var _1: Buffer? - _1 = parseBytes(reader) - let _c1 = _1 != nil - if _c1 { - return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoSHA512(Cons_securePasswordKdfAlgoSHA512(salt: _1!)) - } - else { - return nil - } - } - public static func parse_securePasswordKdfAlgoUnknown(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { - return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoUnknown - } - } -} diff --git a/submodules/TelegramApi/Sources/Api24.swift b/submodules/TelegramApi/Sources/Api24.swift index a72b6cde79..6a23eeaf81 100644 --- a/submodules/TelegramApi/Sources/Api24.swift +++ b/submodules/TelegramApi/Sources/Api24.swift @@ -1,3 +1,766 @@ +public extension Api { + enum SavedReactionTag: TypeConstructorDescription { + public class Cons_savedReactionTag: TypeConstructorDescription { + public var flags: Int32 + public var reaction: Api.Reaction + public var title: String? + public var count: Int32 + public init(flags: Int32, reaction: Api.Reaction, title: String?, count: Int32) { + self.flags = flags + self.reaction = reaction + self.title = title + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("savedReactionTag", [("flags", ConstructorParameterDescription(self.flags)), ("reaction", ConstructorParameterDescription(self.reaction)), ("title", ConstructorParameterDescription(self.title)), ("count", ConstructorParameterDescription(self.count))]) + } + } + case savedReactionTag(Cons_savedReactionTag) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .savedReactionTag(let _data): + if boxed { + buffer.appendInt32(-881854424) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.reaction.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.title!, buffer: buffer, boxed: false) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .savedReactionTag(let _data): + return ("savedReactionTag", [("flags", ConstructorParameterDescription(_data.flags)), ("reaction", ConstructorParameterDescription(_data.reaction)), ("title", ConstructorParameterDescription(_data.title)), ("count", ConstructorParameterDescription(_data.count))]) + } + } + + public static func parse_savedReactionTag(_ reader: BufferReader) -> SavedReactionTag? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Reaction? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Reaction + } + var _3: String? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = parseString(reader) + } + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.SavedReactionTag.savedReactionTag(Cons_savedReactionTag(flags: _1!, reaction: _2!, title: _3, count: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SavedStarGift: TypeConstructorDescription { + public class Cons_savedStarGift: TypeConstructorDescription { + public var flags: Int32 + public var fromId: Api.Peer? + public var date: Int32 + public var gift: Api.StarGift + public var message: Api.TextWithEntities? + public var msgId: Int32? + public var savedId: Int64? + public var convertStars: Int64? + public var upgradeStars: Int64? + public var canExportAt: Int32? + public var transferStars: Int64? + public var canTransferAt: Int32? + public var canResellAt: Int32? + public var collectionId: [Int32]? + public var prepaidUpgradeHash: String? + public var dropOriginalDetailsStars: Int64? + public var giftNum: Int32? + public var canCraftAt: Int32? + public init(flags: Int32, fromId: Api.Peer?, date: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, msgId: Int32?, savedId: Int64?, convertStars: Int64?, upgradeStars: Int64?, canExportAt: Int32?, transferStars: Int64?, canTransferAt: Int32?, canResellAt: Int32?, collectionId: [Int32]?, prepaidUpgradeHash: String?, dropOriginalDetailsStars: Int64?, giftNum: Int32?, canCraftAt: Int32?) { + self.flags = flags + self.fromId = fromId + self.date = date + self.gift = gift + self.message = message + self.msgId = msgId + self.savedId = savedId + self.convertStars = convertStars + self.upgradeStars = upgradeStars + self.canExportAt = canExportAt + self.transferStars = transferStars + self.canTransferAt = canTransferAt + self.canResellAt = canResellAt + self.collectionId = collectionId + self.prepaidUpgradeHash = prepaidUpgradeHash + self.dropOriginalDetailsStars = dropOriginalDetailsStars + self.giftNum = giftNum + self.canCraftAt = canCraftAt + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("savedStarGift", [("flags", ConstructorParameterDescription(self.flags)), ("fromId", ConstructorParameterDescription(self.fromId)), ("date", ConstructorParameterDescription(self.date)), ("gift", ConstructorParameterDescription(self.gift)), ("message", ConstructorParameterDescription(self.message)), ("msgId", ConstructorParameterDescription(self.msgId)), ("savedId", ConstructorParameterDescription(self.savedId)), ("convertStars", ConstructorParameterDescription(self.convertStars)), ("upgradeStars", ConstructorParameterDescription(self.upgradeStars)), ("canExportAt", ConstructorParameterDescription(self.canExportAt)), ("transferStars", ConstructorParameterDescription(self.transferStars)), ("canTransferAt", ConstructorParameterDescription(self.canTransferAt)), ("canResellAt", ConstructorParameterDescription(self.canResellAt)), ("collectionId", ConstructorParameterDescription(self.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(self.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(self.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(self.giftNum)), ("canCraftAt", ConstructorParameterDescription(self.canCraftAt))]) + } + } + case savedStarGift(Cons_savedStarGift) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .savedStarGift(let _data): + if boxed { + buffer.appendInt32(1105150972) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.fromId!.serialize(buffer, true) + } + serializeInt32(_data.date, buffer: buffer, boxed: false) + _data.gift.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.message!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.msgId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 11) != 0 { + serializeInt64(_data.savedId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt64(_data.convertStars!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 6) != 0 { + serializeInt64(_data.upgradeStars!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 7) != 0 { + serializeInt32(_data.canExportAt!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 8) != 0 { + serializeInt64(_data.transferStars!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 13) != 0 { + serializeInt32(_data.canTransferAt!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 14) != 0 { + serializeInt32(_data.canResellAt!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 15) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.collectionId!.count)) + for item in _data.collectionId! { + serializeInt32(item, buffer: buffer, boxed: false) + } + } + if Int(_data.flags) & Int(1 << 16) != 0 { + serializeString(_data.prepaidUpgradeHash!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 18) != 0 { + serializeInt64(_data.dropOriginalDetailsStars!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 19) != 0 { + serializeInt32(_data.giftNum!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 20) != 0 { + serializeInt32(_data.canCraftAt!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .savedStarGift(let _data): + return ("savedStarGift", [("flags", ConstructorParameterDescription(_data.flags)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("date", ConstructorParameterDescription(_data.date)), ("gift", ConstructorParameterDescription(_data.gift)), ("message", ConstructorParameterDescription(_data.message)), ("msgId", ConstructorParameterDescription(_data.msgId)), ("savedId", ConstructorParameterDescription(_data.savedId)), ("convertStars", ConstructorParameterDescription(_data.convertStars)), ("upgradeStars", ConstructorParameterDescription(_data.upgradeStars)), ("canExportAt", ConstructorParameterDescription(_data.canExportAt)), ("transferStars", ConstructorParameterDescription(_data.transferStars)), ("canTransferAt", ConstructorParameterDescription(_data.canTransferAt)), ("canResellAt", ConstructorParameterDescription(_data.canResellAt)), ("collectionId", ConstructorParameterDescription(_data.collectionId)), ("prepaidUpgradeHash", ConstructorParameterDescription(_data.prepaidUpgradeHash)), ("dropOriginalDetailsStars", ConstructorParameterDescription(_data.dropOriginalDetailsStars)), ("giftNum", ConstructorParameterDescription(_data.giftNum)), ("canCraftAt", ConstructorParameterDescription(_data.canCraftAt))]) + } + } + + public static func parse_savedStarGift(_ reader: BufferReader) -> SavedStarGift? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Peer? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Peer + } + } + var _3: Int32? + _3 = reader.readInt32() + var _4: Api.StarGift? + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.StarGift + } + var _5: Api.TextWithEntities? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + } + var _6: Int32? + if Int(_1!) & Int(1 << 3) != 0 { + _6 = reader.readInt32() + } + var _7: Int64? + if Int(_1!) & Int(1 << 11) != 0 { + _7 = reader.readInt64() + } + var _8: Int64? + if Int(_1!) & Int(1 << 4) != 0 { + _8 = reader.readInt64() + } + var _9: Int64? + if Int(_1!) & Int(1 << 6) != 0 { + _9 = reader.readInt64() + } + var _10: Int32? + if Int(_1!) & Int(1 << 7) != 0 { + _10 = reader.readInt32() + } + var _11: Int64? + if Int(_1!) & Int(1 << 8) != 0 { + _11 = reader.readInt64() + } + var _12: Int32? + if Int(_1!) & Int(1 << 13) != 0 { + _12 = reader.readInt32() + } + var _13: Int32? + if Int(_1!) & Int(1 << 14) != 0 { + _13 = reader.readInt32() + } + var _14: [Int32]? + if Int(_1!) & Int(1 << 15) != 0 { + if let _ = reader.readInt32() { + _14 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + } + var _15: String? + if Int(_1!) & Int(1 << 16) != 0 { + _15 = parseString(reader) + } + var _16: Int64? + if Int(_1!) & Int(1 << 18) != 0 { + _16 = reader.readInt64() + } + var _17: Int32? + if Int(_1!) & Int(1 << 19) != 0 { + _17 = reader.readInt32() + } + var _18: Int32? + if Int(_1!) & Int(1 << 20) != 0 { + _18 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil + let _c7 = (Int(_1!) & Int(1 << 11) == 0) || _7 != nil + let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 6) == 0) || _9 != nil + let _c10 = (Int(_1!) & Int(1 << 7) == 0) || _10 != nil + let _c11 = (Int(_1!) & Int(1 << 8) == 0) || _11 != nil + let _c12 = (Int(_1!) & Int(1 << 13) == 0) || _12 != nil + let _c13 = (Int(_1!) & Int(1 << 14) == 0) || _13 != nil + let _c14 = (Int(_1!) & Int(1 << 15) == 0) || _14 != nil + let _c15 = (Int(_1!) & Int(1 << 16) == 0) || _15 != nil + let _c16 = (Int(_1!) & Int(1 << 18) == 0) || _16 != nil + let _c17 = (Int(_1!) & Int(1 << 19) == 0) || _17 != nil + let _c18 = (Int(_1!) & Int(1 << 20) == 0) || _18 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 { + return Api.SavedStarGift.savedStarGift(Cons_savedStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, savedId: _7, convertStars: _8, upgradeStars: _9, canExportAt: _10, transferStars: _11, canTransferAt: _12, canResellAt: _13, collectionId: _14, prepaidUpgradeHash: _15, dropOriginalDetailsStars: _16, giftNum: _17, canCraftAt: _18)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SearchPostsFlood: TypeConstructorDescription { + public class Cons_searchPostsFlood: TypeConstructorDescription { + public var flags: Int32 + public var totalDaily: Int32 + public var remains: Int32 + public var waitTill: Int32? + public var starsAmount: Int64 + public init(flags: Int32, totalDaily: Int32, remains: Int32, waitTill: Int32?, starsAmount: Int64) { + self.flags = flags + self.totalDaily = totalDaily + self.remains = remains + self.waitTill = waitTill + self.starsAmount = starsAmount + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("searchPostsFlood", [("flags", ConstructorParameterDescription(self.flags)), ("totalDaily", ConstructorParameterDescription(self.totalDaily)), ("remains", ConstructorParameterDescription(self.remains)), ("waitTill", ConstructorParameterDescription(self.waitTill)), ("starsAmount", ConstructorParameterDescription(self.starsAmount))]) + } + } + case searchPostsFlood(Cons_searchPostsFlood) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .searchPostsFlood(let _data): + if boxed { + buffer.appendInt32(1040931690) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.totalDaily, buffer: buffer, boxed: false) + serializeInt32(_data.remains, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.waitTill!, buffer: buffer, boxed: false) + } + serializeInt64(_data.starsAmount, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .searchPostsFlood(let _data): + return ("searchPostsFlood", [("flags", ConstructorParameterDescription(_data.flags)), ("totalDaily", ConstructorParameterDescription(_data.totalDaily)), ("remains", ConstructorParameterDescription(_data.remains)), ("waitTill", ConstructorParameterDescription(_data.waitTill)), ("starsAmount", ConstructorParameterDescription(_data.starsAmount))]) + } + } + + public static func parse_searchPostsFlood(_ reader: BufferReader) -> SearchPostsFlood? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _4 = reader.readInt32() + } + var _5: Int64? + _5 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.SearchPostsFlood.searchPostsFlood(Cons_searchPostsFlood(flags: _1!, totalDaily: _2!, remains: _3!, waitTill: _4, starsAmount: _5!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SearchResultsCalendarPeriod: TypeConstructorDescription { + public class Cons_searchResultsCalendarPeriod: TypeConstructorDescription { + public var date: Int32 + public var minMsgId: Int32 + public var maxMsgId: Int32 + public var count: Int32 + public init(date: Int32, minMsgId: Int32, maxMsgId: Int32, count: Int32) { + self.date = date + self.minMsgId = minMsgId + self.maxMsgId = maxMsgId + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(self.date)), ("minMsgId", ConstructorParameterDescription(self.minMsgId)), ("maxMsgId", ConstructorParameterDescription(self.maxMsgId)), ("count", ConstructorParameterDescription(self.count))]) + } + } + case searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .searchResultsCalendarPeriod(let _data): + if boxed { + buffer.appendInt32(-911191137) + } + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt32(_data.minMsgId, buffer: buffer, boxed: false) + serializeInt32(_data.maxMsgId, buffer: buffer, boxed: false) + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .searchResultsCalendarPeriod(let _data): + return ("searchResultsCalendarPeriod", [("date", ConstructorParameterDescription(_data.date)), ("minMsgId", ConstructorParameterDescription(_data.minMsgId)), ("maxMsgId", ConstructorParameterDescription(_data.maxMsgId)), ("count", ConstructorParameterDescription(_data.count))]) + } + } + + public static func parse_searchResultsCalendarPeriod(_ reader: BufferReader) -> SearchResultsCalendarPeriod? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.SearchResultsCalendarPeriod.searchResultsCalendarPeriod(Cons_searchResultsCalendarPeriod(date: _1!, minMsgId: _2!, maxMsgId: _3!, count: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SearchResultsPosition: TypeConstructorDescription { + public class Cons_searchResultPosition: TypeConstructorDescription { + public var msgId: Int32 + public var date: Int32 + public var offset: Int32 + public init(msgId: Int32, date: Int32, offset: Int32) { + self.msgId = msgId + self.date = date + self.offset = offset + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("searchResultPosition", [("msgId", ConstructorParameterDescription(self.msgId)), ("date", ConstructorParameterDescription(self.date)), ("offset", ConstructorParameterDescription(self.offset))]) + } + } + case searchResultPosition(Cons_searchResultPosition) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .searchResultPosition(let _data): + if boxed { + buffer.appendInt32(2137295719) + } + serializeInt32(_data.msgId, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt32(_data.offset, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .searchResultPosition(let _data): + return ("searchResultPosition", [("msgId", ConstructorParameterDescription(_data.msgId)), ("date", ConstructorParameterDescription(_data.date)), ("offset", ConstructorParameterDescription(_data.offset))]) + } + } + + public static func parse_searchResultPosition(_ reader: BufferReader) -> SearchResultsPosition? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.SearchResultsPosition.searchResultPosition(Cons_searchResultPosition(msgId: _1!, date: _2!, offset: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SecureCredentialsEncrypted: TypeConstructorDescription { + public class Cons_secureCredentialsEncrypted: TypeConstructorDescription { + public var data: Buffer + public var hash: Buffer + public var secret: Buffer + public init(data: Buffer, hash: Buffer, secret: Buffer) { + self.data = data + self.hash = hash + self.secret = secret + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(self.data)), ("hash", ConstructorParameterDescription(self.hash)), ("secret", ConstructorParameterDescription(self.secret))]) + } + } + case secureCredentialsEncrypted(Cons_secureCredentialsEncrypted) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .secureCredentialsEncrypted(let _data): + if boxed { + buffer.appendInt32(871426631) + } + serializeBytes(_data.data, buffer: buffer, boxed: false) + serializeBytes(_data.hash, buffer: buffer, boxed: false) + serializeBytes(_data.secret, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .secureCredentialsEncrypted(let _data): + return ("secureCredentialsEncrypted", [("data", ConstructorParameterDescription(_data.data)), ("hash", ConstructorParameterDescription(_data.hash)), ("secret", ConstructorParameterDescription(_data.secret))]) + } + } + + public static func parse_secureCredentialsEncrypted(_ reader: BufferReader) -> SecureCredentialsEncrypted? { + var _1: Buffer? + _1 = parseBytes(reader) + var _2: Buffer? + _2 = parseBytes(reader) + var _3: Buffer? + _3 = parseBytes(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.SecureCredentialsEncrypted.secureCredentialsEncrypted(Cons_secureCredentialsEncrypted(data: _1!, hash: _2!, secret: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SecureData: TypeConstructorDescription { + public class Cons_secureData: TypeConstructorDescription { + public var data: Buffer + public var dataHash: Buffer + public var secret: Buffer + public init(data: Buffer, dataHash: Buffer, secret: Buffer) { + self.data = data + self.dataHash = dataHash + self.secret = secret + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("secureData", [("data", ConstructorParameterDescription(self.data)), ("dataHash", ConstructorParameterDescription(self.dataHash)), ("secret", ConstructorParameterDescription(self.secret))]) + } + } + case secureData(Cons_secureData) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .secureData(let _data): + if boxed { + buffer.appendInt32(-1964327229) + } + serializeBytes(_data.data, buffer: buffer, boxed: false) + serializeBytes(_data.dataHash, buffer: buffer, boxed: false) + serializeBytes(_data.secret, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .secureData(let _data): + return ("secureData", [("data", ConstructorParameterDescription(_data.data)), ("dataHash", ConstructorParameterDescription(_data.dataHash)), ("secret", ConstructorParameterDescription(_data.secret))]) + } + } + + public static func parse_secureData(_ reader: BufferReader) -> SecureData? { + var _1: Buffer? + _1 = parseBytes(reader) + var _2: Buffer? + _2 = parseBytes(reader) + var _3: Buffer? + _3 = parseBytes(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.SecureData.secureData(Cons_secureData(data: _1!, dataHash: _2!, secret: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SecureFile: TypeConstructorDescription { + public class Cons_secureFile: TypeConstructorDescription { + public var id: Int64 + public var accessHash: Int64 + public var size: Int64 + public var dcId: Int32 + public var date: Int32 + public var fileHash: Buffer + public var secret: Buffer + public init(id: Int64, accessHash: Int64, size: Int64, dcId: Int32, date: Int32, fileHash: Buffer, secret: Buffer) { + self.id = id + self.accessHash = accessHash + self.size = size + self.dcId = dcId + self.date = date + self.fileHash = fileHash + self.secret = secret + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("secureFile", [("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("size", ConstructorParameterDescription(self.size)), ("dcId", ConstructorParameterDescription(self.dcId)), ("date", ConstructorParameterDescription(self.date)), ("fileHash", ConstructorParameterDescription(self.fileHash)), ("secret", ConstructorParameterDescription(self.secret))]) + } + } + case secureFile(Cons_secureFile) + case secureFileEmpty + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .secureFile(let _data): + if boxed { + buffer.appendInt32(2097791614) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeInt64(_data.size, buffer: buffer, boxed: false) + serializeInt32(_data.dcId, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeBytes(_data.fileHash, buffer: buffer, boxed: false) + serializeBytes(_data.secret, buffer: buffer, boxed: false) + break + case .secureFileEmpty: + if boxed { + buffer.appendInt32(1679398724) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .secureFile(let _data): + return ("secureFile", [("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("size", ConstructorParameterDescription(_data.size)), ("dcId", ConstructorParameterDescription(_data.dcId)), ("date", ConstructorParameterDescription(_data.date)), ("fileHash", ConstructorParameterDescription(_data.fileHash)), ("secret", ConstructorParameterDescription(_data.secret))]) + case .secureFileEmpty: + return ("secureFileEmpty", []) + } + } + + public static func parse_secureFile(_ reader: BufferReader) -> SecureFile? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int32? + _5 = reader.readInt32() + var _6: Buffer? + _6 = parseBytes(reader) + var _7: Buffer? + _7 = parseBytes(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { + return Api.SecureFile.secureFile(Cons_secureFile(id: _1!, accessHash: _2!, size: _3!, dcId: _4!, date: _5!, fileHash: _6!, secret: _7!)) + } + else { + return nil + } + } + public static func parse_secureFileEmpty(_ reader: BufferReader) -> SecureFile? { + return Api.SecureFile.secureFileEmpty + } + } +} +public extension Api { + enum SecurePasswordKdfAlgo: TypeConstructorDescription { + public class Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000: TypeConstructorDescription { + public var salt: Buffer + public init(salt: Buffer) { + self.salt = salt + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("securePasswordKdfAlgoPBKDF2HMACSHA512iter100000", [("salt", ConstructorParameterDescription(self.salt))]) + } + } + public class Cons_securePasswordKdfAlgoSHA512: TypeConstructorDescription { + public var salt: Buffer + public init(salt: Buffer) { + self.salt = salt + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("securePasswordKdfAlgoSHA512", [("salt", ConstructorParameterDescription(self.salt))]) + } + } + case securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000) + case securePasswordKdfAlgoSHA512(Cons_securePasswordKdfAlgoSHA512) + case securePasswordKdfAlgoUnknown + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(let _data): + if boxed { + buffer.appendInt32(-1141711456) + } + serializeBytes(_data.salt, buffer: buffer, boxed: false) + break + case .securePasswordKdfAlgoSHA512(let _data): + if boxed { + buffer.appendInt32(-2042159726) + } + serializeBytes(_data.salt, buffer: buffer, boxed: false) + break + case .securePasswordKdfAlgoUnknown: + if boxed { + buffer.appendInt32(4883767) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(let _data): + return ("securePasswordKdfAlgoPBKDF2HMACSHA512iter100000", [("salt", ConstructorParameterDescription(_data.salt))]) + case .securePasswordKdfAlgoSHA512(let _data): + return ("securePasswordKdfAlgoSHA512", [("salt", ConstructorParameterDescription(_data.salt))]) + case .securePasswordKdfAlgoUnknown: + return ("securePasswordKdfAlgoUnknown", []) + } + } + + public static func parse_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { + var _1: Buffer? + _1 = parseBytes(reader) + let _c1 = _1 != nil + if _c1 { + return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(Cons_securePasswordKdfAlgoPBKDF2HMACSHA512iter100000(salt: _1!)) + } + else { + return nil + } + } + public static func parse_securePasswordKdfAlgoSHA512(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { + var _1: Buffer? + _1 = parseBytes(reader) + let _c1 = _1 != nil + if _c1 { + return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoSHA512(Cons_securePasswordKdfAlgoSHA512(salt: _1!)) + } + else { + return nil + } + } + public static func parse_securePasswordKdfAlgoUnknown(_ reader: BufferReader) -> SecurePasswordKdfAlgo? { + return Api.SecurePasswordKdfAlgo.securePasswordKdfAlgoUnknown + } + } +} public extension Api { enum SecurePlainData: TypeConstructorDescription { public class Cons_securePlainEmail: TypeConstructorDescription { @@ -996,463 +1759,3 @@ public extension Api { } } } -public extension Api { - enum SendAsPeer: TypeConstructorDescription { - public class Cons_sendAsPeer: TypeConstructorDescription { - public var flags: Int32 - public var peer: Api.Peer - public init(flags: Int32, peer: Api.Peer) { - self.flags = flags - self.peer = peer - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendAsPeer", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer))]) - } - } - case sendAsPeer(Cons_sendAsPeer) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .sendAsPeer(let _data): - if boxed { - buffer.appendInt32(-1206095820) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.peer.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .sendAsPeer(let _data): - return ("sendAsPeer", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer))]) - } - } - - public static func parse_sendAsPeer(_ reader: BufferReader) -> SendAsPeer? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.SendAsPeer.sendAsPeer(Cons_sendAsPeer(flags: _1!, peer: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum SendMessageAction: TypeConstructorDescription { - public class Cons_sendMessageEmojiInteraction: TypeConstructorDescription { - public var emoticon: String - public var msgId: Int32 - public var interaction: Api.DataJSON - public init(emoticon: String, msgId: Int32, interaction: Api.DataJSON) { - self.emoticon = emoticon - self.msgId = msgId - self.interaction = interaction - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageEmojiInteraction", [("emoticon", ConstructorParameterDescription(self.emoticon)), ("msgId", ConstructorParameterDescription(self.msgId)), ("interaction", ConstructorParameterDescription(self.interaction))]) - } - } - public class Cons_sendMessageEmojiInteractionSeen: TypeConstructorDescription { - public var emoticon: String - public init(emoticon: String) { - self.emoticon = emoticon - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageEmojiInteractionSeen", [("emoticon", ConstructorParameterDescription(self.emoticon))]) - } - } - public class Cons_sendMessageHistoryImportAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageHistoryImportAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - public class Cons_sendMessageTextDraftAction: TypeConstructorDescription { - public var randomId: Int64 - public var text: Api.TextWithEntities - public init(randomId: Int64, text: Api.TextWithEntities) { - self.randomId = randomId - self.text = text - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageTextDraftAction", [("randomId", ConstructorParameterDescription(self.randomId)), ("text", ConstructorParameterDescription(self.text))]) - } - } - public class Cons_sendMessageUploadAudioAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageUploadAudioAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - public class Cons_sendMessageUploadDocumentAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageUploadDocumentAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - public class Cons_sendMessageUploadPhotoAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageUploadPhotoAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - public class Cons_sendMessageUploadRoundAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageUploadRoundAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - public class Cons_sendMessageUploadVideoAction: TypeConstructorDescription { - public var progress: Int32 - public init(progress: Int32) { - self.progress = progress - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sendMessageUploadVideoAction", [("progress", ConstructorParameterDescription(self.progress))]) - } - } - case sendMessageCancelAction - case sendMessageChooseContactAction - case sendMessageChooseStickerAction - case sendMessageEmojiInteraction(Cons_sendMessageEmojiInteraction) - case sendMessageEmojiInteractionSeen(Cons_sendMessageEmojiInteractionSeen) - case sendMessageGamePlayAction - case sendMessageGeoLocationAction - case sendMessageHistoryImportAction(Cons_sendMessageHistoryImportAction) - case sendMessageRecordAudioAction - case sendMessageRecordRoundAction - case sendMessageRecordVideoAction - case sendMessageTextDraftAction(Cons_sendMessageTextDraftAction) - case sendMessageTypingAction - case sendMessageUploadAudioAction(Cons_sendMessageUploadAudioAction) - case sendMessageUploadDocumentAction(Cons_sendMessageUploadDocumentAction) - case sendMessageUploadPhotoAction(Cons_sendMessageUploadPhotoAction) - case sendMessageUploadRoundAction(Cons_sendMessageUploadRoundAction) - case sendMessageUploadVideoAction(Cons_sendMessageUploadVideoAction) - case speakingInGroupCallAction - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .sendMessageCancelAction: - if boxed { - buffer.appendInt32(-44119819) - } - break - case .sendMessageChooseContactAction: - if boxed { - buffer.appendInt32(1653390447) - } - break - case .sendMessageChooseStickerAction: - if boxed { - buffer.appendInt32(-1336228175) - } - break - case .sendMessageEmojiInteraction(let _data): - if boxed { - buffer.appendInt32(630664139) - } - serializeString(_data.emoticon, buffer: buffer, boxed: false) - serializeInt32(_data.msgId, buffer: buffer, boxed: false) - _data.interaction.serialize(buffer, true) - break - case .sendMessageEmojiInteractionSeen(let _data): - if boxed { - buffer.appendInt32(-1234857938) - } - serializeString(_data.emoticon, buffer: buffer, boxed: false) - break - case .sendMessageGamePlayAction: - if boxed { - buffer.appendInt32(-580219064) - } - break - case .sendMessageGeoLocationAction: - if boxed { - buffer.appendInt32(393186209) - } - break - case .sendMessageHistoryImportAction(let _data): - if boxed { - buffer.appendInt32(-606432698) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .sendMessageRecordAudioAction: - if boxed { - buffer.appendInt32(-718310409) - } - break - case .sendMessageRecordRoundAction: - if boxed { - buffer.appendInt32(-1997373508) - } - break - case .sendMessageRecordVideoAction: - if boxed { - buffer.appendInt32(-1584933265) - } - break - case .sendMessageTextDraftAction(let _data): - if boxed { - buffer.appendInt32(929929052) - } - serializeInt64(_data.randomId, buffer: buffer, boxed: false) - _data.text.serialize(buffer, true) - break - case .sendMessageTypingAction: - if boxed { - buffer.appendInt32(381645902) - } - break - case .sendMessageUploadAudioAction(let _data): - if boxed { - buffer.appendInt32(-212740181) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .sendMessageUploadDocumentAction(let _data): - if boxed { - buffer.appendInt32(-1441998364) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .sendMessageUploadPhotoAction(let _data): - if boxed { - buffer.appendInt32(-774682074) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .sendMessageUploadRoundAction(let _data): - if boxed { - buffer.appendInt32(608050278) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .sendMessageUploadVideoAction(let _data): - if boxed { - buffer.appendInt32(-378127636) - } - serializeInt32(_data.progress, buffer: buffer, boxed: false) - break - case .speakingInGroupCallAction: - if boxed { - buffer.appendInt32(-651419003) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .sendMessageCancelAction: - return ("sendMessageCancelAction", []) - case .sendMessageChooseContactAction: - return ("sendMessageChooseContactAction", []) - case .sendMessageChooseStickerAction: - return ("sendMessageChooseStickerAction", []) - case .sendMessageEmojiInteraction(let _data): - return ("sendMessageEmojiInteraction", [("emoticon", ConstructorParameterDescription(_data.emoticon)), ("msgId", ConstructorParameterDescription(_data.msgId)), ("interaction", ConstructorParameterDescription(_data.interaction))]) - case .sendMessageEmojiInteractionSeen(let _data): - return ("sendMessageEmojiInteractionSeen", [("emoticon", ConstructorParameterDescription(_data.emoticon))]) - case .sendMessageGamePlayAction: - return ("sendMessageGamePlayAction", []) - case .sendMessageGeoLocationAction: - return ("sendMessageGeoLocationAction", []) - case .sendMessageHistoryImportAction(let _data): - return ("sendMessageHistoryImportAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .sendMessageRecordAudioAction: - return ("sendMessageRecordAudioAction", []) - case .sendMessageRecordRoundAction: - return ("sendMessageRecordRoundAction", []) - case .sendMessageRecordVideoAction: - return ("sendMessageRecordVideoAction", []) - case .sendMessageTextDraftAction(let _data): - return ("sendMessageTextDraftAction", [("randomId", ConstructorParameterDescription(_data.randomId)), ("text", ConstructorParameterDescription(_data.text))]) - case .sendMessageTypingAction: - return ("sendMessageTypingAction", []) - case .sendMessageUploadAudioAction(let _data): - return ("sendMessageUploadAudioAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .sendMessageUploadDocumentAction(let _data): - return ("sendMessageUploadDocumentAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .sendMessageUploadPhotoAction(let _data): - return ("sendMessageUploadPhotoAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .sendMessageUploadRoundAction(let _data): - return ("sendMessageUploadRoundAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .sendMessageUploadVideoAction(let _data): - return ("sendMessageUploadVideoAction", [("progress", ConstructorParameterDescription(_data.progress))]) - case .speakingInGroupCallAction: - return ("speakingInGroupCallAction", []) - } - } - - public static func parse_sendMessageCancelAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageCancelAction - } - public static func parse_sendMessageChooseContactAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageChooseContactAction - } - public static func parse_sendMessageChooseStickerAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageChooseStickerAction - } - public static func parse_sendMessageEmojiInteraction(_ reader: BufferReader) -> SendMessageAction? { - var _1: String? - _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() - var _3: Api.DataJSON? - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.DataJSON - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.SendMessageAction.sendMessageEmojiInteraction(Cons_sendMessageEmojiInteraction(emoticon: _1!, msgId: _2!, interaction: _3!)) - } - else { - return nil - } - } - public static func parse_sendMessageEmojiInteractionSeen(_ reader: BufferReader) -> SendMessageAction? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageEmojiInteractionSeen(Cons_sendMessageEmojiInteractionSeen(emoticon: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageGamePlayAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageGamePlayAction - } - public static func parse_sendMessageGeoLocationAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageGeoLocationAction - } - public static func parse_sendMessageHistoryImportAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageHistoryImportAction(Cons_sendMessageHistoryImportAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageRecordAudioAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageRecordAudioAction - } - public static func parse_sendMessageRecordRoundAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageRecordRoundAction - } - public static func parse_sendMessageRecordVideoAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageRecordVideoAction - } - public static func parse_sendMessageTextDraftAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Api.TextWithEntities? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.SendMessageAction.sendMessageTextDraftAction(Cons_sendMessageTextDraftAction(randomId: _1!, text: _2!)) - } - else { - return nil - } - } - public static func parse_sendMessageTypingAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.sendMessageTypingAction - } - public static func parse_sendMessageUploadAudioAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageUploadAudioAction(Cons_sendMessageUploadAudioAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageUploadDocumentAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageUploadDocumentAction(Cons_sendMessageUploadDocumentAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageUploadPhotoAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageUploadPhotoAction(Cons_sendMessageUploadPhotoAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageUploadRoundAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageUploadRoundAction(Cons_sendMessageUploadRoundAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_sendMessageUploadVideoAction(_ reader: BufferReader) -> SendMessageAction? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.SendMessageAction.sendMessageUploadVideoAction(Cons_sendMessageUploadVideoAction(progress: _1!)) - } - else { - return nil - } - } - public static func parse_speakingInGroupCallAction(_ reader: BufferReader) -> SendMessageAction? { - return Api.SendMessageAction.speakingInGroupCallAction - } - } -} diff --git a/submodules/TelegramApi/Sources/Api25.swift b/submodules/TelegramApi/Sources/Api25.swift index 36ee647b44..e1a8e002d6 100644 --- a/submodules/TelegramApi/Sources/Api25.swift +++ b/submodules/TelegramApi/Sources/Api25.swift @@ -1,3 +1,463 @@ +public extension Api { + enum SendAsPeer: TypeConstructorDescription { + public class Cons_sendAsPeer: TypeConstructorDescription { + public var flags: Int32 + public var peer: Api.Peer + public init(flags: Int32, peer: Api.Peer) { + self.flags = flags + self.peer = peer + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendAsPeer", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer))]) + } + } + case sendAsPeer(Cons_sendAsPeer) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .sendAsPeer(let _data): + if boxed { + buffer.appendInt32(-1206095820) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.peer.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .sendAsPeer(let _data): + return ("sendAsPeer", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer))]) + } + } + + public static func parse_sendAsPeer(_ reader: BufferReader) -> SendAsPeer? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Peer? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Peer + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.SendAsPeer.sendAsPeer(Cons_sendAsPeer(flags: _1!, peer: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum SendMessageAction: TypeConstructorDescription { + public class Cons_sendMessageEmojiInteraction: TypeConstructorDescription { + public var emoticon: String + public var msgId: Int32 + public var interaction: Api.DataJSON + public init(emoticon: String, msgId: Int32, interaction: Api.DataJSON) { + self.emoticon = emoticon + self.msgId = msgId + self.interaction = interaction + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageEmojiInteraction", [("emoticon", ConstructorParameterDescription(self.emoticon)), ("msgId", ConstructorParameterDescription(self.msgId)), ("interaction", ConstructorParameterDescription(self.interaction))]) + } + } + public class Cons_sendMessageEmojiInteractionSeen: TypeConstructorDescription { + public var emoticon: String + public init(emoticon: String) { + self.emoticon = emoticon + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageEmojiInteractionSeen", [("emoticon", ConstructorParameterDescription(self.emoticon))]) + } + } + public class Cons_sendMessageHistoryImportAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageHistoryImportAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + public class Cons_sendMessageTextDraftAction: TypeConstructorDescription { + public var randomId: Int64 + public var text: Api.TextWithEntities + public init(randomId: Int64, text: Api.TextWithEntities) { + self.randomId = randomId + self.text = text + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageTextDraftAction", [("randomId", ConstructorParameterDescription(self.randomId)), ("text", ConstructorParameterDescription(self.text))]) + } + } + public class Cons_sendMessageUploadAudioAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageUploadAudioAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + public class Cons_sendMessageUploadDocumentAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageUploadDocumentAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + public class Cons_sendMessageUploadPhotoAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageUploadPhotoAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + public class Cons_sendMessageUploadRoundAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageUploadRoundAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + public class Cons_sendMessageUploadVideoAction: TypeConstructorDescription { + public var progress: Int32 + public init(progress: Int32) { + self.progress = progress + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sendMessageUploadVideoAction", [("progress", ConstructorParameterDescription(self.progress))]) + } + } + case sendMessageCancelAction + case sendMessageChooseContactAction + case sendMessageChooseStickerAction + case sendMessageEmojiInteraction(Cons_sendMessageEmojiInteraction) + case sendMessageEmojiInteractionSeen(Cons_sendMessageEmojiInteractionSeen) + case sendMessageGamePlayAction + case sendMessageGeoLocationAction + case sendMessageHistoryImportAction(Cons_sendMessageHistoryImportAction) + case sendMessageRecordAudioAction + case sendMessageRecordRoundAction + case sendMessageRecordVideoAction + case sendMessageTextDraftAction(Cons_sendMessageTextDraftAction) + case sendMessageTypingAction + case sendMessageUploadAudioAction(Cons_sendMessageUploadAudioAction) + case sendMessageUploadDocumentAction(Cons_sendMessageUploadDocumentAction) + case sendMessageUploadPhotoAction(Cons_sendMessageUploadPhotoAction) + case sendMessageUploadRoundAction(Cons_sendMessageUploadRoundAction) + case sendMessageUploadVideoAction(Cons_sendMessageUploadVideoAction) + case speakingInGroupCallAction + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .sendMessageCancelAction: + if boxed { + buffer.appendInt32(-44119819) + } + break + case .sendMessageChooseContactAction: + if boxed { + buffer.appendInt32(1653390447) + } + break + case .sendMessageChooseStickerAction: + if boxed { + buffer.appendInt32(-1336228175) + } + break + case .sendMessageEmojiInteraction(let _data): + if boxed { + buffer.appendInt32(630664139) + } + serializeString(_data.emoticon, buffer: buffer, boxed: false) + serializeInt32(_data.msgId, buffer: buffer, boxed: false) + _data.interaction.serialize(buffer, true) + break + case .sendMessageEmojiInteractionSeen(let _data): + if boxed { + buffer.appendInt32(-1234857938) + } + serializeString(_data.emoticon, buffer: buffer, boxed: false) + break + case .sendMessageGamePlayAction: + if boxed { + buffer.appendInt32(-580219064) + } + break + case .sendMessageGeoLocationAction: + if boxed { + buffer.appendInt32(393186209) + } + break + case .sendMessageHistoryImportAction(let _data): + if boxed { + buffer.appendInt32(-606432698) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .sendMessageRecordAudioAction: + if boxed { + buffer.appendInt32(-718310409) + } + break + case .sendMessageRecordRoundAction: + if boxed { + buffer.appendInt32(-1997373508) + } + break + case .sendMessageRecordVideoAction: + if boxed { + buffer.appendInt32(-1584933265) + } + break + case .sendMessageTextDraftAction(let _data): + if boxed { + buffer.appendInt32(929929052) + } + serializeInt64(_data.randomId, buffer: buffer, boxed: false) + _data.text.serialize(buffer, true) + break + case .sendMessageTypingAction: + if boxed { + buffer.appendInt32(381645902) + } + break + case .sendMessageUploadAudioAction(let _data): + if boxed { + buffer.appendInt32(-212740181) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .sendMessageUploadDocumentAction(let _data): + if boxed { + buffer.appendInt32(-1441998364) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .sendMessageUploadPhotoAction(let _data): + if boxed { + buffer.appendInt32(-774682074) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .sendMessageUploadRoundAction(let _data): + if boxed { + buffer.appendInt32(608050278) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .sendMessageUploadVideoAction(let _data): + if boxed { + buffer.appendInt32(-378127636) + } + serializeInt32(_data.progress, buffer: buffer, boxed: false) + break + case .speakingInGroupCallAction: + if boxed { + buffer.appendInt32(-651419003) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .sendMessageCancelAction: + return ("sendMessageCancelAction", []) + case .sendMessageChooseContactAction: + return ("sendMessageChooseContactAction", []) + case .sendMessageChooseStickerAction: + return ("sendMessageChooseStickerAction", []) + case .sendMessageEmojiInteraction(let _data): + return ("sendMessageEmojiInteraction", [("emoticon", ConstructorParameterDescription(_data.emoticon)), ("msgId", ConstructorParameterDescription(_data.msgId)), ("interaction", ConstructorParameterDescription(_data.interaction))]) + case .sendMessageEmojiInteractionSeen(let _data): + return ("sendMessageEmojiInteractionSeen", [("emoticon", ConstructorParameterDescription(_data.emoticon))]) + case .sendMessageGamePlayAction: + return ("sendMessageGamePlayAction", []) + case .sendMessageGeoLocationAction: + return ("sendMessageGeoLocationAction", []) + case .sendMessageHistoryImportAction(let _data): + return ("sendMessageHistoryImportAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .sendMessageRecordAudioAction: + return ("sendMessageRecordAudioAction", []) + case .sendMessageRecordRoundAction: + return ("sendMessageRecordRoundAction", []) + case .sendMessageRecordVideoAction: + return ("sendMessageRecordVideoAction", []) + case .sendMessageTextDraftAction(let _data): + return ("sendMessageTextDraftAction", [("randomId", ConstructorParameterDescription(_data.randomId)), ("text", ConstructorParameterDescription(_data.text))]) + case .sendMessageTypingAction: + return ("sendMessageTypingAction", []) + case .sendMessageUploadAudioAction(let _data): + return ("sendMessageUploadAudioAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .sendMessageUploadDocumentAction(let _data): + return ("sendMessageUploadDocumentAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .sendMessageUploadPhotoAction(let _data): + return ("sendMessageUploadPhotoAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .sendMessageUploadRoundAction(let _data): + return ("sendMessageUploadRoundAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .sendMessageUploadVideoAction(let _data): + return ("sendMessageUploadVideoAction", [("progress", ConstructorParameterDescription(_data.progress))]) + case .speakingInGroupCallAction: + return ("speakingInGroupCallAction", []) + } + } + + public static func parse_sendMessageCancelAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageCancelAction + } + public static func parse_sendMessageChooseContactAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageChooseContactAction + } + public static func parse_sendMessageChooseStickerAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageChooseStickerAction + } + public static func parse_sendMessageEmojiInteraction(_ reader: BufferReader) -> SendMessageAction? { + var _1: String? + _1 = parseString(reader) + var _2: Int32? + _2 = reader.readInt32() + var _3: Api.DataJSON? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.DataJSON + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.SendMessageAction.sendMessageEmojiInteraction(Cons_sendMessageEmojiInteraction(emoticon: _1!, msgId: _2!, interaction: _3!)) + } + else { + return nil + } + } + public static func parse_sendMessageEmojiInteractionSeen(_ reader: BufferReader) -> SendMessageAction? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageEmojiInteractionSeen(Cons_sendMessageEmojiInteractionSeen(emoticon: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageGamePlayAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageGamePlayAction + } + public static func parse_sendMessageGeoLocationAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageGeoLocationAction + } + public static func parse_sendMessageHistoryImportAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageHistoryImportAction(Cons_sendMessageHistoryImportAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageRecordAudioAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageRecordAudioAction + } + public static func parse_sendMessageRecordRoundAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageRecordRoundAction + } + public static func parse_sendMessageRecordVideoAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageRecordVideoAction + } + public static func parse_sendMessageTextDraftAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Api.TextWithEntities? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.SendMessageAction.sendMessageTextDraftAction(Cons_sendMessageTextDraftAction(randomId: _1!, text: _2!)) + } + else { + return nil + } + } + public static func parse_sendMessageTypingAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.sendMessageTypingAction + } + public static func parse_sendMessageUploadAudioAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageUploadAudioAction(Cons_sendMessageUploadAudioAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageUploadDocumentAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageUploadDocumentAction(Cons_sendMessageUploadDocumentAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageUploadPhotoAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageUploadPhotoAction(Cons_sendMessageUploadPhotoAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageUploadRoundAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageUploadRoundAction(Cons_sendMessageUploadRoundAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_sendMessageUploadVideoAction(_ reader: BufferReader) -> SendMessageAction? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.SendMessageAction.sendMessageUploadVideoAction(Cons_sendMessageUploadVideoAction(progress: _1!)) + } + else { + return nil + } + } + public static func parse_speakingInGroupCallAction(_ reader: BufferReader) -> SendMessageAction? { + return Api.SendMessageAction.speakingInGroupCallAction + } + } +} public extension Api { enum ShippingOption: TypeConstructorDescription { public class Cons_shippingOption: TypeConstructorDescription { @@ -1200,1022 +1660,3 @@ public extension Api { } } } -public extension Api { - enum StarGiftAttributeCounter: TypeConstructorDescription { - public class Cons_starGiftAttributeCounter: TypeConstructorDescription { - public var attribute: Api.StarGiftAttributeId - public var count: Int32 - public init(attribute: Api.StarGiftAttributeId, count: Int32) { - self.attribute = attribute - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAttributeCounter", [("attribute", ConstructorParameterDescription(self.attribute)), ("count", ConstructorParameterDescription(self.count))]) - } - } - case starGiftAttributeCounter(Cons_starGiftAttributeCounter) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAttributeCounter(let _data): - if boxed { - buffer.appendInt32(783398488) - } - _data.attribute.serialize(buffer, true) - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAttributeCounter(let _data): - return ("starGiftAttributeCounter", [("attribute", ConstructorParameterDescription(_data.attribute)), ("count", ConstructorParameterDescription(_data.count))]) - } - } - - public static func parse_starGiftAttributeCounter(_ reader: BufferReader) -> StarGiftAttributeCounter? { - var _1: Api.StarGiftAttributeId? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.StarGiftAttributeId - } - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StarGiftAttributeCounter.starGiftAttributeCounter(Cons_starGiftAttributeCounter(attribute: _1!, count: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftAttributeId: TypeConstructorDescription { - public class Cons_starGiftAttributeIdBackdrop: TypeConstructorDescription { - public var backdropId: Int32 - public init(backdropId: Int32) { - self.backdropId = backdropId - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAttributeIdBackdrop", [("backdropId", ConstructorParameterDescription(self.backdropId))]) - } - } - public class Cons_starGiftAttributeIdModel: TypeConstructorDescription { - public var documentId: Int64 - public init(documentId: Int64) { - self.documentId = documentId - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAttributeIdModel", [("documentId", ConstructorParameterDescription(self.documentId))]) - } - } - public class Cons_starGiftAttributeIdPattern: TypeConstructorDescription { - public var documentId: Int64 - public init(documentId: Int64) { - self.documentId = documentId - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAttributeIdPattern", [("documentId", ConstructorParameterDescription(self.documentId))]) - } - } - case starGiftAttributeIdBackdrop(Cons_starGiftAttributeIdBackdrop) - case starGiftAttributeIdModel(Cons_starGiftAttributeIdModel) - case starGiftAttributeIdPattern(Cons_starGiftAttributeIdPattern) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAttributeIdBackdrop(let _data): - if boxed { - buffer.appendInt32(520210263) - } - serializeInt32(_data.backdropId, buffer: buffer, boxed: false) - break - case .starGiftAttributeIdModel(let _data): - if boxed { - buffer.appendInt32(1219145276) - } - serializeInt64(_data.documentId, buffer: buffer, boxed: false) - break - case .starGiftAttributeIdPattern(let _data): - if boxed { - buffer.appendInt32(1242965043) - } - serializeInt64(_data.documentId, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAttributeIdBackdrop(let _data): - return ("starGiftAttributeIdBackdrop", [("backdropId", ConstructorParameterDescription(_data.backdropId))]) - case .starGiftAttributeIdModel(let _data): - return ("starGiftAttributeIdModel", [("documentId", ConstructorParameterDescription(_data.documentId))]) - case .starGiftAttributeIdPattern(let _data): - return ("starGiftAttributeIdPattern", [("documentId", ConstructorParameterDescription(_data.documentId))]) - } - } - - public static func parse_starGiftAttributeIdBackdrop(_ reader: BufferReader) -> StarGiftAttributeId? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.StarGiftAttributeId.starGiftAttributeIdBackdrop(Cons_starGiftAttributeIdBackdrop(backdropId: _1!)) - } - else { - return nil - } - } - public static func parse_starGiftAttributeIdModel(_ reader: BufferReader) -> StarGiftAttributeId? { - var _1: Int64? - _1 = reader.readInt64() - let _c1 = _1 != nil - if _c1 { - return Api.StarGiftAttributeId.starGiftAttributeIdModel(Cons_starGiftAttributeIdModel(documentId: _1!)) - } - else { - return nil - } - } - public static func parse_starGiftAttributeIdPattern(_ reader: BufferReader) -> StarGiftAttributeId? { - var _1: Int64? - _1 = reader.readInt64() - let _c1 = _1 != nil - if _c1 { - return Api.StarGiftAttributeId.starGiftAttributeIdPattern(Cons_starGiftAttributeIdPattern(documentId: _1!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftAttributeRarity: TypeConstructorDescription { - public class Cons_starGiftAttributeRarity: TypeConstructorDescription { - public var permille: Int32 - public init(permille: Int32) { - self.permille = permille - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAttributeRarity", [("permille", ConstructorParameterDescription(self.permille))]) - } - } - case starGiftAttributeRarity(Cons_starGiftAttributeRarity) - case starGiftAttributeRarityEpic - case starGiftAttributeRarityLegendary - case starGiftAttributeRarityRare - case starGiftAttributeRarityUncommon - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAttributeRarity(let _data): - if boxed { - buffer.appendInt32(910391095) - } - serializeInt32(_data.permille, buffer: buffer, boxed: false) - break - case .starGiftAttributeRarityEpic: - if boxed { - buffer.appendInt32(2029777832) - } - break - case .starGiftAttributeRarityLegendary: - if boxed { - buffer.appendInt32(-822614104) - } - break - case .starGiftAttributeRarityRare: - if boxed { - buffer.appendInt32(-259174037) - } - break - case .starGiftAttributeRarityUncommon: - if boxed { - buffer.appendInt32(-607231095) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAttributeRarity(let _data): - return ("starGiftAttributeRarity", [("permille", ConstructorParameterDescription(_data.permille))]) - case .starGiftAttributeRarityEpic: - return ("starGiftAttributeRarityEpic", []) - case .starGiftAttributeRarityLegendary: - return ("starGiftAttributeRarityLegendary", []) - case .starGiftAttributeRarityRare: - return ("starGiftAttributeRarityRare", []) - case .starGiftAttributeRarityUncommon: - return ("starGiftAttributeRarityUncommon", []) - } - } - - public static func parse_starGiftAttributeRarity(_ reader: BufferReader) -> StarGiftAttributeRarity? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.StarGiftAttributeRarity.starGiftAttributeRarity(Cons_starGiftAttributeRarity(permille: _1!)) - } - else { - return nil - } - } - public static func parse_starGiftAttributeRarityEpic(_ reader: BufferReader) -> StarGiftAttributeRarity? { - return Api.StarGiftAttributeRarity.starGiftAttributeRarityEpic - } - public static func parse_starGiftAttributeRarityLegendary(_ reader: BufferReader) -> StarGiftAttributeRarity? { - return Api.StarGiftAttributeRarity.starGiftAttributeRarityLegendary - } - public static func parse_starGiftAttributeRarityRare(_ reader: BufferReader) -> StarGiftAttributeRarity? { - return Api.StarGiftAttributeRarity.starGiftAttributeRarityRare - } - public static func parse_starGiftAttributeRarityUncommon(_ reader: BufferReader) -> StarGiftAttributeRarity? { - return Api.StarGiftAttributeRarity.starGiftAttributeRarityUncommon - } - } -} -public extension Api { - enum StarGiftAuctionAcquiredGift: TypeConstructorDescription { - public class Cons_starGiftAuctionAcquiredGift: TypeConstructorDescription { - public var flags: Int32 - public var peer: Api.Peer - public var date: Int32 - public var bidAmount: Int64 - public var round: Int32 - public var pos: Int32 - public var message: Api.TextWithEntities? - public var giftNum: Int32? - public init(flags: Int32, peer: Api.Peer, date: Int32, bidAmount: Int64, round: Int32, pos: Int32, message: Api.TextWithEntities?, giftNum: Int32?) { - self.flags = flags - self.peer = peer - self.date = date - self.bidAmount = bidAmount - self.round = round - self.pos = pos - self.message = message - self.giftNum = giftNum - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionAcquiredGift", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer)), ("date", ConstructorParameterDescription(self.date)), ("bidAmount", ConstructorParameterDescription(self.bidAmount)), ("round", ConstructorParameterDescription(self.round)), ("pos", ConstructorParameterDescription(self.pos)), ("message", ConstructorParameterDescription(self.message)), ("giftNum", ConstructorParameterDescription(self.giftNum))]) - } - } - case starGiftAuctionAcquiredGift(Cons_starGiftAuctionAcquiredGift) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAuctionAcquiredGift(let _data): - if boxed { - buffer.appendInt32(1118831432) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.peer.serialize(buffer, true) - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.bidAmount, buffer: buffer, boxed: false) - serializeInt32(_data.round, buffer: buffer, boxed: false) - serializeInt32(_data.pos, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.message!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt32(_data.giftNum!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAuctionAcquiredGift(let _data): - return ("starGiftAuctionAcquiredGift", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer)), ("date", ConstructorParameterDescription(_data.date)), ("bidAmount", ConstructorParameterDescription(_data.bidAmount)), ("round", ConstructorParameterDescription(_data.round)), ("pos", ConstructorParameterDescription(_data.pos)), ("message", ConstructorParameterDescription(_data.message)), ("giftNum", ConstructorParameterDescription(_data.giftNum))]) - } - } - - public static func parse_starGiftAuctionAcquiredGift(_ reader: BufferReader) -> StarGiftAuctionAcquiredGift? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - var _3: Int32? - _3 = reader.readInt32() - var _4: Int64? - _4 = reader.readInt64() - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() - var _7: Api.TextWithEntities? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _7 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - } - var _8: Int32? - if Int(_1!) & Int(1 << 2) != 0 { - _8 = 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 - let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil - let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { - return Api.StarGiftAuctionAcquiredGift.starGiftAuctionAcquiredGift(Cons_starGiftAuctionAcquiredGift(flags: _1!, peer: _2!, date: _3!, bidAmount: _4!, round: _5!, pos: _6!, message: _7, giftNum: _8)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftAuctionRound: TypeConstructorDescription { - public class Cons_starGiftAuctionRound: TypeConstructorDescription { - public var num: Int32 - public var duration: Int32 - public init(num: Int32, duration: Int32) { - self.num = num - self.duration = duration - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionRound", [("num", ConstructorParameterDescription(self.num)), ("duration", ConstructorParameterDescription(self.duration))]) - } - } - public class Cons_starGiftAuctionRoundExtendable: TypeConstructorDescription { - public var num: Int32 - public var duration: Int32 - public var extendTop: Int32 - public var extendWindow: Int32 - public init(num: Int32, duration: Int32, extendTop: Int32, extendWindow: Int32) { - self.num = num - self.duration = duration - self.extendTop = extendTop - self.extendWindow = extendWindow - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionRoundExtendable", [("num", ConstructorParameterDescription(self.num)), ("duration", ConstructorParameterDescription(self.duration)), ("extendTop", ConstructorParameterDescription(self.extendTop)), ("extendWindow", ConstructorParameterDescription(self.extendWindow))]) - } - } - case starGiftAuctionRound(Cons_starGiftAuctionRound) - case starGiftAuctionRoundExtendable(Cons_starGiftAuctionRoundExtendable) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAuctionRound(let _data): - if boxed { - buffer.appendInt32(984483112) - } - serializeInt32(_data.num, buffer: buffer, boxed: false) - serializeInt32(_data.duration, buffer: buffer, boxed: false) - break - case .starGiftAuctionRoundExtendable(let _data): - if boxed { - buffer.appendInt32(178266597) - } - serializeInt32(_data.num, buffer: buffer, boxed: false) - serializeInt32(_data.duration, buffer: buffer, boxed: false) - serializeInt32(_data.extendTop, buffer: buffer, boxed: false) - serializeInt32(_data.extendWindow, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAuctionRound(let _data): - return ("starGiftAuctionRound", [("num", ConstructorParameterDescription(_data.num)), ("duration", ConstructorParameterDescription(_data.duration))]) - case .starGiftAuctionRoundExtendable(let _data): - return ("starGiftAuctionRoundExtendable", [("num", ConstructorParameterDescription(_data.num)), ("duration", ConstructorParameterDescription(_data.duration)), ("extendTop", ConstructorParameterDescription(_data.extendTop)), ("extendWindow", ConstructorParameterDescription(_data.extendWindow))]) - } - } - - public static func parse_starGiftAuctionRound(_ reader: BufferReader) -> StarGiftAuctionRound? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StarGiftAuctionRound.starGiftAuctionRound(Cons_starGiftAuctionRound(num: _1!, duration: _2!)) - } - else { - return nil - } - } - public static func parse_starGiftAuctionRoundExtendable(_ reader: BufferReader) -> StarGiftAuctionRound? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.StarGiftAuctionRound.starGiftAuctionRoundExtendable(Cons_starGiftAuctionRoundExtendable(num: _1!, duration: _2!, extendTop: _3!, extendWindow: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftAuctionState: TypeConstructorDescription { - public class Cons_starGiftAuctionState: TypeConstructorDescription { - public var version: Int32 - public var startDate: Int32 - public var endDate: Int32 - public var minBidAmount: Int64 - public var bidLevels: [Api.AuctionBidLevel] - public var topBidders: [Int64] - public var nextRoundAt: Int32 - public var lastGiftNum: Int32 - public var giftsLeft: Int32 - public var currentRound: Int32 - public var totalRounds: Int32 - public var rounds: [Api.StarGiftAuctionRound] - public init(version: Int32, startDate: Int32, endDate: Int32, minBidAmount: Int64, bidLevels: [Api.AuctionBidLevel], topBidders: [Int64], nextRoundAt: Int32, lastGiftNum: Int32, giftsLeft: Int32, currentRound: Int32, totalRounds: Int32, rounds: [Api.StarGiftAuctionRound]) { - self.version = version - self.startDate = startDate - self.endDate = endDate - self.minBidAmount = minBidAmount - self.bidLevels = bidLevels - self.topBidders = topBidders - self.nextRoundAt = nextRoundAt - self.lastGiftNum = lastGiftNum - self.giftsLeft = giftsLeft - self.currentRound = currentRound - self.totalRounds = totalRounds - self.rounds = rounds - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionState", [("version", ConstructorParameterDescription(self.version)), ("startDate", ConstructorParameterDescription(self.startDate)), ("endDate", ConstructorParameterDescription(self.endDate)), ("minBidAmount", ConstructorParameterDescription(self.minBidAmount)), ("bidLevels", ConstructorParameterDescription(self.bidLevels)), ("topBidders", ConstructorParameterDescription(self.topBidders)), ("nextRoundAt", ConstructorParameterDescription(self.nextRoundAt)), ("lastGiftNum", ConstructorParameterDescription(self.lastGiftNum)), ("giftsLeft", ConstructorParameterDescription(self.giftsLeft)), ("currentRound", ConstructorParameterDescription(self.currentRound)), ("totalRounds", ConstructorParameterDescription(self.totalRounds)), ("rounds", ConstructorParameterDescription(self.rounds))]) - } - } - public class Cons_starGiftAuctionStateFinished: TypeConstructorDescription { - public var flags: Int32 - public var startDate: Int32 - public var endDate: Int32 - public var averagePrice: Int64 - public var listedCount: Int32? - public var fragmentListedCount: Int32? - public var fragmentListedUrl: String? - public init(flags: Int32, startDate: Int32, endDate: Int32, averagePrice: Int64, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?) { - self.flags = flags - self.startDate = startDate - self.endDate = endDate - self.averagePrice = averagePrice - self.listedCount = listedCount - self.fragmentListedCount = fragmentListedCount - self.fragmentListedUrl = fragmentListedUrl - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionStateFinished", [("flags", ConstructorParameterDescription(self.flags)), ("startDate", ConstructorParameterDescription(self.startDate)), ("endDate", ConstructorParameterDescription(self.endDate)), ("averagePrice", ConstructorParameterDescription(self.averagePrice)), ("listedCount", ConstructorParameterDescription(self.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(self.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(self.fragmentListedUrl))]) - } - } - case starGiftAuctionState(Cons_starGiftAuctionState) - case starGiftAuctionStateFinished(Cons_starGiftAuctionStateFinished) - case starGiftAuctionStateNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAuctionState(let _data): - if boxed { - buffer.appendInt32(1998212710) - } - serializeInt32(_data.version, buffer: buffer, boxed: false) - serializeInt32(_data.startDate, buffer: buffer, boxed: false) - serializeInt32(_data.endDate, buffer: buffer, boxed: false) - serializeInt64(_data.minBidAmount, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.bidLevels.count)) - for item in _data.bidLevels { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.topBidders.count)) - for item in _data.topBidders { - serializeInt64(item, buffer: buffer, boxed: false) - } - serializeInt32(_data.nextRoundAt, buffer: buffer, boxed: false) - serializeInt32(_data.lastGiftNum, buffer: buffer, boxed: false) - serializeInt32(_data.giftsLeft, buffer: buffer, boxed: false) - serializeInt32(_data.currentRound, buffer: buffer, boxed: false) - serializeInt32(_data.totalRounds, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.rounds.count)) - for item in _data.rounds { - item.serialize(buffer, true) - } - break - case .starGiftAuctionStateFinished(let _data): - if boxed { - buffer.appendInt32(-1758614593) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.startDate, buffer: buffer, boxed: false) - serializeInt32(_data.endDate, buffer: buffer, boxed: false) - serializeInt64(_data.averagePrice, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.listedCount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.fragmentListedCount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.fragmentListedUrl!, buffer: buffer, boxed: false) - } - break - case .starGiftAuctionStateNotModified: - if boxed { - buffer.appendInt32(-30197422) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAuctionState(let _data): - return ("starGiftAuctionState", [("version", ConstructorParameterDescription(_data.version)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("minBidAmount", ConstructorParameterDescription(_data.minBidAmount)), ("bidLevels", ConstructorParameterDescription(_data.bidLevels)), ("topBidders", ConstructorParameterDescription(_data.topBidders)), ("nextRoundAt", ConstructorParameterDescription(_data.nextRoundAt)), ("lastGiftNum", ConstructorParameterDescription(_data.lastGiftNum)), ("giftsLeft", ConstructorParameterDescription(_data.giftsLeft)), ("currentRound", ConstructorParameterDescription(_data.currentRound)), ("totalRounds", ConstructorParameterDescription(_data.totalRounds)), ("rounds", ConstructorParameterDescription(_data.rounds))]) - case .starGiftAuctionStateFinished(let _data): - return ("starGiftAuctionStateFinished", [("flags", ConstructorParameterDescription(_data.flags)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("averagePrice", ConstructorParameterDescription(_data.averagePrice)), ("listedCount", ConstructorParameterDescription(_data.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(_data.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(_data.fragmentListedUrl))]) - case .starGiftAuctionStateNotModified: - return ("starGiftAuctionStateNotModified", []) - } - } - - public static func parse_starGiftAuctionState(_ reader: BufferReader) -> StarGiftAuctionState? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int64? - _4 = reader.readInt64() - var _5: [Api.AuctionBidLevel]? - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AuctionBidLevel.self) - } - var _6: [Int64]? - if let _ = reader.readInt32() { - _6 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) - } - var _7: Int32? - _7 = reader.readInt32() - var _8: Int32? - _8 = reader.readInt32() - var _9: Int32? - _9 = reader.readInt32() - var _10: Int32? - _10 = reader.readInt32() - var _11: Int32? - _11 = reader.readInt32() - var _12: [Api.StarGiftAuctionRound]? - if let _ = reader.readInt32() { - _12 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAuctionRound.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - let _c8 = _8 != nil - let _c9 = _9 != nil - let _c10 = _10 != nil - let _c11 = _11 != nil - let _c12 = _12 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { - return Api.StarGiftAuctionState.starGiftAuctionState(Cons_starGiftAuctionState(version: _1!, startDate: _2!, endDate: _3!, minBidAmount: _4!, bidLevels: _5!, topBidders: _6!, nextRoundAt: _7!, lastGiftNum: _8!, giftsLeft: _9!, currentRound: _10!, totalRounds: _11!, rounds: _12!)) - } - else { - return nil - } - } - public static func parse_starGiftAuctionStateFinished(_ reader: BufferReader) -> StarGiftAuctionState? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int64? - _4 = reader.readInt64() - var _5: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _5 = reader.readInt32() - } - var _6: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _6 = reader.readInt32() - } - var _7: String? - if Int(_1!) & Int(1 << 1) != 0 { - _7 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil - let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.StarGiftAuctionState.starGiftAuctionStateFinished(Cons_starGiftAuctionStateFinished(flags: _1!, startDate: _2!, endDate: _3!, averagePrice: _4!, listedCount: _5, fragmentListedCount: _6, fragmentListedUrl: _7)) - } - else { - return nil - } - } - public static func parse_starGiftAuctionStateNotModified(_ reader: BufferReader) -> StarGiftAuctionState? { - return Api.StarGiftAuctionState.starGiftAuctionStateNotModified - } - } -} -public extension Api { - enum StarGiftAuctionUserState: TypeConstructorDescription { - public class Cons_starGiftAuctionUserState: TypeConstructorDescription { - public var flags: Int32 - public var bidAmount: Int64? - public var bidDate: Int32? - public var minBidAmount: Int64? - public var bidPeer: Api.Peer? - public var acquiredCount: Int32 - public init(flags: Int32, bidAmount: Int64?, bidDate: Int32?, minBidAmount: Int64?, bidPeer: Api.Peer?, acquiredCount: Int32) { - self.flags = flags - self.bidAmount = bidAmount - self.bidDate = bidDate - self.minBidAmount = minBidAmount - self.bidPeer = bidPeer - self.acquiredCount = acquiredCount - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftAuctionUserState", [("flags", ConstructorParameterDescription(self.flags)), ("bidAmount", ConstructorParameterDescription(self.bidAmount)), ("bidDate", ConstructorParameterDescription(self.bidDate)), ("minBidAmount", ConstructorParameterDescription(self.minBidAmount)), ("bidPeer", ConstructorParameterDescription(self.bidPeer)), ("acquiredCount", ConstructorParameterDescription(self.acquiredCount))]) - } - } - case starGiftAuctionUserState(Cons_starGiftAuctionUserState) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftAuctionUserState(let _data): - if boxed { - buffer.appendInt32(787403204) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt64(_data.bidAmount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.bidDate!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt64(_data.minBidAmount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.bidPeer!.serialize(buffer, true) - } - serializeInt32(_data.acquiredCount, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftAuctionUserState(let _data): - return ("starGiftAuctionUserState", [("flags", ConstructorParameterDescription(_data.flags)), ("bidAmount", ConstructorParameterDescription(_data.bidAmount)), ("bidDate", ConstructorParameterDescription(_data.bidDate)), ("minBidAmount", ConstructorParameterDescription(_data.minBidAmount)), ("bidPeer", ConstructorParameterDescription(_data.bidPeer)), ("acquiredCount", ConstructorParameterDescription(_data.acquiredCount))]) - } - } - - public static func parse_starGiftAuctionUserState(_ reader: BufferReader) -> StarGiftAuctionUserState? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = reader.readInt64() - } - var _3: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = reader.readInt32() - } - var _4: Int64? - if Int(_1!) & Int(1 << 0) != 0 { - _4 = reader.readInt64() - } - var _5: Api.Peer? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.Peer - } - } - var _6: Int32? - _6 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil - let _c6 = _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.StarGiftAuctionUserState.starGiftAuctionUserState(Cons_starGiftAuctionUserState(flags: _1!, bidAmount: _2, bidDate: _3, minBidAmount: _4, bidPeer: _5, acquiredCount: _6!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftBackground: TypeConstructorDescription { - public class Cons_starGiftBackground: TypeConstructorDescription { - public var centerColor: Int32 - public var edgeColor: Int32 - public var textColor: Int32 - public init(centerColor: Int32, edgeColor: Int32, textColor: Int32) { - self.centerColor = centerColor - self.edgeColor = edgeColor - self.textColor = textColor - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftBackground", [("centerColor", ConstructorParameterDescription(self.centerColor)), ("edgeColor", ConstructorParameterDescription(self.edgeColor)), ("textColor", ConstructorParameterDescription(self.textColor))]) - } - } - case starGiftBackground(Cons_starGiftBackground) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftBackground(let _data): - if boxed { - buffer.appendInt32(-1342872680) - } - serializeInt32(_data.centerColor, buffer: buffer, boxed: false) - serializeInt32(_data.edgeColor, buffer: buffer, boxed: false) - serializeInt32(_data.textColor, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftBackground(let _data): - return ("starGiftBackground", [("centerColor", ConstructorParameterDescription(_data.centerColor)), ("edgeColor", ConstructorParameterDescription(_data.edgeColor)), ("textColor", ConstructorParameterDescription(_data.textColor))]) - } - } - - public static func parse_starGiftBackground(_ reader: BufferReader) -> StarGiftBackground? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.StarGiftBackground.starGiftBackground(Cons_starGiftBackground(centerColor: _1!, edgeColor: _2!, textColor: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftCollection: TypeConstructorDescription { - public class Cons_starGiftCollection: TypeConstructorDescription { - public var flags: Int32 - public var collectionId: Int32 - public var title: String - public var icon: Api.Document? - public var giftsCount: Int32 - public var hash: Int64 - public init(flags: Int32, collectionId: Int32, title: String, icon: Api.Document?, giftsCount: Int32, hash: Int64) { - self.flags = flags - self.collectionId = collectionId - self.title = title - self.icon = icon - self.giftsCount = giftsCount - self.hash = hash - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftCollection", [("flags", ConstructorParameterDescription(self.flags)), ("collectionId", ConstructorParameterDescription(self.collectionId)), ("title", ConstructorParameterDescription(self.title)), ("icon", ConstructorParameterDescription(self.icon)), ("giftsCount", ConstructorParameterDescription(self.giftsCount)), ("hash", ConstructorParameterDescription(self.hash))]) - } - } - case starGiftCollection(Cons_starGiftCollection) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftCollection(let _data): - if boxed { - buffer.appendInt32(-1653926992) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.collectionId, buffer: buffer, boxed: false) - serializeString(_data.title, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.icon!.serialize(buffer, true) - } - serializeInt32(_data.giftsCount, buffer: buffer, boxed: false) - serializeInt64(_data.hash, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftCollection(let _data): - return ("starGiftCollection", [("flags", ConstructorParameterDescription(_data.flags)), ("collectionId", ConstructorParameterDescription(_data.collectionId)), ("title", ConstructorParameterDescription(_data.title)), ("icon", ConstructorParameterDescription(_data.icon)), ("giftsCount", ConstructorParameterDescription(_data.giftsCount)), ("hash", ConstructorParameterDescription(_data.hash))]) - } - } - - public static func parse_starGiftCollection(_ reader: BufferReader) -> StarGiftCollection? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: String? - _3 = parseString(reader) - var _4: Api.Document? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.Document - } - } - var _5: Int32? - _5 = reader.readInt32() - var _6: Int64? - _6 = reader.readInt64() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.StarGiftCollection.starGiftCollection(Cons_starGiftCollection(flags: _1!, collectionId: _2!, title: _3!, icon: _4, giftsCount: _5!, hash: _6!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarGiftUpgradePrice: TypeConstructorDescription { - public class Cons_starGiftUpgradePrice: TypeConstructorDescription { - public var date: Int32 - public var upgradeStars: Int64 - public init(date: Int32, upgradeStars: Int64) { - self.date = date - self.upgradeStars = upgradeStars - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starGiftUpgradePrice", [("date", ConstructorParameterDescription(self.date)), ("upgradeStars", ConstructorParameterDescription(self.upgradeStars))]) - } - } - case starGiftUpgradePrice(Cons_starGiftUpgradePrice) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starGiftUpgradePrice(let _data): - if boxed { - buffer.appendInt32(-1712704739) - } - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt64(_data.upgradeStars, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starGiftUpgradePrice(let _data): - return ("starGiftUpgradePrice", [("date", ConstructorParameterDescription(_data.date)), ("upgradeStars", ConstructorParameterDescription(_data.upgradeStars))]) - } - } - - public static func parse_starGiftUpgradePrice(_ reader: BufferReader) -> StarGiftUpgradePrice? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StarGiftUpgradePrice.starGiftUpgradePrice(Cons_starGiftUpgradePrice(date: _1!, upgradeStars: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StarRefProgram: TypeConstructorDescription { - public class Cons_starRefProgram: TypeConstructorDescription { - public var flags: Int32 - public var botId: Int64 - public var commissionPermille: Int32 - public var durationMonths: Int32? - public var endDate: Int32? - public var dailyRevenuePerUser: Api.StarsAmount? - public init(flags: Int32, botId: Int64, commissionPermille: Int32, durationMonths: Int32?, endDate: Int32?, dailyRevenuePerUser: Api.StarsAmount?) { - self.flags = flags - self.botId = botId - self.commissionPermille = commissionPermille - self.durationMonths = durationMonths - self.endDate = endDate - self.dailyRevenuePerUser = dailyRevenuePerUser - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starRefProgram", [("flags", ConstructorParameterDescription(self.flags)), ("botId", ConstructorParameterDescription(self.botId)), ("commissionPermille", ConstructorParameterDescription(self.commissionPermille)), ("durationMonths", ConstructorParameterDescription(self.durationMonths)), ("endDate", ConstructorParameterDescription(self.endDate)), ("dailyRevenuePerUser", ConstructorParameterDescription(self.dailyRevenuePerUser))]) - } - } - case starRefProgram(Cons_starRefProgram) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starRefProgram(let _data): - if boxed { - buffer.appendInt32(-586389774) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.botId, buffer: buffer, boxed: false) - serializeInt32(_data.commissionPermille, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.durationMonths!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.endDate!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.dailyRevenuePerUser!.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starRefProgram(let _data): - return ("starRefProgram", [("flags", ConstructorParameterDescription(_data.flags)), ("botId", ConstructorParameterDescription(_data.botId)), ("commissionPermille", ConstructorParameterDescription(_data.commissionPermille)), ("durationMonths", ConstructorParameterDescription(_data.durationMonths)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("dailyRevenuePerUser", ConstructorParameterDescription(_data.dailyRevenuePerUser))]) - } - } - - public static func parse_starRefProgram(_ reader: BufferReader) -> StarRefProgram? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _4 = reader.readInt32() - } - var _5: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _5 = reader.readInt32() - } - var _6: Api.StarsAmount? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.StarsAmount - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.StarRefProgram.starRefProgram(Cons_starRefProgram(flags: _1!, botId: _2!, commissionPermille: _3!, durationMonths: _4, endDate: _5, dailyRevenuePerUser: _6)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api26.swift b/submodules/TelegramApi/Sources/Api26.swift index 8bc5c73f45..cf71b7cc11 100644 --- a/submodules/TelegramApi/Sources/Api26.swift +++ b/submodules/TelegramApi/Sources/Api26.swift @@ -1,3 +1,1022 @@ +public extension Api { + enum StarGiftAttributeCounter: TypeConstructorDescription { + public class Cons_starGiftAttributeCounter: TypeConstructorDescription { + public var attribute: Api.StarGiftAttributeId + public var count: Int32 + public init(attribute: Api.StarGiftAttributeId, count: Int32) { + self.attribute = attribute + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAttributeCounter", [("attribute", ConstructorParameterDescription(self.attribute)), ("count", ConstructorParameterDescription(self.count))]) + } + } + case starGiftAttributeCounter(Cons_starGiftAttributeCounter) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAttributeCounter(let _data): + if boxed { + buffer.appendInt32(783398488) + } + _data.attribute.serialize(buffer, true) + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAttributeCounter(let _data): + return ("starGiftAttributeCounter", [("attribute", ConstructorParameterDescription(_data.attribute)), ("count", ConstructorParameterDescription(_data.count))]) + } + } + + public static func parse_starGiftAttributeCounter(_ reader: BufferReader) -> StarGiftAttributeCounter? { + var _1: Api.StarGiftAttributeId? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.StarGiftAttributeId + } + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StarGiftAttributeCounter.starGiftAttributeCounter(Cons_starGiftAttributeCounter(attribute: _1!, count: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftAttributeId: TypeConstructorDescription { + public class Cons_starGiftAttributeIdBackdrop: TypeConstructorDescription { + public var backdropId: Int32 + public init(backdropId: Int32) { + self.backdropId = backdropId + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAttributeIdBackdrop", [("backdropId", ConstructorParameterDescription(self.backdropId))]) + } + } + public class Cons_starGiftAttributeIdModel: TypeConstructorDescription { + public var documentId: Int64 + public init(documentId: Int64) { + self.documentId = documentId + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAttributeIdModel", [("documentId", ConstructorParameterDescription(self.documentId))]) + } + } + public class Cons_starGiftAttributeIdPattern: TypeConstructorDescription { + public var documentId: Int64 + public init(documentId: Int64) { + self.documentId = documentId + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAttributeIdPattern", [("documentId", ConstructorParameterDescription(self.documentId))]) + } + } + case starGiftAttributeIdBackdrop(Cons_starGiftAttributeIdBackdrop) + case starGiftAttributeIdModel(Cons_starGiftAttributeIdModel) + case starGiftAttributeIdPattern(Cons_starGiftAttributeIdPattern) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAttributeIdBackdrop(let _data): + if boxed { + buffer.appendInt32(520210263) + } + serializeInt32(_data.backdropId, buffer: buffer, boxed: false) + break + case .starGiftAttributeIdModel(let _data): + if boxed { + buffer.appendInt32(1219145276) + } + serializeInt64(_data.documentId, buffer: buffer, boxed: false) + break + case .starGiftAttributeIdPattern(let _data): + if boxed { + buffer.appendInt32(1242965043) + } + serializeInt64(_data.documentId, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAttributeIdBackdrop(let _data): + return ("starGiftAttributeIdBackdrop", [("backdropId", ConstructorParameterDescription(_data.backdropId))]) + case .starGiftAttributeIdModel(let _data): + return ("starGiftAttributeIdModel", [("documentId", ConstructorParameterDescription(_data.documentId))]) + case .starGiftAttributeIdPattern(let _data): + return ("starGiftAttributeIdPattern", [("documentId", ConstructorParameterDescription(_data.documentId))]) + } + } + + public static func parse_starGiftAttributeIdBackdrop(_ reader: BufferReader) -> StarGiftAttributeId? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.StarGiftAttributeId.starGiftAttributeIdBackdrop(Cons_starGiftAttributeIdBackdrop(backdropId: _1!)) + } + else { + return nil + } + } + public static func parse_starGiftAttributeIdModel(_ reader: BufferReader) -> StarGiftAttributeId? { + var _1: Int64? + _1 = reader.readInt64() + let _c1 = _1 != nil + if _c1 { + return Api.StarGiftAttributeId.starGiftAttributeIdModel(Cons_starGiftAttributeIdModel(documentId: _1!)) + } + else { + return nil + } + } + public static func parse_starGiftAttributeIdPattern(_ reader: BufferReader) -> StarGiftAttributeId? { + var _1: Int64? + _1 = reader.readInt64() + let _c1 = _1 != nil + if _c1 { + return Api.StarGiftAttributeId.starGiftAttributeIdPattern(Cons_starGiftAttributeIdPattern(documentId: _1!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftAttributeRarity: TypeConstructorDescription { + public class Cons_starGiftAttributeRarity: TypeConstructorDescription { + public var permille: Int32 + public init(permille: Int32) { + self.permille = permille + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAttributeRarity", [("permille", ConstructorParameterDescription(self.permille))]) + } + } + case starGiftAttributeRarity(Cons_starGiftAttributeRarity) + case starGiftAttributeRarityEpic + case starGiftAttributeRarityLegendary + case starGiftAttributeRarityRare + case starGiftAttributeRarityUncommon + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAttributeRarity(let _data): + if boxed { + buffer.appendInt32(910391095) + } + serializeInt32(_data.permille, buffer: buffer, boxed: false) + break + case .starGiftAttributeRarityEpic: + if boxed { + buffer.appendInt32(2029777832) + } + break + case .starGiftAttributeRarityLegendary: + if boxed { + buffer.appendInt32(-822614104) + } + break + case .starGiftAttributeRarityRare: + if boxed { + buffer.appendInt32(-259174037) + } + break + case .starGiftAttributeRarityUncommon: + if boxed { + buffer.appendInt32(-607231095) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAttributeRarity(let _data): + return ("starGiftAttributeRarity", [("permille", ConstructorParameterDescription(_data.permille))]) + case .starGiftAttributeRarityEpic: + return ("starGiftAttributeRarityEpic", []) + case .starGiftAttributeRarityLegendary: + return ("starGiftAttributeRarityLegendary", []) + case .starGiftAttributeRarityRare: + return ("starGiftAttributeRarityRare", []) + case .starGiftAttributeRarityUncommon: + return ("starGiftAttributeRarityUncommon", []) + } + } + + public static func parse_starGiftAttributeRarity(_ reader: BufferReader) -> StarGiftAttributeRarity? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.StarGiftAttributeRarity.starGiftAttributeRarity(Cons_starGiftAttributeRarity(permille: _1!)) + } + else { + return nil + } + } + public static func parse_starGiftAttributeRarityEpic(_ reader: BufferReader) -> StarGiftAttributeRarity? { + return Api.StarGiftAttributeRarity.starGiftAttributeRarityEpic + } + public static func parse_starGiftAttributeRarityLegendary(_ reader: BufferReader) -> StarGiftAttributeRarity? { + return Api.StarGiftAttributeRarity.starGiftAttributeRarityLegendary + } + public static func parse_starGiftAttributeRarityRare(_ reader: BufferReader) -> StarGiftAttributeRarity? { + return Api.StarGiftAttributeRarity.starGiftAttributeRarityRare + } + public static func parse_starGiftAttributeRarityUncommon(_ reader: BufferReader) -> StarGiftAttributeRarity? { + return Api.StarGiftAttributeRarity.starGiftAttributeRarityUncommon + } + } +} +public extension Api { + enum StarGiftAuctionAcquiredGift: TypeConstructorDescription { + public class Cons_starGiftAuctionAcquiredGift: TypeConstructorDescription { + public var flags: Int32 + public var peer: Api.Peer + public var date: Int32 + public var bidAmount: Int64 + public var round: Int32 + public var pos: Int32 + public var message: Api.TextWithEntities? + public var giftNum: Int32? + public init(flags: Int32, peer: Api.Peer, date: Int32, bidAmount: Int64, round: Int32, pos: Int32, message: Api.TextWithEntities?, giftNum: Int32?) { + self.flags = flags + self.peer = peer + self.date = date + self.bidAmount = bidAmount + self.round = round + self.pos = pos + self.message = message + self.giftNum = giftNum + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionAcquiredGift", [("flags", ConstructorParameterDescription(self.flags)), ("peer", ConstructorParameterDescription(self.peer)), ("date", ConstructorParameterDescription(self.date)), ("bidAmount", ConstructorParameterDescription(self.bidAmount)), ("round", ConstructorParameterDescription(self.round)), ("pos", ConstructorParameterDescription(self.pos)), ("message", ConstructorParameterDescription(self.message)), ("giftNum", ConstructorParameterDescription(self.giftNum))]) + } + } + case starGiftAuctionAcquiredGift(Cons_starGiftAuctionAcquiredGift) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAuctionAcquiredGift(let _data): + if boxed { + buffer.appendInt32(1118831432) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.peer.serialize(buffer, true) + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.bidAmount, buffer: buffer, boxed: false) + serializeInt32(_data.round, buffer: buffer, boxed: false) + serializeInt32(_data.pos, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.message!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt32(_data.giftNum!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAuctionAcquiredGift(let _data): + return ("starGiftAuctionAcquiredGift", [("flags", ConstructorParameterDescription(_data.flags)), ("peer", ConstructorParameterDescription(_data.peer)), ("date", ConstructorParameterDescription(_data.date)), ("bidAmount", ConstructorParameterDescription(_data.bidAmount)), ("round", ConstructorParameterDescription(_data.round)), ("pos", ConstructorParameterDescription(_data.pos)), ("message", ConstructorParameterDescription(_data.message)), ("giftNum", ConstructorParameterDescription(_data.giftNum))]) + } + } + + public static func parse_starGiftAuctionAcquiredGift(_ reader: BufferReader) -> StarGiftAuctionAcquiredGift? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Peer? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _3: Int32? + _3 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int32? + _5 = reader.readInt32() + var _6: Int32? + _6 = reader.readInt32() + var _7: Api.TextWithEntities? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _7 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + } + var _8: Int32? + if Int(_1!) & Int(1 << 2) != 0 { + _8 = 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 + let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil + let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.StarGiftAuctionAcquiredGift.starGiftAuctionAcquiredGift(Cons_starGiftAuctionAcquiredGift(flags: _1!, peer: _2!, date: _3!, bidAmount: _4!, round: _5!, pos: _6!, message: _7, giftNum: _8)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftAuctionRound: TypeConstructorDescription { + public class Cons_starGiftAuctionRound: TypeConstructorDescription { + public var num: Int32 + public var duration: Int32 + public init(num: Int32, duration: Int32) { + self.num = num + self.duration = duration + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionRound", [("num", ConstructorParameterDescription(self.num)), ("duration", ConstructorParameterDescription(self.duration))]) + } + } + public class Cons_starGiftAuctionRoundExtendable: TypeConstructorDescription { + public var num: Int32 + public var duration: Int32 + public var extendTop: Int32 + public var extendWindow: Int32 + public init(num: Int32, duration: Int32, extendTop: Int32, extendWindow: Int32) { + self.num = num + self.duration = duration + self.extendTop = extendTop + self.extendWindow = extendWindow + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionRoundExtendable", [("num", ConstructorParameterDescription(self.num)), ("duration", ConstructorParameterDescription(self.duration)), ("extendTop", ConstructorParameterDescription(self.extendTop)), ("extendWindow", ConstructorParameterDescription(self.extendWindow))]) + } + } + case starGiftAuctionRound(Cons_starGiftAuctionRound) + case starGiftAuctionRoundExtendable(Cons_starGiftAuctionRoundExtendable) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAuctionRound(let _data): + if boxed { + buffer.appendInt32(984483112) + } + serializeInt32(_data.num, buffer: buffer, boxed: false) + serializeInt32(_data.duration, buffer: buffer, boxed: false) + break + case .starGiftAuctionRoundExtendable(let _data): + if boxed { + buffer.appendInt32(178266597) + } + serializeInt32(_data.num, buffer: buffer, boxed: false) + serializeInt32(_data.duration, buffer: buffer, boxed: false) + serializeInt32(_data.extendTop, buffer: buffer, boxed: false) + serializeInt32(_data.extendWindow, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAuctionRound(let _data): + return ("starGiftAuctionRound", [("num", ConstructorParameterDescription(_data.num)), ("duration", ConstructorParameterDescription(_data.duration))]) + case .starGiftAuctionRoundExtendable(let _data): + return ("starGiftAuctionRoundExtendable", [("num", ConstructorParameterDescription(_data.num)), ("duration", ConstructorParameterDescription(_data.duration)), ("extendTop", ConstructorParameterDescription(_data.extendTop)), ("extendWindow", ConstructorParameterDescription(_data.extendWindow))]) + } + } + + public static func parse_starGiftAuctionRound(_ reader: BufferReader) -> StarGiftAuctionRound? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StarGiftAuctionRound.starGiftAuctionRound(Cons_starGiftAuctionRound(num: _1!, duration: _2!)) + } + else { + return nil + } + } + public static func parse_starGiftAuctionRoundExtendable(_ reader: BufferReader) -> StarGiftAuctionRound? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.StarGiftAuctionRound.starGiftAuctionRoundExtendable(Cons_starGiftAuctionRoundExtendable(num: _1!, duration: _2!, extendTop: _3!, extendWindow: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftAuctionState: TypeConstructorDescription { + public class Cons_starGiftAuctionState: TypeConstructorDescription { + public var version: Int32 + public var startDate: Int32 + public var endDate: Int32 + public var minBidAmount: Int64 + public var bidLevels: [Api.AuctionBidLevel] + public var topBidders: [Int64] + public var nextRoundAt: Int32 + public var lastGiftNum: Int32 + public var giftsLeft: Int32 + public var currentRound: Int32 + public var totalRounds: Int32 + public var rounds: [Api.StarGiftAuctionRound] + public init(version: Int32, startDate: Int32, endDate: Int32, minBidAmount: Int64, bidLevels: [Api.AuctionBidLevel], topBidders: [Int64], nextRoundAt: Int32, lastGiftNum: Int32, giftsLeft: Int32, currentRound: Int32, totalRounds: Int32, rounds: [Api.StarGiftAuctionRound]) { + self.version = version + self.startDate = startDate + self.endDate = endDate + self.minBidAmount = minBidAmount + self.bidLevels = bidLevels + self.topBidders = topBidders + self.nextRoundAt = nextRoundAt + self.lastGiftNum = lastGiftNum + self.giftsLeft = giftsLeft + self.currentRound = currentRound + self.totalRounds = totalRounds + self.rounds = rounds + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionState", [("version", ConstructorParameterDescription(self.version)), ("startDate", ConstructorParameterDescription(self.startDate)), ("endDate", ConstructorParameterDescription(self.endDate)), ("minBidAmount", ConstructorParameterDescription(self.minBidAmount)), ("bidLevels", ConstructorParameterDescription(self.bidLevels)), ("topBidders", ConstructorParameterDescription(self.topBidders)), ("nextRoundAt", ConstructorParameterDescription(self.nextRoundAt)), ("lastGiftNum", ConstructorParameterDescription(self.lastGiftNum)), ("giftsLeft", ConstructorParameterDescription(self.giftsLeft)), ("currentRound", ConstructorParameterDescription(self.currentRound)), ("totalRounds", ConstructorParameterDescription(self.totalRounds)), ("rounds", ConstructorParameterDescription(self.rounds))]) + } + } + public class Cons_starGiftAuctionStateFinished: TypeConstructorDescription { + public var flags: Int32 + public var startDate: Int32 + public var endDate: Int32 + public var averagePrice: Int64 + public var listedCount: Int32? + public var fragmentListedCount: Int32? + public var fragmentListedUrl: String? + public init(flags: Int32, startDate: Int32, endDate: Int32, averagePrice: Int64, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?) { + self.flags = flags + self.startDate = startDate + self.endDate = endDate + self.averagePrice = averagePrice + self.listedCount = listedCount + self.fragmentListedCount = fragmentListedCount + self.fragmentListedUrl = fragmentListedUrl + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionStateFinished", [("flags", ConstructorParameterDescription(self.flags)), ("startDate", ConstructorParameterDescription(self.startDate)), ("endDate", ConstructorParameterDescription(self.endDate)), ("averagePrice", ConstructorParameterDescription(self.averagePrice)), ("listedCount", ConstructorParameterDescription(self.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(self.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(self.fragmentListedUrl))]) + } + } + case starGiftAuctionState(Cons_starGiftAuctionState) + case starGiftAuctionStateFinished(Cons_starGiftAuctionStateFinished) + case starGiftAuctionStateNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAuctionState(let _data): + if boxed { + buffer.appendInt32(1998212710) + } + serializeInt32(_data.version, buffer: buffer, boxed: false) + serializeInt32(_data.startDate, buffer: buffer, boxed: false) + serializeInt32(_data.endDate, buffer: buffer, boxed: false) + serializeInt64(_data.minBidAmount, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.bidLevels.count)) + for item in _data.bidLevels { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.topBidders.count)) + for item in _data.topBidders { + serializeInt64(item, buffer: buffer, boxed: false) + } + serializeInt32(_data.nextRoundAt, buffer: buffer, boxed: false) + serializeInt32(_data.lastGiftNum, buffer: buffer, boxed: false) + serializeInt32(_data.giftsLeft, buffer: buffer, boxed: false) + serializeInt32(_data.currentRound, buffer: buffer, boxed: false) + serializeInt32(_data.totalRounds, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.rounds.count)) + for item in _data.rounds { + item.serialize(buffer, true) + } + break + case .starGiftAuctionStateFinished(let _data): + if boxed { + buffer.appendInt32(-1758614593) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.startDate, buffer: buffer, boxed: false) + serializeInt32(_data.endDate, buffer: buffer, boxed: false) + serializeInt64(_data.averagePrice, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.listedCount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.fragmentListedCount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.fragmentListedUrl!, buffer: buffer, boxed: false) + } + break + case .starGiftAuctionStateNotModified: + if boxed { + buffer.appendInt32(-30197422) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAuctionState(let _data): + return ("starGiftAuctionState", [("version", ConstructorParameterDescription(_data.version)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("minBidAmount", ConstructorParameterDescription(_data.minBidAmount)), ("bidLevels", ConstructorParameterDescription(_data.bidLevels)), ("topBidders", ConstructorParameterDescription(_data.topBidders)), ("nextRoundAt", ConstructorParameterDescription(_data.nextRoundAt)), ("lastGiftNum", ConstructorParameterDescription(_data.lastGiftNum)), ("giftsLeft", ConstructorParameterDescription(_data.giftsLeft)), ("currentRound", ConstructorParameterDescription(_data.currentRound)), ("totalRounds", ConstructorParameterDescription(_data.totalRounds)), ("rounds", ConstructorParameterDescription(_data.rounds))]) + case .starGiftAuctionStateFinished(let _data): + return ("starGiftAuctionStateFinished", [("flags", ConstructorParameterDescription(_data.flags)), ("startDate", ConstructorParameterDescription(_data.startDate)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("averagePrice", ConstructorParameterDescription(_data.averagePrice)), ("listedCount", ConstructorParameterDescription(_data.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(_data.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(_data.fragmentListedUrl))]) + case .starGiftAuctionStateNotModified: + return ("starGiftAuctionStateNotModified", []) + } + } + + public static func parse_starGiftAuctionState(_ reader: BufferReader) -> StarGiftAuctionState? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: [Api.AuctionBidLevel]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AuctionBidLevel.self) + } + var _6: [Int64]? + if let _ = reader.readInt32() { + _6 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + var _7: Int32? + _7 = reader.readInt32() + var _8: Int32? + _8 = reader.readInt32() + var _9: Int32? + _9 = reader.readInt32() + var _10: Int32? + _10 = reader.readInt32() + var _11: Int32? + _11 = reader.readInt32() + var _12: [Api.StarGiftAuctionRound]? + if let _ = reader.readInt32() { + _12 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarGiftAuctionRound.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + let _c9 = _9 != nil + let _c10 = _10 != nil + let _c11 = _11 != nil + let _c12 = _12 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { + return Api.StarGiftAuctionState.starGiftAuctionState(Cons_starGiftAuctionState(version: _1!, startDate: _2!, endDate: _3!, minBidAmount: _4!, bidLevels: _5!, topBidders: _6!, nextRoundAt: _7!, lastGiftNum: _8!, giftsLeft: _9!, currentRound: _10!, totalRounds: _11!, rounds: _12!)) + } + else { + return nil + } + } + public static func parse_starGiftAuctionStateFinished(_ reader: BufferReader) -> StarGiftAuctionState? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int64? + _4 = reader.readInt64() + var _5: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _5 = reader.readInt32() + } + var _6: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _6 = reader.readInt32() + } + var _7: String? + if Int(_1!) & Int(1 << 1) != 0 { + _7 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil + let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { + return Api.StarGiftAuctionState.starGiftAuctionStateFinished(Cons_starGiftAuctionStateFinished(flags: _1!, startDate: _2!, endDate: _3!, averagePrice: _4!, listedCount: _5, fragmentListedCount: _6, fragmentListedUrl: _7)) + } + else { + return nil + } + } + public static func parse_starGiftAuctionStateNotModified(_ reader: BufferReader) -> StarGiftAuctionState? { + return Api.StarGiftAuctionState.starGiftAuctionStateNotModified + } + } +} +public extension Api { + enum StarGiftAuctionUserState: TypeConstructorDescription { + public class Cons_starGiftAuctionUserState: TypeConstructorDescription { + public var flags: Int32 + public var bidAmount: Int64? + public var bidDate: Int32? + public var minBidAmount: Int64? + public var bidPeer: Api.Peer? + public var acquiredCount: Int32 + public init(flags: Int32, bidAmount: Int64?, bidDate: Int32?, minBidAmount: Int64?, bidPeer: Api.Peer?, acquiredCount: Int32) { + self.flags = flags + self.bidAmount = bidAmount + self.bidDate = bidDate + self.minBidAmount = minBidAmount + self.bidPeer = bidPeer + self.acquiredCount = acquiredCount + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftAuctionUserState", [("flags", ConstructorParameterDescription(self.flags)), ("bidAmount", ConstructorParameterDescription(self.bidAmount)), ("bidDate", ConstructorParameterDescription(self.bidDate)), ("minBidAmount", ConstructorParameterDescription(self.minBidAmount)), ("bidPeer", ConstructorParameterDescription(self.bidPeer)), ("acquiredCount", ConstructorParameterDescription(self.acquiredCount))]) + } + } + case starGiftAuctionUserState(Cons_starGiftAuctionUserState) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftAuctionUserState(let _data): + if boxed { + buffer.appendInt32(787403204) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt64(_data.bidAmount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.bidDate!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt64(_data.minBidAmount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.bidPeer!.serialize(buffer, true) + } + serializeInt32(_data.acquiredCount, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftAuctionUserState(let _data): + return ("starGiftAuctionUserState", [("flags", ConstructorParameterDescription(_data.flags)), ("bidAmount", ConstructorParameterDescription(_data.bidAmount)), ("bidDate", ConstructorParameterDescription(_data.bidDate)), ("minBidAmount", ConstructorParameterDescription(_data.minBidAmount)), ("bidPeer", ConstructorParameterDescription(_data.bidPeer)), ("acquiredCount", ConstructorParameterDescription(_data.acquiredCount))]) + } + } + + public static func parse_starGiftAuctionUserState(_ reader: BufferReader) -> StarGiftAuctionUserState? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = reader.readInt64() + } + var _3: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = reader.readInt32() + } + var _4: Int64? + if Int(_1!) & Int(1 << 0) != 0 { + _4 = reader.readInt64() + } + var _5: Api.Peer? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.Peer + } + } + var _6: Int32? + _6 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + let _c6 = _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.StarGiftAuctionUserState.starGiftAuctionUserState(Cons_starGiftAuctionUserState(flags: _1!, bidAmount: _2, bidDate: _3, minBidAmount: _4, bidPeer: _5, acquiredCount: _6!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftBackground: TypeConstructorDescription { + public class Cons_starGiftBackground: TypeConstructorDescription { + public var centerColor: Int32 + public var edgeColor: Int32 + public var textColor: Int32 + public init(centerColor: Int32, edgeColor: Int32, textColor: Int32) { + self.centerColor = centerColor + self.edgeColor = edgeColor + self.textColor = textColor + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftBackground", [("centerColor", ConstructorParameterDescription(self.centerColor)), ("edgeColor", ConstructorParameterDescription(self.edgeColor)), ("textColor", ConstructorParameterDescription(self.textColor))]) + } + } + case starGiftBackground(Cons_starGiftBackground) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftBackground(let _data): + if boxed { + buffer.appendInt32(-1342872680) + } + serializeInt32(_data.centerColor, buffer: buffer, boxed: false) + serializeInt32(_data.edgeColor, buffer: buffer, boxed: false) + serializeInt32(_data.textColor, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftBackground(let _data): + return ("starGiftBackground", [("centerColor", ConstructorParameterDescription(_data.centerColor)), ("edgeColor", ConstructorParameterDescription(_data.edgeColor)), ("textColor", ConstructorParameterDescription(_data.textColor))]) + } + } + + public static func parse_starGiftBackground(_ reader: BufferReader) -> StarGiftBackground? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.StarGiftBackground.starGiftBackground(Cons_starGiftBackground(centerColor: _1!, edgeColor: _2!, textColor: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftCollection: TypeConstructorDescription { + public class Cons_starGiftCollection: TypeConstructorDescription { + public var flags: Int32 + public var collectionId: Int32 + public var title: String + public var icon: Api.Document? + public var giftsCount: Int32 + public var hash: Int64 + public init(flags: Int32, collectionId: Int32, title: String, icon: Api.Document?, giftsCount: Int32, hash: Int64) { + self.flags = flags + self.collectionId = collectionId + self.title = title + self.icon = icon + self.giftsCount = giftsCount + self.hash = hash + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftCollection", [("flags", ConstructorParameterDescription(self.flags)), ("collectionId", ConstructorParameterDescription(self.collectionId)), ("title", ConstructorParameterDescription(self.title)), ("icon", ConstructorParameterDescription(self.icon)), ("giftsCount", ConstructorParameterDescription(self.giftsCount)), ("hash", ConstructorParameterDescription(self.hash))]) + } + } + case starGiftCollection(Cons_starGiftCollection) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftCollection(let _data): + if boxed { + buffer.appendInt32(-1653926992) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.collectionId, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.icon!.serialize(buffer, true) + } + serializeInt32(_data.giftsCount, buffer: buffer, boxed: false) + serializeInt64(_data.hash, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftCollection(let _data): + return ("starGiftCollection", [("flags", ConstructorParameterDescription(_data.flags)), ("collectionId", ConstructorParameterDescription(_data.collectionId)), ("title", ConstructorParameterDescription(_data.title)), ("icon", ConstructorParameterDescription(_data.icon)), ("giftsCount", ConstructorParameterDescription(_data.giftsCount)), ("hash", ConstructorParameterDescription(_data.hash))]) + } + } + + public static func parse_starGiftCollection(_ reader: BufferReader) -> StarGiftCollection? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: String? + _3 = parseString(reader) + var _4: Api.Document? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.Document + } + } + var _5: Int32? + _5 = reader.readInt32() + var _6: Int64? + _6 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.StarGiftCollection.starGiftCollection(Cons_starGiftCollection(flags: _1!, collectionId: _2!, title: _3!, icon: _4, giftsCount: _5!, hash: _6!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarGiftUpgradePrice: TypeConstructorDescription { + public class Cons_starGiftUpgradePrice: TypeConstructorDescription { + public var date: Int32 + public var upgradeStars: Int64 + public init(date: Int32, upgradeStars: Int64) { + self.date = date + self.upgradeStars = upgradeStars + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starGiftUpgradePrice", [("date", ConstructorParameterDescription(self.date)), ("upgradeStars", ConstructorParameterDescription(self.upgradeStars))]) + } + } + case starGiftUpgradePrice(Cons_starGiftUpgradePrice) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starGiftUpgradePrice(let _data): + if boxed { + buffer.appendInt32(-1712704739) + } + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt64(_data.upgradeStars, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starGiftUpgradePrice(let _data): + return ("starGiftUpgradePrice", [("date", ConstructorParameterDescription(_data.date)), ("upgradeStars", ConstructorParameterDescription(_data.upgradeStars))]) + } + } + + public static func parse_starGiftUpgradePrice(_ reader: BufferReader) -> StarGiftUpgradePrice? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StarGiftUpgradePrice.starGiftUpgradePrice(Cons_starGiftUpgradePrice(date: _1!, upgradeStars: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StarRefProgram: TypeConstructorDescription { + public class Cons_starRefProgram: TypeConstructorDescription { + public var flags: Int32 + public var botId: Int64 + public var commissionPermille: Int32 + public var durationMonths: Int32? + public var endDate: Int32? + public var dailyRevenuePerUser: Api.StarsAmount? + public init(flags: Int32, botId: Int64, commissionPermille: Int32, durationMonths: Int32?, endDate: Int32?, dailyRevenuePerUser: Api.StarsAmount?) { + self.flags = flags + self.botId = botId + self.commissionPermille = commissionPermille + self.durationMonths = durationMonths + self.endDate = endDate + self.dailyRevenuePerUser = dailyRevenuePerUser + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starRefProgram", [("flags", ConstructorParameterDescription(self.flags)), ("botId", ConstructorParameterDescription(self.botId)), ("commissionPermille", ConstructorParameterDescription(self.commissionPermille)), ("durationMonths", ConstructorParameterDescription(self.durationMonths)), ("endDate", ConstructorParameterDescription(self.endDate)), ("dailyRevenuePerUser", ConstructorParameterDescription(self.dailyRevenuePerUser))]) + } + } + case starRefProgram(Cons_starRefProgram) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starRefProgram(let _data): + if boxed { + buffer.appendInt32(-586389774) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.botId, buffer: buffer, boxed: false) + serializeInt32(_data.commissionPermille, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.durationMonths!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.endDate!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.dailyRevenuePerUser!.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starRefProgram(let _data): + return ("starRefProgram", [("flags", ConstructorParameterDescription(_data.flags)), ("botId", ConstructorParameterDescription(_data.botId)), ("commissionPermille", ConstructorParameterDescription(_data.commissionPermille)), ("durationMonths", ConstructorParameterDescription(_data.durationMonths)), ("endDate", ConstructorParameterDescription(_data.endDate)), ("dailyRevenuePerUser", ConstructorParameterDescription(_data.dailyRevenuePerUser))]) + } + } + + public static func parse_starRefProgram(_ reader: BufferReader) -> StarRefProgram? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _4 = reader.readInt32() + } + var _5: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _5 = reader.readInt32() + } + var _6: Api.StarsAmount? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.StarsAmount + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.StarRefProgram.starRefProgram(Cons_starRefProgram(flags: _1!, botId: _2!, commissionPermille: _3!, durationMonths: _4, endDate: _5, dailyRevenuePerUser: _6)) + } + else { + return nil + } + } + } +} public extension Api { enum StarsAmount: TypeConstructorDescription { public class Cons_starsAmount: TypeConstructorDescription { @@ -1080,733 +2099,3 @@ public extension Api { } } } -public extension Api { - enum StatsAbsValueAndPrev: TypeConstructorDescription { - public class Cons_statsAbsValueAndPrev: TypeConstructorDescription { - public var current: Double - public var previous: Double - public init(current: Double, previous: Double) { - self.current = current - self.previous = previous - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsAbsValueAndPrev", [("current", ConstructorParameterDescription(self.current)), ("previous", ConstructorParameterDescription(self.previous))]) - } - } - case statsAbsValueAndPrev(Cons_statsAbsValueAndPrev) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsAbsValueAndPrev(let _data): - if boxed { - buffer.appendInt32(-884757282) - } - serializeDouble(_data.current, buffer: buffer, boxed: false) - serializeDouble(_data.previous, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsAbsValueAndPrev(let _data): - return ("statsAbsValueAndPrev", [("current", ConstructorParameterDescription(_data.current)), ("previous", ConstructorParameterDescription(_data.previous))]) - } - } - - public static func parse_statsAbsValueAndPrev(_ reader: BufferReader) -> StatsAbsValueAndPrev? { - var _1: Double? - _1 = reader.readDouble() - var _2: Double? - _2 = reader.readDouble() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StatsAbsValueAndPrev.statsAbsValueAndPrev(Cons_statsAbsValueAndPrev(current: _1!, previous: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsDateRangeDays: TypeConstructorDescription { - public class Cons_statsDateRangeDays: TypeConstructorDescription { - public var minDate: Int32 - public var maxDate: Int32 - public init(minDate: Int32, maxDate: Int32) { - self.minDate = minDate - self.maxDate = maxDate - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsDateRangeDays", [("minDate", ConstructorParameterDescription(self.minDate)), ("maxDate", ConstructorParameterDescription(self.maxDate))]) - } - } - case statsDateRangeDays(Cons_statsDateRangeDays) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsDateRangeDays(let _data): - if boxed { - buffer.appendInt32(-1237848657) - } - serializeInt32(_data.minDate, buffer: buffer, boxed: false) - serializeInt32(_data.maxDate, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsDateRangeDays(let _data): - return ("statsDateRangeDays", [("minDate", ConstructorParameterDescription(_data.minDate)), ("maxDate", ConstructorParameterDescription(_data.maxDate))]) - } - } - - public static func parse_statsDateRangeDays(_ reader: BufferReader) -> StatsDateRangeDays? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StatsDateRangeDays.statsDateRangeDays(Cons_statsDateRangeDays(minDate: _1!, maxDate: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsGraph: TypeConstructorDescription { - public class Cons_statsGraph: TypeConstructorDescription { - public var flags: Int32 - public var json: Api.DataJSON - public var zoomToken: String? - public init(flags: Int32, json: Api.DataJSON, zoomToken: String?) { - self.flags = flags - self.json = json - self.zoomToken = zoomToken - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGraph", [("flags", ConstructorParameterDescription(self.flags)), ("json", ConstructorParameterDescription(self.json)), ("zoomToken", ConstructorParameterDescription(self.zoomToken))]) - } - } - public class Cons_statsGraphAsync: TypeConstructorDescription { - public var token: String - public init(token: String) { - self.token = token - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGraphAsync", [("token", ConstructorParameterDescription(self.token))]) - } - } - public class Cons_statsGraphError: TypeConstructorDescription { - public var error: String - public init(error: String) { - self.error = error - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGraphError", [("error", ConstructorParameterDescription(self.error))]) - } - } - case statsGraph(Cons_statsGraph) - case statsGraphAsync(Cons_statsGraphAsync) - case statsGraphError(Cons_statsGraphError) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsGraph(let _data): - if boxed { - buffer.appendInt32(-1901828938) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.json.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.zoomToken!, buffer: buffer, boxed: false) - } - break - case .statsGraphAsync(let _data): - if boxed { - buffer.appendInt32(1244130093) - } - serializeString(_data.token, buffer: buffer, boxed: false) - break - case .statsGraphError(let _data): - if boxed { - buffer.appendInt32(-1092839390) - } - serializeString(_data.error, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsGraph(let _data): - return ("statsGraph", [("flags", ConstructorParameterDescription(_data.flags)), ("json", ConstructorParameterDescription(_data.json)), ("zoomToken", ConstructorParameterDescription(_data.zoomToken))]) - case .statsGraphAsync(let _data): - return ("statsGraphAsync", [("token", ConstructorParameterDescription(_data.token))]) - case .statsGraphError(let _data): - return ("statsGraphError", [("error", ConstructorParameterDescription(_data.error))]) - } - } - - public static func parse_statsGraph(_ reader: BufferReader) -> StatsGraph? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.DataJSON? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.DataJSON - } - var _3: String? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - if _c1 && _c2 && _c3 { - return Api.StatsGraph.statsGraph(Cons_statsGraph(flags: _1!, json: _2!, zoomToken: _3)) - } - else { - return nil - } - } - public static func parse_statsGraphAsync(_ reader: BufferReader) -> StatsGraph? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.StatsGraph.statsGraphAsync(Cons_statsGraphAsync(token: _1!)) - } - else { - return nil - } - } - public static func parse_statsGraphError(_ reader: BufferReader) -> StatsGraph? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.StatsGraph.statsGraphError(Cons_statsGraphError(error: _1!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsGroupTopAdmin: TypeConstructorDescription { - public class Cons_statsGroupTopAdmin: TypeConstructorDescription { - public var userId: Int64 - public var deleted: Int32 - public var kicked: Int32 - public var banned: Int32 - public init(userId: Int64, deleted: Int32, kicked: Int32, banned: Int32) { - self.userId = userId - self.deleted = deleted - self.kicked = kicked - self.banned = banned - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGroupTopAdmin", [("userId", ConstructorParameterDescription(self.userId)), ("deleted", ConstructorParameterDescription(self.deleted)), ("kicked", ConstructorParameterDescription(self.kicked)), ("banned", ConstructorParameterDescription(self.banned))]) - } - } - case statsGroupTopAdmin(Cons_statsGroupTopAdmin) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsGroupTopAdmin(let _data): - if boxed { - buffer.appendInt32(-682079097) - } - serializeInt64(_data.userId, buffer: buffer, boxed: false) - serializeInt32(_data.deleted, buffer: buffer, boxed: false) - serializeInt32(_data.kicked, buffer: buffer, boxed: false) - serializeInt32(_data.banned, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsGroupTopAdmin(let _data): - return ("statsGroupTopAdmin", [("userId", ConstructorParameterDescription(_data.userId)), ("deleted", ConstructorParameterDescription(_data.deleted)), ("kicked", ConstructorParameterDescription(_data.kicked)), ("banned", ConstructorParameterDescription(_data.banned))]) - } - } - - public static func parse_statsGroupTopAdmin(_ reader: BufferReader) -> StatsGroupTopAdmin? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.StatsGroupTopAdmin.statsGroupTopAdmin(Cons_statsGroupTopAdmin(userId: _1!, deleted: _2!, kicked: _3!, banned: _4!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsGroupTopInviter: TypeConstructorDescription { - public class Cons_statsGroupTopInviter: TypeConstructorDescription { - public var userId: Int64 - public var invitations: Int32 - public init(userId: Int64, invitations: Int32) { - self.userId = userId - self.invitations = invitations - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGroupTopInviter", [("userId", ConstructorParameterDescription(self.userId)), ("invitations", ConstructorParameterDescription(self.invitations))]) - } - } - case statsGroupTopInviter(Cons_statsGroupTopInviter) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsGroupTopInviter(let _data): - if boxed { - buffer.appendInt32(1398765469) - } - serializeInt64(_data.userId, buffer: buffer, boxed: false) - serializeInt32(_data.invitations, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsGroupTopInviter(let _data): - return ("statsGroupTopInviter", [("userId", ConstructorParameterDescription(_data.userId)), ("invitations", ConstructorParameterDescription(_data.invitations))]) - } - } - - public static func parse_statsGroupTopInviter(_ reader: BufferReader) -> StatsGroupTopInviter? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StatsGroupTopInviter.statsGroupTopInviter(Cons_statsGroupTopInviter(userId: _1!, invitations: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsGroupTopPoster: TypeConstructorDescription { - public class Cons_statsGroupTopPoster: TypeConstructorDescription { - public var userId: Int64 - public var messages: Int32 - public var avgChars: Int32 - public init(userId: Int64, messages: Int32, avgChars: Int32) { - self.userId = userId - self.messages = messages - self.avgChars = avgChars - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsGroupTopPoster", [("userId", ConstructorParameterDescription(self.userId)), ("messages", ConstructorParameterDescription(self.messages)), ("avgChars", ConstructorParameterDescription(self.avgChars))]) - } - } - case statsGroupTopPoster(Cons_statsGroupTopPoster) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsGroupTopPoster(let _data): - if boxed { - buffer.appendInt32(-1660637285) - } - serializeInt64(_data.userId, buffer: buffer, boxed: false) - serializeInt32(_data.messages, buffer: buffer, boxed: false) - serializeInt32(_data.avgChars, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsGroupTopPoster(let _data): - return ("statsGroupTopPoster", [("userId", ConstructorParameterDescription(_data.userId)), ("messages", ConstructorParameterDescription(_data.messages)), ("avgChars", ConstructorParameterDescription(_data.avgChars))]) - } - } - - public static func parse_statsGroupTopPoster(_ reader: BufferReader) -> StatsGroupTopPoster? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.StatsGroupTopPoster.statsGroupTopPoster(Cons_statsGroupTopPoster(userId: _1!, messages: _2!, avgChars: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsPercentValue: TypeConstructorDescription { - public class Cons_statsPercentValue: TypeConstructorDescription { - public var part: Double - public var total: Double - public init(part: Double, total: Double) { - self.part = part - self.total = total - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsPercentValue", [("part", ConstructorParameterDescription(self.part)), ("total", ConstructorParameterDescription(self.total))]) - } - } - case statsPercentValue(Cons_statsPercentValue) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsPercentValue(let _data): - if boxed { - buffer.appendInt32(-875679776) - } - serializeDouble(_data.part, buffer: buffer, boxed: false) - serializeDouble(_data.total, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsPercentValue(let _data): - return ("statsPercentValue", [("part", ConstructorParameterDescription(_data.part)), ("total", ConstructorParameterDescription(_data.total))]) - } - } - - public static func parse_statsPercentValue(_ reader: BufferReader) -> StatsPercentValue? { - var _1: Double? - _1 = reader.readDouble() - var _2: Double? - _2 = reader.readDouble() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StatsPercentValue.statsPercentValue(Cons_statsPercentValue(part: _1!, total: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StatsURL: TypeConstructorDescription { - public class Cons_statsURL: TypeConstructorDescription { - public var url: String - public init(url: String) { - self.url = url - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("statsURL", [("url", ConstructorParameterDescription(self.url))]) - } - } - case statsURL(Cons_statsURL) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .statsURL(let _data): - if boxed { - buffer.appendInt32(1202287072) - } - serializeString(_data.url, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .statsURL(let _data): - return ("statsURL", [("url", ConstructorParameterDescription(_data.url))]) - } - } - - public static func parse_statsURL(_ reader: BufferReader) -> StatsURL? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.StatsURL.statsURL(Cons_statsURL(url: _1!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StickerKeyword: TypeConstructorDescription { - public class Cons_stickerKeyword: TypeConstructorDescription { - public var documentId: Int64 - public var keyword: [String] - public init(documentId: Int64, keyword: [String]) { - self.documentId = documentId - self.keyword = keyword - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("stickerKeyword", [("documentId", ConstructorParameterDescription(self.documentId)), ("keyword", ConstructorParameterDescription(self.keyword))]) - } - } - case stickerKeyword(Cons_stickerKeyword) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .stickerKeyword(let _data): - if boxed { - buffer.appendInt32(-50416996) - } - serializeInt64(_data.documentId, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.keyword.count)) - for item in _data.keyword { - serializeString(item, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .stickerKeyword(let _data): - return ("stickerKeyword", [("documentId", ConstructorParameterDescription(_data.documentId)), ("keyword", ConstructorParameterDescription(_data.keyword))]) - } - } - - public static func parse_stickerKeyword(_ reader: BufferReader) -> StickerKeyword? { - var _1: Int64? - _1 = reader.readInt64() - var _2: [String]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StickerKeyword.stickerKeyword(Cons_stickerKeyword(documentId: _1!, keyword: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StickerPack: TypeConstructorDescription { - public class Cons_stickerPack: TypeConstructorDescription { - public var emoticon: String - public var documents: [Int64] - public init(emoticon: String, documents: [Int64]) { - self.emoticon = emoticon - self.documents = documents - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("stickerPack", [("emoticon", ConstructorParameterDescription(self.emoticon)), ("documents", ConstructorParameterDescription(self.documents))]) - } - } - case stickerPack(Cons_stickerPack) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .stickerPack(let _data): - if boxed { - buffer.appendInt32(313694676) - } - serializeString(_data.emoticon, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.documents.count)) - for item in _data.documents { - serializeInt64(item, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .stickerPack(let _data): - return ("stickerPack", [("emoticon", ConstructorParameterDescription(_data.emoticon)), ("documents", ConstructorParameterDescription(_data.documents))]) - } - } - - public static func parse_stickerPack(_ reader: BufferReader) -> StickerPack? { - var _1: String? - _1 = parseString(reader) - var _2: [Int64]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.StickerPack.stickerPack(Cons_stickerPack(emoticon: _1!, documents: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum StickerSet: TypeConstructorDescription { - public class Cons_stickerSet: TypeConstructorDescription { - public var flags: Int32 - public var installedDate: Int32? - public var id: Int64 - public var accessHash: Int64 - public var title: String - public var shortName: String - public var thumbs: [Api.PhotoSize]? - public var thumbDcId: Int32? - public var thumbVersion: Int32? - public var thumbDocumentId: Int64? - public var count: Int32 - public var hash: Int32 - public init(flags: Int32, installedDate: Int32?, id: Int64, accessHash: Int64, title: String, shortName: String, thumbs: [Api.PhotoSize]?, thumbDcId: Int32?, thumbVersion: Int32?, thumbDocumentId: Int64?, count: Int32, hash: Int32) { - self.flags = flags - self.installedDate = installedDate - self.id = id - self.accessHash = accessHash - self.title = title - self.shortName = shortName - self.thumbs = thumbs - self.thumbDcId = thumbDcId - self.thumbVersion = thumbVersion - self.thumbDocumentId = thumbDocumentId - self.count = count - self.hash = hash - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("stickerSet", [("flags", ConstructorParameterDescription(self.flags)), ("installedDate", ConstructorParameterDescription(self.installedDate)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("title", ConstructorParameterDescription(self.title)), ("shortName", ConstructorParameterDescription(self.shortName)), ("thumbs", ConstructorParameterDescription(self.thumbs)), ("thumbDcId", ConstructorParameterDescription(self.thumbDcId)), ("thumbVersion", ConstructorParameterDescription(self.thumbVersion)), ("thumbDocumentId", ConstructorParameterDescription(self.thumbDocumentId)), ("count", ConstructorParameterDescription(self.count)), ("hash", ConstructorParameterDescription(self.hash))]) - } - } - case stickerSet(Cons_stickerSet) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .stickerSet(let _data): - if boxed { - buffer.appendInt32(768691932) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.installedDate!, buffer: buffer, boxed: false) - } - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeString(_data.title, buffer: buffer, boxed: false) - serializeString(_data.shortName, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 4) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.thumbs!.count)) - for item in _data.thumbs! { - item.serialize(buffer, true) - } - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.thumbDcId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.thumbVersion!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 8) != 0 { - serializeInt64(_data.thumbDocumentId!, buffer: buffer, boxed: false) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - serializeInt32(_data.hash, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .stickerSet(let _data): - return ("stickerSet", [("flags", ConstructorParameterDescription(_data.flags)), ("installedDate", ConstructorParameterDescription(_data.installedDate)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("title", ConstructorParameterDescription(_data.title)), ("shortName", ConstructorParameterDescription(_data.shortName)), ("thumbs", ConstructorParameterDescription(_data.thumbs)), ("thumbDcId", ConstructorParameterDescription(_data.thumbDcId)), ("thumbVersion", ConstructorParameterDescription(_data.thumbVersion)), ("thumbDocumentId", ConstructorParameterDescription(_data.thumbDocumentId)), ("count", ConstructorParameterDescription(_data.count)), ("hash", ConstructorParameterDescription(_data.hash))]) - } - } - - public static func parse_stickerSet(_ reader: BufferReader) -> StickerSet? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = reader.readInt32() - } - var _3: Int64? - _3 = reader.readInt64() - var _4: Int64? - _4 = reader.readInt64() - var _5: String? - _5 = parseString(reader) - var _6: String? - _6 = parseString(reader) - var _7: [Api.PhotoSize]? - if Int(_1!) & Int(1 << 4) != 0 { - if let _ = reader.readInt32() { - _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhotoSize.self) - } - } - var _8: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _8 = reader.readInt32() - } - var _9: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _9 = reader.readInt32() - } - var _10: Int64? - if Int(_1!) & Int(1 << 8) != 0 { - _10 = reader.readInt64() - } - var _11: Int32? - _11 = reader.readInt32() - var _12: Int32? - _12 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil - let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil - let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil - let _c10 = (Int(_1!) & Int(1 << 8) == 0) || _10 != nil - let _c11 = _11 != nil - let _c12 = _12 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { - return Api.StickerSet.stickerSet(Cons_stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, thumbs: _7, thumbDcId: _8, thumbVersion: _9, thumbDocumentId: _10, count: _11!, hash: _12!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api27.swift b/submodules/TelegramApi/Sources/Api27.swift index eb5b139182..b4762b4bda 100644 --- a/submodules/TelegramApi/Sources/Api27.swift +++ b/submodules/TelegramApi/Sources/Api27.swift @@ -1,3 +1,733 @@ +public extension Api { + enum StatsAbsValueAndPrev: TypeConstructorDescription { + public class Cons_statsAbsValueAndPrev: TypeConstructorDescription { + public var current: Double + public var previous: Double + public init(current: Double, previous: Double) { + self.current = current + self.previous = previous + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsAbsValueAndPrev", [("current", ConstructorParameterDescription(self.current)), ("previous", ConstructorParameterDescription(self.previous))]) + } + } + case statsAbsValueAndPrev(Cons_statsAbsValueAndPrev) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsAbsValueAndPrev(let _data): + if boxed { + buffer.appendInt32(-884757282) + } + serializeDouble(_data.current, buffer: buffer, boxed: false) + serializeDouble(_data.previous, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsAbsValueAndPrev(let _data): + return ("statsAbsValueAndPrev", [("current", ConstructorParameterDescription(_data.current)), ("previous", ConstructorParameterDescription(_data.previous))]) + } + } + + public static func parse_statsAbsValueAndPrev(_ reader: BufferReader) -> StatsAbsValueAndPrev? { + var _1: Double? + _1 = reader.readDouble() + var _2: Double? + _2 = reader.readDouble() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StatsAbsValueAndPrev.statsAbsValueAndPrev(Cons_statsAbsValueAndPrev(current: _1!, previous: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsDateRangeDays: TypeConstructorDescription { + public class Cons_statsDateRangeDays: TypeConstructorDescription { + public var minDate: Int32 + public var maxDate: Int32 + public init(minDate: Int32, maxDate: Int32) { + self.minDate = minDate + self.maxDate = maxDate + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsDateRangeDays", [("minDate", ConstructorParameterDescription(self.minDate)), ("maxDate", ConstructorParameterDescription(self.maxDate))]) + } + } + case statsDateRangeDays(Cons_statsDateRangeDays) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsDateRangeDays(let _data): + if boxed { + buffer.appendInt32(-1237848657) + } + serializeInt32(_data.minDate, buffer: buffer, boxed: false) + serializeInt32(_data.maxDate, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsDateRangeDays(let _data): + return ("statsDateRangeDays", [("minDate", ConstructorParameterDescription(_data.minDate)), ("maxDate", ConstructorParameterDescription(_data.maxDate))]) + } + } + + public static func parse_statsDateRangeDays(_ reader: BufferReader) -> StatsDateRangeDays? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StatsDateRangeDays.statsDateRangeDays(Cons_statsDateRangeDays(minDate: _1!, maxDate: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsGraph: TypeConstructorDescription { + public class Cons_statsGraph: TypeConstructorDescription { + public var flags: Int32 + public var json: Api.DataJSON + public var zoomToken: String? + public init(flags: Int32, json: Api.DataJSON, zoomToken: String?) { + self.flags = flags + self.json = json + self.zoomToken = zoomToken + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGraph", [("flags", ConstructorParameterDescription(self.flags)), ("json", ConstructorParameterDescription(self.json)), ("zoomToken", ConstructorParameterDescription(self.zoomToken))]) + } + } + public class Cons_statsGraphAsync: TypeConstructorDescription { + public var token: String + public init(token: String) { + self.token = token + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGraphAsync", [("token", ConstructorParameterDescription(self.token))]) + } + } + public class Cons_statsGraphError: TypeConstructorDescription { + public var error: String + public init(error: String) { + self.error = error + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGraphError", [("error", ConstructorParameterDescription(self.error))]) + } + } + case statsGraph(Cons_statsGraph) + case statsGraphAsync(Cons_statsGraphAsync) + case statsGraphError(Cons_statsGraphError) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsGraph(let _data): + if boxed { + buffer.appendInt32(-1901828938) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.json.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.zoomToken!, buffer: buffer, boxed: false) + } + break + case .statsGraphAsync(let _data): + if boxed { + buffer.appendInt32(1244130093) + } + serializeString(_data.token, buffer: buffer, boxed: false) + break + case .statsGraphError(let _data): + if boxed { + buffer.appendInt32(-1092839390) + } + serializeString(_data.error, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsGraph(let _data): + return ("statsGraph", [("flags", ConstructorParameterDescription(_data.flags)), ("json", ConstructorParameterDescription(_data.json)), ("zoomToken", ConstructorParameterDescription(_data.zoomToken))]) + case .statsGraphAsync(let _data): + return ("statsGraphAsync", [("token", ConstructorParameterDescription(_data.token))]) + case .statsGraphError(let _data): + return ("statsGraphError", [("error", ConstructorParameterDescription(_data.error))]) + } + } + + public static func parse_statsGraph(_ reader: BufferReader) -> StatsGraph? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.DataJSON? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.DataJSON + } + var _3: String? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.StatsGraph.statsGraph(Cons_statsGraph(flags: _1!, json: _2!, zoomToken: _3)) + } + else { + return nil + } + } + public static func parse_statsGraphAsync(_ reader: BufferReader) -> StatsGraph? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.StatsGraph.statsGraphAsync(Cons_statsGraphAsync(token: _1!)) + } + else { + return nil + } + } + public static func parse_statsGraphError(_ reader: BufferReader) -> StatsGraph? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.StatsGraph.statsGraphError(Cons_statsGraphError(error: _1!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsGroupTopAdmin: TypeConstructorDescription { + public class Cons_statsGroupTopAdmin: TypeConstructorDescription { + public var userId: Int64 + public var deleted: Int32 + public var kicked: Int32 + public var banned: Int32 + public init(userId: Int64, deleted: Int32, kicked: Int32, banned: Int32) { + self.userId = userId + self.deleted = deleted + self.kicked = kicked + self.banned = banned + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGroupTopAdmin", [("userId", ConstructorParameterDescription(self.userId)), ("deleted", ConstructorParameterDescription(self.deleted)), ("kicked", ConstructorParameterDescription(self.kicked)), ("banned", ConstructorParameterDescription(self.banned))]) + } + } + case statsGroupTopAdmin(Cons_statsGroupTopAdmin) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsGroupTopAdmin(let _data): + if boxed { + buffer.appendInt32(-682079097) + } + serializeInt64(_data.userId, buffer: buffer, boxed: false) + serializeInt32(_data.deleted, buffer: buffer, boxed: false) + serializeInt32(_data.kicked, buffer: buffer, boxed: false) + serializeInt32(_data.banned, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsGroupTopAdmin(let _data): + return ("statsGroupTopAdmin", [("userId", ConstructorParameterDescription(_data.userId)), ("deleted", ConstructorParameterDescription(_data.deleted)), ("kicked", ConstructorParameterDescription(_data.kicked)), ("banned", ConstructorParameterDescription(_data.banned))]) + } + } + + public static func parse_statsGroupTopAdmin(_ reader: BufferReader) -> StatsGroupTopAdmin? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.StatsGroupTopAdmin.statsGroupTopAdmin(Cons_statsGroupTopAdmin(userId: _1!, deleted: _2!, kicked: _3!, banned: _4!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsGroupTopInviter: TypeConstructorDescription { + public class Cons_statsGroupTopInviter: TypeConstructorDescription { + public var userId: Int64 + public var invitations: Int32 + public init(userId: Int64, invitations: Int32) { + self.userId = userId + self.invitations = invitations + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGroupTopInviter", [("userId", ConstructorParameterDescription(self.userId)), ("invitations", ConstructorParameterDescription(self.invitations))]) + } + } + case statsGroupTopInviter(Cons_statsGroupTopInviter) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsGroupTopInviter(let _data): + if boxed { + buffer.appendInt32(1398765469) + } + serializeInt64(_data.userId, buffer: buffer, boxed: false) + serializeInt32(_data.invitations, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsGroupTopInviter(let _data): + return ("statsGroupTopInviter", [("userId", ConstructorParameterDescription(_data.userId)), ("invitations", ConstructorParameterDescription(_data.invitations))]) + } + } + + public static func parse_statsGroupTopInviter(_ reader: BufferReader) -> StatsGroupTopInviter? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StatsGroupTopInviter.statsGroupTopInviter(Cons_statsGroupTopInviter(userId: _1!, invitations: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsGroupTopPoster: TypeConstructorDescription { + public class Cons_statsGroupTopPoster: TypeConstructorDescription { + public var userId: Int64 + public var messages: Int32 + public var avgChars: Int32 + public init(userId: Int64, messages: Int32, avgChars: Int32) { + self.userId = userId + self.messages = messages + self.avgChars = avgChars + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsGroupTopPoster", [("userId", ConstructorParameterDescription(self.userId)), ("messages", ConstructorParameterDescription(self.messages)), ("avgChars", ConstructorParameterDescription(self.avgChars))]) + } + } + case statsGroupTopPoster(Cons_statsGroupTopPoster) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsGroupTopPoster(let _data): + if boxed { + buffer.appendInt32(-1660637285) + } + serializeInt64(_data.userId, buffer: buffer, boxed: false) + serializeInt32(_data.messages, buffer: buffer, boxed: false) + serializeInt32(_data.avgChars, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsGroupTopPoster(let _data): + return ("statsGroupTopPoster", [("userId", ConstructorParameterDescription(_data.userId)), ("messages", ConstructorParameterDescription(_data.messages)), ("avgChars", ConstructorParameterDescription(_data.avgChars))]) + } + } + + public static func parse_statsGroupTopPoster(_ reader: BufferReader) -> StatsGroupTopPoster? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.StatsGroupTopPoster.statsGroupTopPoster(Cons_statsGroupTopPoster(userId: _1!, messages: _2!, avgChars: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsPercentValue: TypeConstructorDescription { + public class Cons_statsPercentValue: TypeConstructorDescription { + public var part: Double + public var total: Double + public init(part: Double, total: Double) { + self.part = part + self.total = total + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsPercentValue", [("part", ConstructorParameterDescription(self.part)), ("total", ConstructorParameterDescription(self.total))]) + } + } + case statsPercentValue(Cons_statsPercentValue) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsPercentValue(let _data): + if boxed { + buffer.appendInt32(-875679776) + } + serializeDouble(_data.part, buffer: buffer, boxed: false) + serializeDouble(_data.total, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsPercentValue(let _data): + return ("statsPercentValue", [("part", ConstructorParameterDescription(_data.part)), ("total", ConstructorParameterDescription(_data.total))]) + } + } + + public static func parse_statsPercentValue(_ reader: BufferReader) -> StatsPercentValue? { + var _1: Double? + _1 = reader.readDouble() + var _2: Double? + _2 = reader.readDouble() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StatsPercentValue.statsPercentValue(Cons_statsPercentValue(part: _1!, total: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StatsURL: TypeConstructorDescription { + public class Cons_statsURL: TypeConstructorDescription { + public var url: String + public init(url: String) { + self.url = url + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("statsURL", [("url", ConstructorParameterDescription(self.url))]) + } + } + case statsURL(Cons_statsURL) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .statsURL(let _data): + if boxed { + buffer.appendInt32(1202287072) + } + serializeString(_data.url, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .statsURL(let _data): + return ("statsURL", [("url", ConstructorParameterDescription(_data.url))]) + } + } + + public static func parse_statsURL(_ reader: BufferReader) -> StatsURL? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.StatsURL.statsURL(Cons_statsURL(url: _1!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StickerKeyword: TypeConstructorDescription { + public class Cons_stickerKeyword: TypeConstructorDescription { + public var documentId: Int64 + public var keyword: [String] + public init(documentId: Int64, keyword: [String]) { + self.documentId = documentId + self.keyword = keyword + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("stickerKeyword", [("documentId", ConstructorParameterDescription(self.documentId)), ("keyword", ConstructorParameterDescription(self.keyword))]) + } + } + case stickerKeyword(Cons_stickerKeyword) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .stickerKeyword(let _data): + if boxed { + buffer.appendInt32(-50416996) + } + serializeInt64(_data.documentId, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.keyword.count)) + for item in _data.keyword { + serializeString(item, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .stickerKeyword(let _data): + return ("stickerKeyword", [("documentId", ConstructorParameterDescription(_data.documentId)), ("keyword", ConstructorParameterDescription(_data.keyword))]) + } + } + + public static func parse_stickerKeyword(_ reader: BufferReader) -> StickerKeyword? { + var _1: Int64? + _1 = reader.readInt64() + var _2: [String]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: String.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StickerKeyword.stickerKeyword(Cons_stickerKeyword(documentId: _1!, keyword: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StickerPack: TypeConstructorDescription { + public class Cons_stickerPack: TypeConstructorDescription { + public var emoticon: String + public var documents: [Int64] + public init(emoticon: String, documents: [Int64]) { + self.emoticon = emoticon + self.documents = documents + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("stickerPack", [("emoticon", ConstructorParameterDescription(self.emoticon)), ("documents", ConstructorParameterDescription(self.documents))]) + } + } + case stickerPack(Cons_stickerPack) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .stickerPack(let _data): + if boxed { + buffer.appendInt32(313694676) + } + serializeString(_data.emoticon, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.documents.count)) + for item in _data.documents { + serializeInt64(item, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .stickerPack(let _data): + return ("stickerPack", [("emoticon", ConstructorParameterDescription(_data.emoticon)), ("documents", ConstructorParameterDescription(_data.documents))]) + } + } + + public static func parse_stickerPack(_ reader: BufferReader) -> StickerPack? { + var _1: String? + _1 = parseString(reader) + var _2: [Int64]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.StickerPack.stickerPack(Cons_stickerPack(emoticon: _1!, documents: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum StickerSet: TypeConstructorDescription { + public class Cons_stickerSet: TypeConstructorDescription { + public var flags: Int32 + public var installedDate: Int32? + public var id: Int64 + public var accessHash: Int64 + public var title: String + public var shortName: String + public var thumbs: [Api.PhotoSize]? + public var thumbDcId: Int32? + public var thumbVersion: Int32? + public var thumbDocumentId: Int64? + public var count: Int32 + public var hash: Int32 + public init(flags: Int32, installedDate: Int32?, id: Int64, accessHash: Int64, title: String, shortName: String, thumbs: [Api.PhotoSize]?, thumbDcId: Int32?, thumbVersion: Int32?, thumbDocumentId: Int64?, count: Int32, hash: Int32) { + self.flags = flags + self.installedDate = installedDate + self.id = id + self.accessHash = accessHash + self.title = title + self.shortName = shortName + self.thumbs = thumbs + self.thumbDcId = thumbDcId + self.thumbVersion = thumbVersion + self.thumbDocumentId = thumbDocumentId + self.count = count + self.hash = hash + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("stickerSet", [("flags", ConstructorParameterDescription(self.flags)), ("installedDate", ConstructorParameterDescription(self.installedDate)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("title", ConstructorParameterDescription(self.title)), ("shortName", ConstructorParameterDescription(self.shortName)), ("thumbs", ConstructorParameterDescription(self.thumbs)), ("thumbDcId", ConstructorParameterDescription(self.thumbDcId)), ("thumbVersion", ConstructorParameterDescription(self.thumbVersion)), ("thumbDocumentId", ConstructorParameterDescription(self.thumbDocumentId)), ("count", ConstructorParameterDescription(self.count)), ("hash", ConstructorParameterDescription(self.hash))]) + } + } + case stickerSet(Cons_stickerSet) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .stickerSet(let _data): + if boxed { + buffer.appendInt32(768691932) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.installedDate!, buffer: buffer, boxed: false) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + serializeString(_data.shortName, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 4) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.thumbs!.count)) + for item in _data.thumbs! { + item.serialize(buffer, true) + } + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.thumbDcId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.thumbVersion!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 8) != 0 { + serializeInt64(_data.thumbDocumentId!, buffer: buffer, boxed: false) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + serializeInt32(_data.hash, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .stickerSet(let _data): + return ("stickerSet", [("flags", ConstructorParameterDescription(_data.flags)), ("installedDate", ConstructorParameterDescription(_data.installedDate)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("title", ConstructorParameterDescription(_data.title)), ("shortName", ConstructorParameterDescription(_data.shortName)), ("thumbs", ConstructorParameterDescription(_data.thumbs)), ("thumbDcId", ConstructorParameterDescription(_data.thumbDcId)), ("thumbVersion", ConstructorParameterDescription(_data.thumbVersion)), ("thumbDocumentId", ConstructorParameterDescription(_data.thumbDocumentId)), ("count", ConstructorParameterDescription(_data.count)), ("hash", ConstructorParameterDescription(_data.hash))]) + } + } + + public static func parse_stickerSet(_ reader: BufferReader) -> StickerSet? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = reader.readInt32() + } + var _3: Int64? + _3 = reader.readInt64() + var _4: Int64? + _4 = reader.readInt64() + var _5: String? + _5 = parseString(reader) + var _6: String? + _6 = parseString(reader) + var _7: [Api.PhotoSize]? + if Int(_1!) & Int(1 << 4) != 0 { + if let _ = reader.readInt32() { + _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PhotoSize.self) + } + } + var _8: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _8 = reader.readInt32() + } + var _9: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _9 = reader.readInt32() + } + var _10: Int64? + if Int(_1!) & Int(1 << 8) != 0 { + _10 = reader.readInt64() + } + var _11: Int32? + _11 = reader.readInt32() + var _12: Int32? + _12 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil + let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil + let _c10 = (Int(_1!) & Int(1 << 8) == 0) || _10 != nil + let _c11 = _11 != nil + let _c12 = _12 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 { + return Api.StickerSet.stickerSet(Cons_stickerSet(flags: _1!, installedDate: _2, id: _3!, accessHash: _4!, title: _5!, shortName: _6!, thumbs: _7, thumbDcId: _8, thumbVersion: _9, thumbDocumentId: _10, count: _11!, hash: _12!)) + } + else { + return nil + } + } + } +} public extension Api { enum StickerSetCovered: TypeConstructorDescription { public class Cons_stickerSetCovered: TypeConstructorDescription { @@ -1197,611 +1927,3 @@ public extension Api { } } } -public extension Api { - enum Theme: TypeConstructorDescription { - public class Cons_theme: TypeConstructorDescription { - public var flags: Int32 - public var id: Int64 - public var accessHash: Int64 - public var slug: String - public var title: String - public var document: Api.Document? - public var settings: [Api.ThemeSettings]? - public var emoticon: String? - public var installsCount: Int32? - public init(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, document: Api.Document?, settings: [Api.ThemeSettings]?, emoticon: String?, installsCount: Int32?) { - self.flags = flags - self.id = id - self.accessHash = accessHash - self.slug = slug - self.title = title - self.document = document - self.settings = settings - self.emoticon = emoticon - self.installsCount = installsCount - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("theme", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("slug", ConstructorParameterDescription(self.slug)), ("title", ConstructorParameterDescription(self.title)), ("document", ConstructorParameterDescription(self.document)), ("settings", ConstructorParameterDescription(self.settings)), ("emoticon", ConstructorParameterDescription(self.emoticon)), ("installsCount", ConstructorParameterDescription(self.installsCount))]) - } - } - case theme(Cons_theme) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .theme(let _data): - if boxed { - buffer.appendInt32(-1609668650) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt64(_data.id, buffer: buffer, boxed: false) - serializeInt64(_data.accessHash, buffer: buffer, boxed: false) - serializeString(_data.slug, buffer: buffer, boxed: false) - serializeString(_data.title, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 2) != 0 { - _data.document!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.settings!.count)) - for item in _data.settings! { - item.serialize(buffer, true) - } - } - if Int(_data.flags) & Int(1 << 6) != 0 { - serializeString(_data.emoticon!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.installsCount!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .theme(let _data): - return ("theme", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("slug", ConstructorParameterDescription(_data.slug)), ("title", ConstructorParameterDescription(_data.title)), ("document", ConstructorParameterDescription(_data.document)), ("settings", ConstructorParameterDescription(_data.settings)), ("emoticon", ConstructorParameterDescription(_data.emoticon)), ("installsCount", ConstructorParameterDescription(_data.installsCount))]) - } - } - - public static func parse_theme(_ reader: BufferReader) -> Theme? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - var _4: String? - _4 = parseString(reader) - var _5: String? - _5 = parseString(reader) - var _6: Api.Document? - if Int(_1!) & Int(1 << 2) != 0 { - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.Document - } - } - var _7: [Api.ThemeSettings]? - if Int(_1!) & Int(1 << 3) != 0 { - if let _ = reader.readInt32() { - _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ThemeSettings.self) - } - } - var _8: String? - if Int(_1!) & Int(1 << 6) != 0 { - _8 = parseString(reader) - } - var _9: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _9 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil - let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil - let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil - let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { - return Api.Theme.theme(Cons_theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, settings: _7, emoticon: _8, installsCount: _9)) - } - else { - return nil - } - } - } -} -public extension Api { - enum ThemeSettings: TypeConstructorDescription { - public class Cons_themeSettings: TypeConstructorDescription { - public var flags: Int32 - public var baseTheme: Api.BaseTheme - public var accentColor: Int32 - public var outboxAccentColor: Int32? - public var messageColors: [Int32]? - public var wallpaper: Api.WallPaper? - public init(flags: Int32, baseTheme: Api.BaseTheme, accentColor: Int32, outboxAccentColor: Int32?, messageColors: [Int32]?, wallpaper: Api.WallPaper?) { - self.flags = flags - self.baseTheme = baseTheme - self.accentColor = accentColor - self.outboxAccentColor = outboxAccentColor - self.messageColors = messageColors - self.wallpaper = wallpaper - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("themeSettings", [("flags", ConstructorParameterDescription(self.flags)), ("baseTheme", ConstructorParameterDescription(self.baseTheme)), ("accentColor", ConstructorParameterDescription(self.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(self.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(self.messageColors)), ("wallpaper", ConstructorParameterDescription(self.wallpaper))]) - } - } - case themeSettings(Cons_themeSettings) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .themeSettings(let _data): - if boxed { - buffer.appendInt32(-94849324) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.baseTheme.serialize(buffer, true) - serializeInt32(_data.accentColor, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt32(_data.outboxAccentColor!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messageColors!.count)) - for item in _data.messageColors! { - serializeInt32(item, buffer: buffer, boxed: false) - } - } - if Int(_data.flags) & Int(1 << 1) != 0 { - _data.wallpaper!.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .themeSettings(let _data): - return ("themeSettings", [("flags", ConstructorParameterDescription(_data.flags)), ("baseTheme", ConstructorParameterDescription(_data.baseTheme)), ("accentColor", ConstructorParameterDescription(_data.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(_data.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(_data.messageColors)), ("wallpaper", ConstructorParameterDescription(_data.wallpaper))]) - } - } - - public static func parse_themeSettings(_ reader: BufferReader) -> ThemeSettings? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.BaseTheme? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.BaseTheme - } - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - if Int(_1!) & Int(1 << 3) != 0 { - _4 = reader.readInt32() - } - var _5: [Int32]? - if Int(_1!) & Int(1 << 0) != 0 { - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) - } - } - var _6: Api.WallPaper? - if Int(_1!) & Int(1 << 1) != 0 { - if let signature = reader.readInt32() { - _6 = Api.parse(reader, signature: signature) as? Api.WallPaper - } - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.ThemeSettings.themeSettings(Cons_themeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6)) - } - else { - return nil - } - } - } -} -public extension Api { - enum Timezone: TypeConstructorDescription { - public class Cons_timezone: TypeConstructorDescription { - public var id: String - public var name: String - public var utcOffset: Int32 - public init(id: String, name: String, utcOffset: Int32) { - self.id = id - self.name = name - self.utcOffset = utcOffset - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("timezone", [("id", ConstructorParameterDescription(self.id)), ("name", ConstructorParameterDescription(self.name)), ("utcOffset", ConstructorParameterDescription(self.utcOffset))]) - } - } - case timezone(Cons_timezone) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .timezone(let _data): - if boxed { - buffer.appendInt32(-7173643) - } - serializeString(_data.id, buffer: buffer, boxed: false) - serializeString(_data.name, buffer: buffer, boxed: false) - serializeInt32(_data.utcOffset, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .timezone(let _data): - return ("timezone", [("id", ConstructorParameterDescription(_data.id)), ("name", ConstructorParameterDescription(_data.name)), ("utcOffset", ConstructorParameterDescription(_data.utcOffset))]) - } - } - - public static func parse_timezone(_ reader: BufferReader) -> Timezone? { - var _1: String? - _1 = parseString(reader) - var _2: String? - _2 = parseString(reader) - var _3: Int32? - _3 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.Timezone.timezone(Cons_timezone(id: _1!, name: _2!, utcOffset: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum TodoCompletion: TypeConstructorDescription { - public class Cons_todoCompletion: TypeConstructorDescription { - public var id: Int32 - public var completedBy: Api.Peer - public var date: Int32 - public init(id: Int32, completedBy: Api.Peer, date: Int32) { - self.id = id - self.completedBy = completedBy - self.date = date - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("todoCompletion", [("id", ConstructorParameterDescription(self.id)), ("completedBy", ConstructorParameterDescription(self.completedBy)), ("date", ConstructorParameterDescription(self.date))]) - } - } - case todoCompletion(Cons_todoCompletion) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .todoCompletion(let _data): - if boxed { - buffer.appendInt32(572241380) - } - serializeInt32(_data.id, buffer: buffer, boxed: false) - _data.completedBy.serialize(buffer, true) - serializeInt32(_data.date, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .todoCompletion(let _data): - return ("todoCompletion", [("id", ConstructorParameterDescription(_data.id)), ("completedBy", ConstructorParameterDescription(_data.completedBy)), ("date", ConstructorParameterDescription(_data.date))]) - } - } - - public static func parse_todoCompletion(_ reader: BufferReader) -> TodoCompletion? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - var _3: Int32? - _3 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.TodoCompletion.todoCompletion(Cons_todoCompletion(id: _1!, completedBy: _2!, date: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum TodoItem: TypeConstructorDescription { - public class Cons_todoItem: TypeConstructorDescription { - public var id: Int32 - public var title: Api.TextWithEntities - public init(id: Int32, title: Api.TextWithEntities) { - self.id = id - self.title = title - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("todoItem", [("id", ConstructorParameterDescription(self.id)), ("title", ConstructorParameterDescription(self.title))]) - } - } - case todoItem(Cons_todoItem) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .todoItem(let _data): - if boxed { - buffer.appendInt32(-878074577) - } - serializeInt32(_data.id, buffer: buffer, boxed: false) - _data.title.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .todoItem(let _data): - return ("todoItem", [("id", ConstructorParameterDescription(_data.id)), ("title", ConstructorParameterDescription(_data.title))]) - } - } - - public static func parse_todoItem(_ reader: BufferReader) -> TodoItem? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.TextWithEntities? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.TodoItem.todoItem(Cons_todoItem(id: _1!, title: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum TodoList: TypeConstructorDescription { - public class Cons_todoList: TypeConstructorDescription { - public var flags: Int32 - public var title: Api.TextWithEntities - public var list: [Api.TodoItem] - public init(flags: Int32, title: Api.TextWithEntities, list: [Api.TodoItem]) { - self.flags = flags - self.title = title - self.list = list - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("todoList", [("flags", ConstructorParameterDescription(self.flags)), ("title", ConstructorParameterDescription(self.title)), ("list", ConstructorParameterDescription(self.list))]) - } - } - case todoList(Cons_todoList) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .todoList(let _data): - if boxed { - buffer.appendInt32(1236871718) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.title.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.list.count)) - for item in _data.list { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .todoList(let _data): - return ("todoList", [("flags", ConstructorParameterDescription(_data.flags)), ("title", ConstructorParameterDescription(_data.title)), ("list", ConstructorParameterDescription(_data.list))]) - } - } - - public static func parse_todoList(_ reader: BufferReader) -> TodoList? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.TextWithEntities? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - var _3: [Api.TodoItem]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TodoItem.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.TodoList.todoList(Cons_todoList(flags: _1!, title: _2!, list: _3!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum TopPeer: TypeConstructorDescription { - public class Cons_topPeer: TypeConstructorDescription { - public var peer: Api.Peer - public var rating: Double - public init(peer: Api.Peer, rating: Double) { - self.peer = peer - self.rating = rating - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("topPeer", [("peer", ConstructorParameterDescription(self.peer)), ("rating", ConstructorParameterDescription(self.rating))]) - } - } - case topPeer(Cons_topPeer) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .topPeer(let _data): - if boxed { - buffer.appendInt32(-305282981) - } - _data.peer.serialize(buffer, true) - serializeDouble(_data.rating, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .topPeer(let _data): - return ("topPeer", [("peer", ConstructorParameterDescription(_data.peer)), ("rating", ConstructorParameterDescription(_data.rating))]) - } - } - - public static func parse_topPeer(_ reader: BufferReader) -> TopPeer? { - var _1: Api.Peer? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.Peer - } - var _2: Double? - _2 = reader.readDouble() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.TopPeer.topPeer(Cons_topPeer(peer: _1!, rating: _2!)) - } - else { - return nil - } - } - } -} -public extension Api { - enum TopPeerCategory: TypeConstructorDescription { - case topPeerCategoryBotsApp - case topPeerCategoryBotsInline - case topPeerCategoryBotsPM - case topPeerCategoryChannels - case topPeerCategoryCorrespondents - case topPeerCategoryForwardChats - case topPeerCategoryForwardUsers - case topPeerCategoryGroups - case topPeerCategoryPhoneCalls - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .topPeerCategoryBotsApp: - if boxed { - buffer.appendInt32(-39945236) - } - break - case .topPeerCategoryBotsInline: - if boxed { - buffer.appendInt32(344356834) - } - break - case .topPeerCategoryBotsPM: - if boxed { - buffer.appendInt32(-1419371685) - } - break - case .topPeerCategoryChannels: - if boxed { - buffer.appendInt32(371037736) - } - break - case .topPeerCategoryCorrespondents: - if boxed { - buffer.appendInt32(104314861) - } - break - case .topPeerCategoryForwardChats: - if boxed { - buffer.appendInt32(-68239120) - } - break - case .topPeerCategoryForwardUsers: - if boxed { - buffer.appendInt32(-1472172887) - } - break - case .topPeerCategoryGroups: - if boxed { - buffer.appendInt32(-1122524854) - } - break - case .topPeerCategoryPhoneCalls: - if boxed { - buffer.appendInt32(511092620) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .topPeerCategoryBotsApp: - return ("topPeerCategoryBotsApp", []) - case .topPeerCategoryBotsInline: - return ("topPeerCategoryBotsInline", []) - case .topPeerCategoryBotsPM: - return ("topPeerCategoryBotsPM", []) - case .topPeerCategoryChannels: - return ("topPeerCategoryChannels", []) - case .topPeerCategoryCorrespondents: - return ("topPeerCategoryCorrespondents", []) - case .topPeerCategoryForwardChats: - return ("topPeerCategoryForwardChats", []) - case .topPeerCategoryForwardUsers: - return ("topPeerCategoryForwardUsers", []) - case .topPeerCategoryGroups: - return ("topPeerCategoryGroups", []) - case .topPeerCategoryPhoneCalls: - return ("topPeerCategoryPhoneCalls", []) - } - } - - public static func parse_topPeerCategoryBotsApp(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryBotsApp - } - public static func parse_topPeerCategoryBotsInline(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryBotsInline - } - public static func parse_topPeerCategoryBotsPM(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryBotsPM - } - public static func parse_topPeerCategoryChannels(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryChannels - } - public static func parse_topPeerCategoryCorrespondents(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryCorrespondents - } - public static func parse_topPeerCategoryForwardChats(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryForwardChats - } - public static func parse_topPeerCategoryForwardUsers(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryForwardUsers - } - public static func parse_topPeerCategoryGroups(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryGroups - } - public static func parse_topPeerCategoryPhoneCalls(_ reader: BufferReader) -> TopPeerCategory? { - return Api.TopPeerCategory.topPeerCategoryPhoneCalls - } - } -} diff --git a/submodules/TelegramApi/Sources/Api28.swift b/submodules/TelegramApi/Sources/Api28.swift index e3507ba121..fc2e197ab8 100644 --- a/submodules/TelegramApi/Sources/Api28.swift +++ b/submodules/TelegramApi/Sources/Api28.swift @@ -1,3 +1,611 @@ +public extension Api { + enum Theme: TypeConstructorDescription { + public class Cons_theme: TypeConstructorDescription { + public var flags: Int32 + public var id: Int64 + public var accessHash: Int64 + public var slug: String + public var title: String + public var document: Api.Document? + public var settings: [Api.ThemeSettings]? + public var emoticon: String? + public var installsCount: Int32? + public init(flags: Int32, id: Int64, accessHash: Int64, slug: String, title: String, document: Api.Document?, settings: [Api.ThemeSettings]?, emoticon: String?, installsCount: Int32?) { + self.flags = flags + self.id = id + self.accessHash = accessHash + self.slug = slug + self.title = title + self.document = document + self.settings = settings + self.emoticon = emoticon + self.installsCount = installsCount + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("theme", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash)), ("slug", ConstructorParameterDescription(self.slug)), ("title", ConstructorParameterDescription(self.title)), ("document", ConstructorParameterDescription(self.document)), ("settings", ConstructorParameterDescription(self.settings)), ("emoticon", ConstructorParameterDescription(self.emoticon)), ("installsCount", ConstructorParameterDescription(self.installsCount))]) + } + } + case theme(Cons_theme) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .theme(let _data): + if boxed { + buffer.appendInt32(-1609668650) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + serializeString(_data.slug, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 2) != 0 { + _data.document!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.settings!.count)) + for item in _data.settings! { + item.serialize(buffer, true) + } + } + if Int(_data.flags) & Int(1 << 6) != 0 { + serializeString(_data.emoticon!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.installsCount!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .theme(let _data): + return ("theme", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash)), ("slug", ConstructorParameterDescription(_data.slug)), ("title", ConstructorParameterDescription(_data.title)), ("document", ConstructorParameterDescription(_data.document)), ("settings", ConstructorParameterDescription(_data.settings)), ("emoticon", ConstructorParameterDescription(_data.emoticon)), ("installsCount", ConstructorParameterDescription(_data.installsCount))]) + } + } + + public static func parse_theme(_ reader: BufferReader) -> Theme? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + var _4: String? + _4 = parseString(reader) + var _5: String? + _5 = parseString(reader) + var _6: Api.Document? + if Int(_1!) & Int(1 << 2) != 0 { + if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.Document + } + } + var _7: [Api.ThemeSettings]? + if Int(_1!) & Int(1 << 3) != 0 { + if let _ = reader.readInt32() { + _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ThemeSettings.self) + } + } + var _8: String? + if Int(_1!) & Int(1 << 6) != 0 { + _8 = parseString(reader) + } + var _9: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _9 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil + let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil + let _c8 = (Int(_1!) & Int(1 << 6) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 4) == 0) || _9 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { + return Api.Theme.theme(Cons_theme(flags: _1!, id: _2!, accessHash: _3!, slug: _4!, title: _5!, document: _6, settings: _7, emoticon: _8, installsCount: _9)) + } + else { + return nil + } + } + } +} +public extension Api { + enum ThemeSettings: TypeConstructorDescription { + public class Cons_themeSettings: TypeConstructorDescription { + public var flags: Int32 + public var baseTheme: Api.BaseTheme + public var accentColor: Int32 + public var outboxAccentColor: Int32? + public var messageColors: [Int32]? + public var wallpaper: Api.WallPaper? + public init(flags: Int32, baseTheme: Api.BaseTheme, accentColor: Int32, outboxAccentColor: Int32?, messageColors: [Int32]?, wallpaper: Api.WallPaper?) { + self.flags = flags + self.baseTheme = baseTheme + self.accentColor = accentColor + self.outboxAccentColor = outboxAccentColor + self.messageColors = messageColors + self.wallpaper = wallpaper + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("themeSettings", [("flags", ConstructorParameterDescription(self.flags)), ("baseTheme", ConstructorParameterDescription(self.baseTheme)), ("accentColor", ConstructorParameterDescription(self.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(self.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(self.messageColors)), ("wallpaper", ConstructorParameterDescription(self.wallpaper))]) + } + } + case themeSettings(Cons_themeSettings) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .themeSettings(let _data): + if boxed { + buffer.appendInt32(-94849324) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.baseTheme.serialize(buffer, true) + serializeInt32(_data.accentColor, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.outboxAccentColor!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messageColors!.count)) + for item in _data.messageColors! { + serializeInt32(item, buffer: buffer, boxed: false) + } + } + if Int(_data.flags) & Int(1 << 1) != 0 { + _data.wallpaper!.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .themeSettings(let _data): + return ("themeSettings", [("flags", ConstructorParameterDescription(_data.flags)), ("baseTheme", ConstructorParameterDescription(_data.baseTheme)), ("accentColor", ConstructorParameterDescription(_data.accentColor)), ("outboxAccentColor", ConstructorParameterDescription(_data.outboxAccentColor)), ("messageColors", ConstructorParameterDescription(_data.messageColors)), ("wallpaper", ConstructorParameterDescription(_data.wallpaper))]) + } + } + + public static func parse_themeSettings(_ reader: BufferReader) -> ThemeSettings? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.BaseTheme? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.BaseTheme + } + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + if Int(_1!) & Int(1 << 3) != 0 { + _4 = reader.readInt32() + } + var _5: [Int32]? + if Int(_1!) & Int(1 << 0) != 0 { + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + } + var _6: Api.WallPaper? + if Int(_1!) & Int(1 << 1) != 0 { + if let signature = reader.readInt32() { + _6 = Api.parse(reader, signature: signature) as? Api.WallPaper + } + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.ThemeSettings.themeSettings(Cons_themeSettings(flags: _1!, baseTheme: _2!, accentColor: _3!, outboxAccentColor: _4, messageColors: _5, wallpaper: _6)) + } + else { + return nil + } + } + } +} +public extension Api { + enum Timezone: TypeConstructorDescription { + public class Cons_timezone: TypeConstructorDescription { + public var id: String + public var name: String + public var utcOffset: Int32 + public init(id: String, name: String, utcOffset: Int32) { + self.id = id + self.name = name + self.utcOffset = utcOffset + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("timezone", [("id", ConstructorParameterDescription(self.id)), ("name", ConstructorParameterDescription(self.name)), ("utcOffset", ConstructorParameterDescription(self.utcOffset))]) + } + } + case timezone(Cons_timezone) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .timezone(let _data): + if boxed { + buffer.appendInt32(-7173643) + } + serializeString(_data.id, buffer: buffer, boxed: false) + serializeString(_data.name, buffer: buffer, boxed: false) + serializeInt32(_data.utcOffset, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .timezone(let _data): + return ("timezone", [("id", ConstructorParameterDescription(_data.id)), ("name", ConstructorParameterDescription(_data.name)), ("utcOffset", ConstructorParameterDescription(_data.utcOffset))]) + } + } + + public static func parse_timezone(_ reader: BufferReader) -> Timezone? { + var _1: String? + _1 = parseString(reader) + var _2: String? + _2 = parseString(reader) + var _3: Int32? + _3 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.Timezone.timezone(Cons_timezone(id: _1!, name: _2!, utcOffset: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum TodoCompletion: TypeConstructorDescription { + public class Cons_todoCompletion: TypeConstructorDescription { + public var id: Int32 + public var completedBy: Api.Peer + public var date: Int32 + public init(id: Int32, completedBy: Api.Peer, date: Int32) { + self.id = id + self.completedBy = completedBy + self.date = date + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("todoCompletion", [("id", ConstructorParameterDescription(self.id)), ("completedBy", ConstructorParameterDescription(self.completedBy)), ("date", ConstructorParameterDescription(self.date))]) + } + } + case todoCompletion(Cons_todoCompletion) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .todoCompletion(let _data): + if boxed { + buffer.appendInt32(572241380) + } + serializeInt32(_data.id, buffer: buffer, boxed: false) + _data.completedBy.serialize(buffer, true) + serializeInt32(_data.date, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .todoCompletion(let _data): + return ("todoCompletion", [("id", ConstructorParameterDescription(_data.id)), ("completedBy", ConstructorParameterDescription(_data.completedBy)), ("date", ConstructorParameterDescription(_data.date))]) + } + } + + public static func parse_todoCompletion(_ reader: BufferReader) -> TodoCompletion? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Peer? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _3: Int32? + _3 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.TodoCompletion.todoCompletion(Cons_todoCompletion(id: _1!, completedBy: _2!, date: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum TodoItem: TypeConstructorDescription { + public class Cons_todoItem: TypeConstructorDescription { + public var id: Int32 + public var title: Api.TextWithEntities + public init(id: Int32, title: Api.TextWithEntities) { + self.id = id + self.title = title + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("todoItem", [("id", ConstructorParameterDescription(self.id)), ("title", ConstructorParameterDescription(self.title))]) + } + } + case todoItem(Cons_todoItem) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .todoItem(let _data): + if boxed { + buffer.appendInt32(-878074577) + } + serializeInt32(_data.id, buffer: buffer, boxed: false) + _data.title.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .todoItem(let _data): + return ("todoItem", [("id", ConstructorParameterDescription(_data.id)), ("title", ConstructorParameterDescription(_data.title))]) + } + } + + public static func parse_todoItem(_ reader: BufferReader) -> TodoItem? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.TextWithEntities? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.TodoItem.todoItem(Cons_todoItem(id: _1!, title: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum TodoList: TypeConstructorDescription { + public class Cons_todoList: TypeConstructorDescription { + public var flags: Int32 + public var title: Api.TextWithEntities + public var list: [Api.TodoItem] + public init(flags: Int32, title: Api.TextWithEntities, list: [Api.TodoItem]) { + self.flags = flags + self.title = title + self.list = list + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("todoList", [("flags", ConstructorParameterDescription(self.flags)), ("title", ConstructorParameterDescription(self.title)), ("list", ConstructorParameterDescription(self.list))]) + } + } + case todoList(Cons_todoList) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .todoList(let _data): + if boxed { + buffer.appendInt32(1236871718) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.title.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.list.count)) + for item in _data.list { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .todoList(let _data): + return ("todoList", [("flags", ConstructorParameterDescription(_data.flags)), ("title", ConstructorParameterDescription(_data.title)), ("list", ConstructorParameterDescription(_data.list))]) + } + } + + public static func parse_todoList(_ reader: BufferReader) -> TodoList? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.TextWithEntities? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + var _3: [Api.TodoItem]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TodoItem.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.TodoList.todoList(Cons_todoList(flags: _1!, title: _2!, list: _3!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum TopPeer: TypeConstructorDescription { + public class Cons_topPeer: TypeConstructorDescription { + public var peer: Api.Peer + public var rating: Double + public init(peer: Api.Peer, rating: Double) { + self.peer = peer + self.rating = rating + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("topPeer", [("peer", ConstructorParameterDescription(self.peer)), ("rating", ConstructorParameterDescription(self.rating))]) + } + } + case topPeer(Cons_topPeer) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .topPeer(let _data): + if boxed { + buffer.appendInt32(-305282981) + } + _data.peer.serialize(buffer, true) + serializeDouble(_data.rating, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .topPeer(let _data): + return ("topPeer", [("peer", ConstructorParameterDescription(_data.peer)), ("rating", ConstructorParameterDescription(_data.rating))]) + } + } + + public static func parse_topPeer(_ reader: BufferReader) -> TopPeer? { + var _1: Api.Peer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _2: Double? + _2 = reader.readDouble() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.TopPeer.topPeer(Cons_topPeer(peer: _1!, rating: _2!)) + } + else { + return nil + } + } + } +} +public extension Api { + enum TopPeerCategory: TypeConstructorDescription { + case topPeerCategoryBotsApp + case topPeerCategoryBotsInline + case topPeerCategoryBotsPM + case topPeerCategoryChannels + case topPeerCategoryCorrespondents + case topPeerCategoryForwardChats + case topPeerCategoryForwardUsers + case topPeerCategoryGroups + case topPeerCategoryPhoneCalls + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .topPeerCategoryBotsApp: + if boxed { + buffer.appendInt32(-39945236) + } + break + case .topPeerCategoryBotsInline: + if boxed { + buffer.appendInt32(344356834) + } + break + case .topPeerCategoryBotsPM: + if boxed { + buffer.appendInt32(-1419371685) + } + break + case .topPeerCategoryChannels: + if boxed { + buffer.appendInt32(371037736) + } + break + case .topPeerCategoryCorrespondents: + if boxed { + buffer.appendInt32(104314861) + } + break + case .topPeerCategoryForwardChats: + if boxed { + buffer.appendInt32(-68239120) + } + break + case .topPeerCategoryForwardUsers: + if boxed { + buffer.appendInt32(-1472172887) + } + break + case .topPeerCategoryGroups: + if boxed { + buffer.appendInt32(-1122524854) + } + break + case .topPeerCategoryPhoneCalls: + if boxed { + buffer.appendInt32(511092620) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .topPeerCategoryBotsApp: + return ("topPeerCategoryBotsApp", []) + case .topPeerCategoryBotsInline: + return ("topPeerCategoryBotsInline", []) + case .topPeerCategoryBotsPM: + return ("topPeerCategoryBotsPM", []) + case .topPeerCategoryChannels: + return ("topPeerCategoryChannels", []) + case .topPeerCategoryCorrespondents: + return ("topPeerCategoryCorrespondents", []) + case .topPeerCategoryForwardChats: + return ("topPeerCategoryForwardChats", []) + case .topPeerCategoryForwardUsers: + return ("topPeerCategoryForwardUsers", []) + case .topPeerCategoryGroups: + return ("topPeerCategoryGroups", []) + case .topPeerCategoryPhoneCalls: + return ("topPeerCategoryPhoneCalls", []) + } + } + + public static func parse_topPeerCategoryBotsApp(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryBotsApp + } + public static func parse_topPeerCategoryBotsInline(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryBotsInline + } + public static func parse_topPeerCategoryBotsPM(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryBotsPM + } + public static func parse_topPeerCategoryChannels(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryChannels + } + public static func parse_topPeerCategoryCorrespondents(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryCorrespondents + } + public static func parse_topPeerCategoryForwardChats(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryForwardChats + } + public static func parse_topPeerCategoryForwardUsers(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryForwardUsers + } + public static func parse_topPeerCategoryGroups(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryGroups + } + public static func parse_topPeerCategoryPhoneCalls(_ reader: BufferReader) -> TopPeerCategory? { + return Api.TopPeerCategory.topPeerCategoryPhoneCalls + } + } +} public extension Api { enum TopPeerCategoryPeers: TypeConstructorDescription { public class Cons_topPeerCategoryPeers: TypeConstructorDescription { @@ -175,6 +783,23 @@ public extension Api { return ("updateBotEditBusinessMessage", [("flags", ConstructorParameterDescription(self.flags)), ("connectionId", ConstructorParameterDescription(self.connectionId)), ("message", ConstructorParameterDescription(self.message)), ("replyToMessage", ConstructorParameterDescription(self.replyToMessage)), ("qts", ConstructorParameterDescription(self.qts))]) } } + public class Cons_updateBotGuestChatQuery: TypeConstructorDescription { + public var flags: Int32 + public var queryId: Int64 + public var message: Api.Message + public var referenceMessages: [Api.Message]? + public var qts: Int32 + public init(flags: Int32, queryId: Int64, message: Api.Message, referenceMessages: [Api.Message]?, qts: Int32) { + self.flags = flags + self.queryId = queryId + self.message = message + self.referenceMessages = referenceMessages + self.qts = qts + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("updateBotGuestChatQuery", [("flags", ConstructorParameterDescription(self.flags)), ("queryId", ConstructorParameterDescription(self.queryId)), ("message", ConstructorParameterDescription(self.message)), ("referenceMessages", ConstructorParameterDescription(self.referenceMessages)), ("qts", ConstructorParameterDescription(self.qts))]) + } + } public class Cons_updateBotInlineQuery: TypeConstructorDescription { public var flags: Int32 public var queryId: Int64 @@ -1883,6 +2508,7 @@ public extension Api { return ("updateWebViewResultSent", [("queryId", ConstructorParameterDescription(self.queryId))]) } } + case updateAiComposeTones case updateAttachMenuBots case updateAutoSaveSettings case updateBotBusinessConnect(Cons_updateBotBusinessConnect) @@ -1892,6 +2518,7 @@ public extension Api { case updateBotCommands(Cons_updateBotCommands) case updateBotDeleteBusinessMessage(Cons_updateBotDeleteBusinessMessage) case updateBotEditBusinessMessage(Cons_updateBotEditBusinessMessage) + case updateBotGuestChatQuery(Cons_updateBotGuestChatQuery) case updateBotInlineQuery(Cons_updateBotInlineQuery) case updateBotInlineSend(Cons_updateBotInlineSend) case updateBotMenuButton(Cons_updateBotMenuButton) @@ -2040,6 +2667,11 @@ public extension Api { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { switch self { + case .updateAiComposeTones: + if boxed { + buffer.appendInt32(-1945136645) + } + break case .updateAttachMenuBots: if boxed { buffer.appendInt32(397910539) @@ -2130,6 +2762,22 @@ public extension Api { } serializeInt32(_data.qts, buffer: buffer, boxed: false) break + case .updateBotGuestChatQuery(let _data): + if boxed { + buffer.appendInt32(-841742019) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt64(_data.queryId, buffer: buffer, boxed: false) + _data.message.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 0) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.referenceMessages!.count)) + for item in _data.referenceMessages! { + item.serialize(buffer, true) + } + } + serializeInt32(_data.qts, buffer: buffer, boxed: false) + break case .updateBotInlineQuery(let _data): if boxed { buffer.appendInt32(1232025500) @@ -3485,6 +4133,8 @@ public extension Api { public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { switch self { + case .updateAiComposeTones: + return ("updateAiComposeTones", []) case .updateAttachMenuBots: return ("updateAttachMenuBots", []) case .updateAutoSaveSettings: @@ -3503,6 +4153,8 @@ public extension Api { return ("updateBotDeleteBusinessMessage", [("connectionId", ConstructorParameterDescription(_data.connectionId)), ("peer", ConstructorParameterDescription(_data.peer)), ("messages", ConstructorParameterDescription(_data.messages)), ("qts", ConstructorParameterDescription(_data.qts))]) case .updateBotEditBusinessMessage(let _data): return ("updateBotEditBusinessMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("connectionId", ConstructorParameterDescription(_data.connectionId)), ("message", ConstructorParameterDescription(_data.message)), ("replyToMessage", ConstructorParameterDescription(_data.replyToMessage)), ("qts", ConstructorParameterDescription(_data.qts))]) + case .updateBotGuestChatQuery(let _data): + return ("updateBotGuestChatQuery", [("flags", ConstructorParameterDescription(_data.flags)), ("queryId", ConstructorParameterDescription(_data.queryId)), ("message", ConstructorParameterDescription(_data.message)), ("referenceMessages", ConstructorParameterDescription(_data.referenceMessages)), ("qts", ConstructorParameterDescription(_data.qts))]) case .updateBotInlineQuery(let _data): return ("updateBotInlineQuery", [("flags", ConstructorParameterDescription(_data.flags)), ("queryId", ConstructorParameterDescription(_data.queryId)), ("userId", ConstructorParameterDescription(_data.userId)), ("query", ConstructorParameterDescription(_data.query)), ("geo", ConstructorParameterDescription(_data.geo)), ("peerType", ConstructorParameterDescription(_data.peerType)), ("offset", ConstructorParameterDescription(_data.offset))]) case .updateBotInlineSend(let _data): @@ -3796,6 +4448,9 @@ public extension Api { } } + public static func parse_updateAiComposeTones(_ reader: BufferReader) -> Update? { + return Api.Update.updateAiComposeTones + } public static func parse_updateAttachMenuBots(_ reader: BufferReader) -> Update? { return Api.Update.updateAttachMenuBots } @@ -3981,6 +4636,35 @@ public extension Api { return nil } } + public static func parse_updateBotGuestChatQuery(_ reader: BufferReader) -> Update? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int64? + _2 = reader.readInt64() + var _3: Api.Message? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.Message + } + var _4: [Api.Message]? + if Int(_1!) & Int(1 << 0) != 0 { + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + } + var _5: Int32? + _5 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.Update.updateBotGuestChatQuery(Cons_updateBotGuestChatQuery(flags: _1!, queryId: _2!, message: _3!, referenceMessages: _4, qts: _5!)) + } + else { + return nil + } + } public static func parse_updateBotInlineQuery(_ reader: BufferReader) -> Update? { var _1: Int32? _1 = reader.readInt32() diff --git a/submodules/TelegramApi/Sources/Api3.swift b/submodules/TelegramApi/Sources/Api3.swift index 36621d885d..c35607f21e 100644 --- a/submodules/TelegramApi/Sources/Api3.swift +++ b/submodules/TelegramApi/Sources/Api3.swift @@ -1,3 +1,91 @@ +public extension Api { + enum BusinessChatLink: TypeConstructorDescription { + public class Cons_businessChatLink: TypeConstructorDescription { + public var flags: Int32 + public var link: String + public var message: String + public var entities: [Api.MessageEntity]? + public var title: String? + public var views: Int32 + public init(flags: Int32, link: String, message: String, entities: [Api.MessageEntity]?, title: String?, views: Int32) { + self.flags = flags + self.link = link + self.message = message + self.entities = entities + self.title = title + self.views = views + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("businessChatLink", [("flags", ConstructorParameterDescription(self.flags)), ("link", ConstructorParameterDescription(self.link)), ("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("title", ConstructorParameterDescription(self.title)), ("views", ConstructorParameterDescription(self.views))]) + } + } + case businessChatLink(Cons_businessChatLink) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .businessChatLink(let _data): + if boxed { + buffer.appendInt32(-1263638929) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeString(_data.link, buffer: buffer, boxed: false) + serializeString(_data.message, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.entities!.count)) + for item in _data.entities! { + item.serialize(buffer, true) + } + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.title!, buffer: buffer, boxed: false) + } + serializeInt32(_data.views, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .businessChatLink(let _data): + return ("businessChatLink", [("flags", ConstructorParameterDescription(_data.flags)), ("link", ConstructorParameterDescription(_data.link)), ("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("title", ConstructorParameterDescription(_data.title)), ("views", ConstructorParameterDescription(_data.views))]) + } + } + + public static func parse_businessChatLink(_ reader: BufferReader) -> BusinessChatLink? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: String? + _3 = parseString(reader) + var _4: [Api.MessageEntity]? + if Int(_1!) & Int(1 << 0) != 0 { + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) + } + } + var _5: String? + if Int(_1!) & Int(1 << 1) != 0 { + _5 = parseString(reader) + } + var _6: Int32? + _6 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil + let _c6 = _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.BusinessChatLink.businessChatLink(Cons_businessChatLink(flags: _1!, link: _2!, message: _3!, entities: _4, title: _5, views: _6!)) + } + else { + return nil + } + } + } +} public extension Api { enum BusinessGreetingMessage: TypeConstructorDescription { public class Cons_businessGreetingMessage: TypeConstructorDescription { diff --git a/submodules/TelegramApi/Sources/Api31.swift b/submodules/TelegramApi/Sources/Api31.swift index 46d8b246c9..7990e26ee1 100644 --- a/submodules/TelegramApi/Sources/Api31.swift +++ b/submodules/TelegramApi/Sources/Api31.swift @@ -523,6 +523,73 @@ public extension Api.account { } } } +public extension Api.aicompose { + enum Tones: TypeConstructorDescription { + public class Cons_tones: TypeConstructorDescription { + public var hash: Int64 + public var tones: [Api.AiComposeTone] + public init(hash: Int64, tones: [Api.AiComposeTone]) { + self.hash = hash + self.tones = tones + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("tones", [("hash", ConstructorParameterDescription(self.hash)), ("tones", ConstructorParameterDescription(self.tones))]) + } + } + case tones(Cons_tones) + case tonesNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .tones(let _data): + if boxed { + buffer.appendInt32(1696028994) + } + serializeInt64(_data.hash, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.tones.count)) + for item in _data.tones { + item.serialize(buffer, true) + } + break + case .tonesNotModified: + if boxed { + buffer.appendInt32(-1040948989) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .tones(let _data): + return ("tones", [("hash", ConstructorParameterDescription(_data.hash)), ("tones", ConstructorParameterDescription(_data.tones))]) + case .tonesNotModified: + return ("tonesNotModified", []) + } + } + + public static func parse_tones(_ reader: BufferReader) -> Tones? { + var _1: Int64? + _1 = reader.readInt64() + var _2: [Api.AiComposeTone]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AiComposeTone.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.aicompose.Tones.tones(Cons_tones(hash: _1!, tones: _2!)) + } + else { + return nil + } + } + public static func parse_tonesNotModified(_ reader: BufferReader) -> Tones? { + return Api.aicompose.Tones.tonesNotModified + } + } +} public extension Api.auth { enum Authorization: TypeConstructorDescription { public class Cons_authorization: TypeConstructorDescription { @@ -1196,457 +1263,3 @@ public extension Api.auth { } } } -public extension Api.auth { - enum SentCodeType: TypeConstructorDescription { - public class Cons_sentCodeTypeApp: TypeConstructorDescription { - public var length: Int32 - public init(length: Int32) { - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeApp", [("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeCall: TypeConstructorDescription { - public var length: Int32 - public init(length: Int32) { - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeCall", [("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeEmailCode: TypeConstructorDescription { - public var flags: Int32 - public var emailPattern: String - public var length: Int32 - public var resetAvailablePeriod: Int32? - public var resetPendingDate: Int32? - public init(flags: Int32, emailPattern: String, length: Int32, resetAvailablePeriod: Int32?, resetPendingDate: Int32?) { - self.flags = flags - self.emailPattern = emailPattern - self.length = length - self.resetAvailablePeriod = resetAvailablePeriod - self.resetPendingDate = resetPendingDate - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeEmailCode", [("flags", ConstructorParameterDescription(self.flags)), ("emailPattern", ConstructorParameterDescription(self.emailPattern)), ("length", ConstructorParameterDescription(self.length)), ("resetAvailablePeriod", ConstructorParameterDescription(self.resetAvailablePeriod)), ("resetPendingDate", ConstructorParameterDescription(self.resetPendingDate))]) - } - } - public class Cons_sentCodeTypeFirebaseSms: TypeConstructorDescription { - public var flags: Int32 - public var nonce: Buffer? - public var playIntegrityProjectId: Int64? - public var playIntegrityNonce: Buffer? - public var receipt: String? - public var pushTimeout: Int32? - public var length: Int32 - public init(flags: Int32, nonce: Buffer?, playIntegrityProjectId: Int64?, playIntegrityNonce: Buffer?, receipt: String?, pushTimeout: Int32?, length: Int32) { - self.flags = flags - self.nonce = nonce - self.playIntegrityProjectId = playIntegrityProjectId - self.playIntegrityNonce = playIntegrityNonce - self.receipt = receipt - self.pushTimeout = pushTimeout - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeFirebaseSms", [("flags", ConstructorParameterDescription(self.flags)), ("nonce", ConstructorParameterDescription(self.nonce)), ("playIntegrityProjectId", ConstructorParameterDescription(self.playIntegrityProjectId)), ("playIntegrityNonce", ConstructorParameterDescription(self.playIntegrityNonce)), ("receipt", ConstructorParameterDescription(self.receipt)), ("pushTimeout", ConstructorParameterDescription(self.pushTimeout)), ("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeFlashCall: TypeConstructorDescription { - public var pattern: String - public init(pattern: String) { - self.pattern = pattern - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeFlashCall", [("pattern", ConstructorParameterDescription(self.pattern))]) - } - } - public class Cons_sentCodeTypeFragmentSms: TypeConstructorDescription { - public var url: String - public var length: Int32 - public init(url: String, length: Int32) { - self.url = url - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeFragmentSms", [("url", ConstructorParameterDescription(self.url)), ("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeMissedCall: TypeConstructorDescription { - public var prefix: String - public var length: Int32 - public init(prefix: String, length: Int32) { - self.prefix = prefix - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeMissedCall", [("prefix", ConstructorParameterDescription(self.prefix)), ("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeSetUpEmailRequired: TypeConstructorDescription { - public var flags: Int32 - public init(flags: Int32) { - self.flags = flags - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeSetUpEmailRequired", [("flags", ConstructorParameterDescription(self.flags))]) - } - } - public class Cons_sentCodeTypeSms: TypeConstructorDescription { - public var length: Int32 - public init(length: Int32) { - self.length = length - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeSms", [("length", ConstructorParameterDescription(self.length))]) - } - } - public class Cons_sentCodeTypeSmsPhrase: TypeConstructorDescription { - public var flags: Int32 - public var beginning: String? - public init(flags: Int32, beginning: String?) { - self.flags = flags - self.beginning = beginning - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeSmsPhrase", [("flags", ConstructorParameterDescription(self.flags)), ("beginning", ConstructorParameterDescription(self.beginning))]) - } - } - public class Cons_sentCodeTypeSmsWord: TypeConstructorDescription { - public var flags: Int32 - public var beginning: String? - public init(flags: Int32, beginning: String?) { - self.flags = flags - self.beginning = beginning - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sentCodeTypeSmsWord", [("flags", ConstructorParameterDescription(self.flags)), ("beginning", ConstructorParameterDescription(self.beginning))]) - } - } - case sentCodeTypeApp(Cons_sentCodeTypeApp) - case sentCodeTypeCall(Cons_sentCodeTypeCall) - case sentCodeTypeEmailCode(Cons_sentCodeTypeEmailCode) - case sentCodeTypeFirebaseSms(Cons_sentCodeTypeFirebaseSms) - case sentCodeTypeFlashCall(Cons_sentCodeTypeFlashCall) - case sentCodeTypeFragmentSms(Cons_sentCodeTypeFragmentSms) - case sentCodeTypeMissedCall(Cons_sentCodeTypeMissedCall) - case sentCodeTypeSetUpEmailRequired(Cons_sentCodeTypeSetUpEmailRequired) - case sentCodeTypeSms(Cons_sentCodeTypeSms) - case sentCodeTypeSmsPhrase(Cons_sentCodeTypeSmsPhrase) - case sentCodeTypeSmsWord(Cons_sentCodeTypeSmsWord) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .sentCodeTypeApp(let _data): - if boxed { - buffer.appendInt32(1035688326) - } - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeCall(let _data): - if boxed { - buffer.appendInt32(1398007207) - } - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeEmailCode(let _data): - if boxed { - buffer.appendInt32(-196020837) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.emailPattern, buffer: buffer, boxed: false) - serializeInt32(_data.length, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt32(_data.resetAvailablePeriod!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.resetPendingDate!, buffer: buffer, boxed: false) - } - break - case .sentCodeTypeFirebaseSms(let _data): - if boxed { - buffer.appendInt32(10475318) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeBytes(_data.nonce!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt64(_data.playIntegrityProjectId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeBytes(_data.playIntegrityNonce!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeString(_data.receipt!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.pushTimeout!, buffer: buffer, boxed: false) - } - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeFlashCall(let _data): - if boxed { - buffer.appendInt32(-1425815847) - } - serializeString(_data.pattern, buffer: buffer, boxed: false) - break - case .sentCodeTypeFragmentSms(let _data): - if boxed { - buffer.appendInt32(-648651719) - } - serializeString(_data.url, buffer: buffer, boxed: false) - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeMissedCall(let _data): - if boxed { - buffer.appendInt32(-2113903484) - } - serializeString(_data.prefix, buffer: buffer, boxed: false) - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeSetUpEmailRequired(let _data): - if boxed { - buffer.appendInt32(-1521934870) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - break - case .sentCodeTypeSms(let _data): - if boxed { - buffer.appendInt32(-1073693790) - } - serializeInt32(_data.length, buffer: buffer, boxed: false) - break - case .sentCodeTypeSmsPhrase(let _data): - if boxed { - buffer.appendInt32(-1284008785) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.beginning!, buffer: buffer, boxed: false) - } - break - case .sentCodeTypeSmsWord(let _data): - if boxed { - buffer.appendInt32(-1542017919) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.beginning!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .sentCodeTypeApp(let _data): - return ("sentCodeTypeApp", [("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeCall(let _data): - return ("sentCodeTypeCall", [("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeEmailCode(let _data): - return ("sentCodeTypeEmailCode", [("flags", ConstructorParameterDescription(_data.flags)), ("emailPattern", ConstructorParameterDescription(_data.emailPattern)), ("length", ConstructorParameterDescription(_data.length)), ("resetAvailablePeriod", ConstructorParameterDescription(_data.resetAvailablePeriod)), ("resetPendingDate", ConstructorParameterDescription(_data.resetPendingDate))]) - case .sentCodeTypeFirebaseSms(let _data): - return ("sentCodeTypeFirebaseSms", [("flags", ConstructorParameterDescription(_data.flags)), ("nonce", ConstructorParameterDescription(_data.nonce)), ("playIntegrityProjectId", ConstructorParameterDescription(_data.playIntegrityProjectId)), ("playIntegrityNonce", ConstructorParameterDescription(_data.playIntegrityNonce)), ("receipt", ConstructorParameterDescription(_data.receipt)), ("pushTimeout", ConstructorParameterDescription(_data.pushTimeout)), ("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeFlashCall(let _data): - return ("sentCodeTypeFlashCall", [("pattern", ConstructorParameterDescription(_data.pattern))]) - case .sentCodeTypeFragmentSms(let _data): - return ("sentCodeTypeFragmentSms", [("url", ConstructorParameterDescription(_data.url)), ("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeMissedCall(let _data): - return ("sentCodeTypeMissedCall", [("prefix", ConstructorParameterDescription(_data.prefix)), ("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeSetUpEmailRequired(let _data): - return ("sentCodeTypeSetUpEmailRequired", [("flags", ConstructorParameterDescription(_data.flags))]) - case .sentCodeTypeSms(let _data): - return ("sentCodeTypeSms", [("length", ConstructorParameterDescription(_data.length))]) - case .sentCodeTypeSmsPhrase(let _data): - return ("sentCodeTypeSmsPhrase", [("flags", ConstructorParameterDescription(_data.flags)), ("beginning", ConstructorParameterDescription(_data.beginning))]) - case .sentCodeTypeSmsWord(let _data): - return ("sentCodeTypeSmsWord", [("flags", ConstructorParameterDescription(_data.flags)), ("beginning", ConstructorParameterDescription(_data.beginning))]) - } - } - - public static func parse_sentCodeTypeApp(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.auth.SentCodeType.sentCodeTypeApp(Cons_sentCodeTypeApp(length: _1!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeCall(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.auth.SentCodeType.sentCodeTypeCall(Cons_sentCodeTypeCall(length: _1!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeEmailCode(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: Int32? - _3 = reader.readInt32() - var _4: Int32? - if Int(_1!) & Int(1 << 3) != 0 { - _4 = reader.readInt32() - } - var _5: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _5 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.auth.SentCodeType.sentCodeTypeEmailCode(Cons_sentCodeTypeEmailCode(flags: _1!, emailPattern: _2!, length: _3!, resetAvailablePeriod: _4, resetPendingDate: _5)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeFirebaseSms(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Buffer? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = parseBytes(reader) - } - var _3: Int64? - if Int(_1!) & Int(1 << 2) != 0 { - _3 = reader.readInt64() - } - var _4: Buffer? - if Int(_1!) & Int(1 << 2) != 0 { - _4 = parseBytes(reader) - } - var _5: String? - if Int(_1!) & Int(1 << 1) != 0 { - _5 = parseString(reader) - } - var _6: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _6 = reader.readInt32() - } - var _7: Int32? - _7 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil - let _c7 = _7 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { - return Api.auth.SentCodeType.sentCodeTypeFirebaseSms(Cons_sentCodeTypeFirebaseSms(flags: _1!, nonce: _2, playIntegrityProjectId: _3, playIntegrityNonce: _4, receipt: _5, pushTimeout: _6, length: _7!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeFlashCall(_ reader: BufferReader) -> SentCodeType? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.auth.SentCodeType.sentCodeTypeFlashCall(Cons_sentCodeTypeFlashCall(pattern: _1!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeFragmentSms(_ reader: BufferReader) -> SentCodeType? { - var _1: String? - _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.auth.SentCodeType.sentCodeTypeFragmentSms(Cons_sentCodeTypeFragmentSms(url: _1!, length: _2!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeMissedCall(_ reader: BufferReader) -> SentCodeType? { - var _1: String? - _1 = parseString(reader) - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.auth.SentCodeType.sentCodeTypeMissedCall(Cons_sentCodeTypeMissedCall(prefix: _1!, length: _2!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeSetUpEmailRequired(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.auth.SentCodeType.sentCodeTypeSetUpEmailRequired(Cons_sentCodeTypeSetUpEmailRequired(flags: _1!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeSms(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.auth.SentCodeType.sentCodeTypeSms(Cons_sentCodeTypeSms(length: _1!)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeSmsPhrase(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - if _c1 && _c2 { - return Api.auth.SentCodeType.sentCodeTypeSmsPhrase(Cons_sentCodeTypeSmsPhrase(flags: _1!, beginning: _2)) - } - else { - return nil - } - } - public static func parse_sentCodeTypeSmsWord(_ reader: BufferReader) -> SentCodeType? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - if _c1 && _c2 { - return Api.auth.SentCodeType.sentCodeTypeSmsWord(Cons_sentCodeTypeSmsWord(flags: _1!, beginning: _2)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api32.swift b/submodules/TelegramApi/Sources/Api32.swift index c188d6b7db..3445d1c8c8 100644 --- a/submodules/TelegramApi/Sources/Api32.swift +++ b/submodules/TelegramApi/Sources/Api32.swift @@ -1,3 +1,457 @@ +public extension Api.auth { + enum SentCodeType: TypeConstructorDescription { + public class Cons_sentCodeTypeApp: TypeConstructorDescription { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeApp", [("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeCall: TypeConstructorDescription { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeCall", [("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeEmailCode: TypeConstructorDescription { + public var flags: Int32 + public var emailPattern: String + public var length: Int32 + public var resetAvailablePeriod: Int32? + public var resetPendingDate: Int32? + public init(flags: Int32, emailPattern: String, length: Int32, resetAvailablePeriod: Int32?, resetPendingDate: Int32?) { + self.flags = flags + self.emailPattern = emailPattern + self.length = length + self.resetAvailablePeriod = resetAvailablePeriod + self.resetPendingDate = resetPendingDate + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeEmailCode", [("flags", ConstructorParameterDescription(self.flags)), ("emailPattern", ConstructorParameterDescription(self.emailPattern)), ("length", ConstructorParameterDescription(self.length)), ("resetAvailablePeriod", ConstructorParameterDescription(self.resetAvailablePeriod)), ("resetPendingDate", ConstructorParameterDescription(self.resetPendingDate))]) + } + } + public class Cons_sentCodeTypeFirebaseSms: TypeConstructorDescription { + public var flags: Int32 + public var nonce: Buffer? + public var playIntegrityProjectId: Int64? + public var playIntegrityNonce: Buffer? + public var receipt: String? + public var pushTimeout: Int32? + public var length: Int32 + public init(flags: Int32, nonce: Buffer?, playIntegrityProjectId: Int64?, playIntegrityNonce: Buffer?, receipt: String?, pushTimeout: Int32?, length: Int32) { + self.flags = flags + self.nonce = nonce + self.playIntegrityProjectId = playIntegrityProjectId + self.playIntegrityNonce = playIntegrityNonce + self.receipt = receipt + self.pushTimeout = pushTimeout + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeFirebaseSms", [("flags", ConstructorParameterDescription(self.flags)), ("nonce", ConstructorParameterDescription(self.nonce)), ("playIntegrityProjectId", ConstructorParameterDescription(self.playIntegrityProjectId)), ("playIntegrityNonce", ConstructorParameterDescription(self.playIntegrityNonce)), ("receipt", ConstructorParameterDescription(self.receipt)), ("pushTimeout", ConstructorParameterDescription(self.pushTimeout)), ("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeFlashCall: TypeConstructorDescription { + public var pattern: String + public init(pattern: String) { + self.pattern = pattern + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeFlashCall", [("pattern", ConstructorParameterDescription(self.pattern))]) + } + } + public class Cons_sentCodeTypeFragmentSms: TypeConstructorDescription { + public var url: String + public var length: Int32 + public init(url: String, length: Int32) { + self.url = url + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeFragmentSms", [("url", ConstructorParameterDescription(self.url)), ("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeMissedCall: TypeConstructorDescription { + public var prefix: String + public var length: Int32 + public init(prefix: String, length: Int32) { + self.prefix = prefix + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeMissedCall", [("prefix", ConstructorParameterDescription(self.prefix)), ("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeSetUpEmailRequired: TypeConstructorDescription { + public var flags: Int32 + public init(flags: Int32) { + self.flags = flags + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeSetUpEmailRequired", [("flags", ConstructorParameterDescription(self.flags))]) + } + } + public class Cons_sentCodeTypeSms: TypeConstructorDescription { + public var length: Int32 + public init(length: Int32) { + self.length = length + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeSms", [("length", ConstructorParameterDescription(self.length))]) + } + } + public class Cons_sentCodeTypeSmsPhrase: TypeConstructorDescription { + public var flags: Int32 + public var beginning: String? + public init(flags: Int32, beginning: String?) { + self.flags = flags + self.beginning = beginning + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeSmsPhrase", [("flags", ConstructorParameterDescription(self.flags)), ("beginning", ConstructorParameterDescription(self.beginning))]) + } + } + public class Cons_sentCodeTypeSmsWord: TypeConstructorDescription { + public var flags: Int32 + public var beginning: String? + public init(flags: Int32, beginning: String?) { + self.flags = flags + self.beginning = beginning + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sentCodeTypeSmsWord", [("flags", ConstructorParameterDescription(self.flags)), ("beginning", ConstructorParameterDescription(self.beginning))]) + } + } + case sentCodeTypeApp(Cons_sentCodeTypeApp) + case sentCodeTypeCall(Cons_sentCodeTypeCall) + case sentCodeTypeEmailCode(Cons_sentCodeTypeEmailCode) + case sentCodeTypeFirebaseSms(Cons_sentCodeTypeFirebaseSms) + case sentCodeTypeFlashCall(Cons_sentCodeTypeFlashCall) + case sentCodeTypeFragmentSms(Cons_sentCodeTypeFragmentSms) + case sentCodeTypeMissedCall(Cons_sentCodeTypeMissedCall) + case sentCodeTypeSetUpEmailRequired(Cons_sentCodeTypeSetUpEmailRequired) + case sentCodeTypeSms(Cons_sentCodeTypeSms) + case sentCodeTypeSmsPhrase(Cons_sentCodeTypeSmsPhrase) + case sentCodeTypeSmsWord(Cons_sentCodeTypeSmsWord) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .sentCodeTypeApp(let _data): + if boxed { + buffer.appendInt32(1035688326) + } + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeCall(let _data): + if boxed { + buffer.appendInt32(1398007207) + } + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeEmailCode(let _data): + if boxed { + buffer.appendInt32(-196020837) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeString(_data.emailPattern, buffer: buffer, boxed: false) + serializeInt32(_data.length, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.resetAvailablePeriod!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.resetPendingDate!, buffer: buffer, boxed: false) + } + break + case .sentCodeTypeFirebaseSms(let _data): + if boxed { + buffer.appendInt32(10475318) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeBytes(_data.nonce!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt64(_data.playIntegrityProjectId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeBytes(_data.playIntegrityNonce!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeString(_data.receipt!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.pushTimeout!, buffer: buffer, boxed: false) + } + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeFlashCall(let _data): + if boxed { + buffer.appendInt32(-1425815847) + } + serializeString(_data.pattern, buffer: buffer, boxed: false) + break + case .sentCodeTypeFragmentSms(let _data): + if boxed { + buffer.appendInt32(-648651719) + } + serializeString(_data.url, buffer: buffer, boxed: false) + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeMissedCall(let _data): + if boxed { + buffer.appendInt32(-2113903484) + } + serializeString(_data.prefix, buffer: buffer, boxed: false) + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeSetUpEmailRequired(let _data): + if boxed { + buffer.appendInt32(-1521934870) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + break + case .sentCodeTypeSms(let _data): + if boxed { + buffer.appendInt32(-1073693790) + } + serializeInt32(_data.length, buffer: buffer, boxed: false) + break + case .sentCodeTypeSmsPhrase(let _data): + if boxed { + buffer.appendInt32(-1284008785) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.beginning!, buffer: buffer, boxed: false) + } + break + case .sentCodeTypeSmsWord(let _data): + if boxed { + buffer.appendInt32(-1542017919) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.beginning!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .sentCodeTypeApp(let _data): + return ("sentCodeTypeApp", [("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeCall(let _data): + return ("sentCodeTypeCall", [("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeEmailCode(let _data): + return ("sentCodeTypeEmailCode", [("flags", ConstructorParameterDescription(_data.flags)), ("emailPattern", ConstructorParameterDescription(_data.emailPattern)), ("length", ConstructorParameterDescription(_data.length)), ("resetAvailablePeriod", ConstructorParameterDescription(_data.resetAvailablePeriod)), ("resetPendingDate", ConstructorParameterDescription(_data.resetPendingDate))]) + case .sentCodeTypeFirebaseSms(let _data): + return ("sentCodeTypeFirebaseSms", [("flags", ConstructorParameterDescription(_data.flags)), ("nonce", ConstructorParameterDescription(_data.nonce)), ("playIntegrityProjectId", ConstructorParameterDescription(_data.playIntegrityProjectId)), ("playIntegrityNonce", ConstructorParameterDescription(_data.playIntegrityNonce)), ("receipt", ConstructorParameterDescription(_data.receipt)), ("pushTimeout", ConstructorParameterDescription(_data.pushTimeout)), ("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeFlashCall(let _data): + return ("sentCodeTypeFlashCall", [("pattern", ConstructorParameterDescription(_data.pattern))]) + case .sentCodeTypeFragmentSms(let _data): + return ("sentCodeTypeFragmentSms", [("url", ConstructorParameterDescription(_data.url)), ("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeMissedCall(let _data): + return ("sentCodeTypeMissedCall", [("prefix", ConstructorParameterDescription(_data.prefix)), ("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeSetUpEmailRequired(let _data): + return ("sentCodeTypeSetUpEmailRequired", [("flags", ConstructorParameterDescription(_data.flags))]) + case .sentCodeTypeSms(let _data): + return ("sentCodeTypeSms", [("length", ConstructorParameterDescription(_data.length))]) + case .sentCodeTypeSmsPhrase(let _data): + return ("sentCodeTypeSmsPhrase", [("flags", ConstructorParameterDescription(_data.flags)), ("beginning", ConstructorParameterDescription(_data.beginning))]) + case .sentCodeTypeSmsWord(let _data): + return ("sentCodeTypeSmsWord", [("flags", ConstructorParameterDescription(_data.flags)), ("beginning", ConstructorParameterDescription(_data.beginning))]) + } + } + + public static func parse_sentCodeTypeApp(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.auth.SentCodeType.sentCodeTypeApp(Cons_sentCodeTypeApp(length: _1!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeCall(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.auth.SentCodeType.sentCodeTypeCall(Cons_sentCodeTypeCall(length: _1!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeEmailCode(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: Int32? + _3 = reader.readInt32() + var _4: Int32? + if Int(_1!) & Int(1 << 3) != 0 { + _4 = reader.readInt32() + } + var _5: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _5 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.auth.SentCodeType.sentCodeTypeEmailCode(Cons_sentCodeTypeEmailCode(flags: _1!, emailPattern: _2!, length: _3!, resetAvailablePeriod: _4, resetPendingDate: _5)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeFirebaseSms(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Buffer? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = parseBytes(reader) + } + var _3: Int64? + if Int(_1!) & Int(1 << 2) != 0 { + _3 = reader.readInt64() + } + var _4: Buffer? + if Int(_1!) & Int(1 << 2) != 0 { + _4 = parseBytes(reader) + } + var _5: String? + if Int(_1!) & Int(1 << 1) != 0 { + _5 = parseString(reader) + } + var _6: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _6 = reader.readInt32() + } + var _7: Int32? + _7 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 2) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil + let _c7 = _7 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 { + return Api.auth.SentCodeType.sentCodeTypeFirebaseSms(Cons_sentCodeTypeFirebaseSms(flags: _1!, nonce: _2, playIntegrityProjectId: _3, playIntegrityNonce: _4, receipt: _5, pushTimeout: _6, length: _7!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeFlashCall(_ reader: BufferReader) -> SentCodeType? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.auth.SentCodeType.sentCodeTypeFlashCall(Cons_sentCodeTypeFlashCall(pattern: _1!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeFragmentSms(_ reader: BufferReader) -> SentCodeType? { + var _1: String? + _1 = parseString(reader) + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.auth.SentCodeType.sentCodeTypeFragmentSms(Cons_sentCodeTypeFragmentSms(url: _1!, length: _2!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeMissedCall(_ reader: BufferReader) -> SentCodeType? { + var _1: String? + _1 = parseString(reader) + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.auth.SentCodeType.sentCodeTypeMissedCall(Cons_sentCodeTypeMissedCall(prefix: _1!, length: _2!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeSetUpEmailRequired(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.auth.SentCodeType.sentCodeTypeSetUpEmailRequired(Cons_sentCodeTypeSetUpEmailRequired(flags: _1!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeSms(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.auth.SentCodeType.sentCodeTypeSms(Cons_sentCodeTypeSms(length: _1!)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeSmsPhrase(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + if _c1 && _c2 { + return Api.auth.SentCodeType.sentCodeTypeSmsPhrase(Cons_sentCodeTypeSmsPhrase(flags: _1!, beginning: _2)) + } + else { + return nil + } + } + public static func parse_sentCodeTypeSmsWord(_ reader: BufferReader) -> SentCodeType? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + if _c1 && _c2 { + return Api.auth.SentCodeType.sentCodeTypeSmsWord(Cons_sentCodeTypeSmsWord(flags: _1!, beginning: _2)) + } + else { + return nil + } + } + } +} public extension Api.bots { enum BotInfo: TypeConstructorDescription { public class Cons_botInfo: TypeConstructorDescription { @@ -505,6 +959,170 @@ public extension Api.channels { } } } +public extension Api.channels { + enum Found: TypeConstructorDescription { + public class Cons_found: TypeConstructorDescription { + public var flags: Int32 + public var results: [Api.Peer] + public var chats: [Api.Chat] + public var users: [Api.User] + public var nextOffset: String? + public init(flags: Int32, results: [Api.Peer], chats: [Api.Chat], users: [Api.User], nextOffset: String?) { + self.flags = flags + self.results = results + self.chats = chats + self.users = users + self.nextOffset = nextOffset + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("found", [("flags", ConstructorParameterDescription(self.flags)), ("results", ConstructorParameterDescription(self.results)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))]) + } + } + case found(Cons_found) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .found(let _data): + if boxed { + buffer.appendInt32(824755388) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.results.count)) + for item in _data.results { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.nextOffset!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .found(let _data): + return ("found", [("flags", ConstructorParameterDescription(_data.flags)), ("results", ConstructorParameterDescription(_data.results)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))]) + } + } + + public static func parse_found(_ reader: BufferReader) -> Found? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.Peer]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) + } + var _3: [Api.Chat]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + var _5: String? + if Int(_1!) & Int(1 << 0) != 0 { + _5 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.channels.Found.found(Cons_found(flags: _1!, results: _2!, chats: _3!, users: _4!, nextOffset: _5)) + } + else { + return nil + } + } + } +} +public extension Api.channels { + enum PersonalChannels: TypeConstructorDescription { + public class Cons_personalChannels: TypeConstructorDescription { + public var channels: [Api.PersonalChannel] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(channels: [Api.PersonalChannel], chats: [Api.Chat], users: [Api.User]) { + self.channels = channels + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("personalChannels", [("channels", ConstructorParameterDescription(self.channels)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case personalChannels(Cons_personalChannels) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .personalChannels(let _data): + if boxed { + buffer.appendInt32(-694491059) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.channels.count)) + for item in _data.channels { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .personalChannels(let _data): + return ("personalChannels", [("channels", ConstructorParameterDescription(_data.channels)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_personalChannels(_ reader: BufferReader) -> PersonalChannels? { + var _1: [Api.PersonalChannel]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PersonalChannel.self) + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.channels.PersonalChannels.personalChannels(Cons_personalChannels(channels: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} public extension Api.channels { enum SendAsPeers: TypeConstructorDescription { public class Cons_sendAsPeers: TypeConstructorDescription { @@ -1173,641 +1791,3 @@ public extension Api.contacts { } } } -public extension Api.contacts { - enum ContactBirthdays: TypeConstructorDescription { - public class Cons_contactBirthdays: TypeConstructorDescription { - public var contacts: [Api.ContactBirthday] - public var users: [Api.User] - public init(contacts: [Api.ContactBirthday], users: [Api.User]) { - self.contacts = contacts - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("contactBirthdays", [("contacts", ConstructorParameterDescription(self.contacts)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case contactBirthdays(Cons_contactBirthdays) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .contactBirthdays(let _data): - if boxed { - buffer.appendInt32(290452237) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.contacts.count)) - for item in _data.contacts { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .contactBirthdays(let _data): - return ("contactBirthdays", [("contacts", ConstructorParameterDescription(_data.contacts)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_contactBirthdays(_ reader: BufferReader) -> ContactBirthdays? { - var _1: [Api.ContactBirthday]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ContactBirthday.self) - } - var _2: [Api.User]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.contacts.ContactBirthdays.contactBirthdays(Cons_contactBirthdays(contacts: _1!, users: _2!)) - } - else { - return nil - } - } - } -} -public extension Api.contacts { - enum Contacts: TypeConstructorDescription { - public class Cons_contacts: TypeConstructorDescription { - public var contacts: [Api.Contact] - public var savedCount: Int32 - public var users: [Api.User] - public init(contacts: [Api.Contact], savedCount: Int32, users: [Api.User]) { - self.contacts = contacts - self.savedCount = savedCount - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("contacts", [("contacts", ConstructorParameterDescription(self.contacts)), ("savedCount", ConstructorParameterDescription(self.savedCount)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case contacts(Cons_contacts) - case contactsNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .contacts(let _data): - if boxed { - buffer.appendInt32(-353862078) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.contacts.count)) - for item in _data.contacts { - item.serialize(buffer, true) - } - serializeInt32(_data.savedCount, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .contactsNotModified: - if boxed { - buffer.appendInt32(-1219778094) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .contacts(let _data): - return ("contacts", [("contacts", ConstructorParameterDescription(_data.contacts)), ("savedCount", ConstructorParameterDescription(_data.savedCount)), ("users", ConstructorParameterDescription(_data.users))]) - case .contactsNotModified: - return ("contactsNotModified", []) - } - } - - public static func parse_contacts(_ reader: BufferReader) -> Contacts? { - var _1: [Api.Contact]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Contact.self) - } - var _2: Int32? - _2 = reader.readInt32() - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.contacts.Contacts.contacts(Cons_contacts(contacts: _1!, savedCount: _2!, users: _3!)) - } - else { - return nil - } - } - public static func parse_contactsNotModified(_ reader: BufferReader) -> Contacts? { - return Api.contacts.Contacts.contactsNotModified - } - } -} -public extension Api.contacts { - enum Found: TypeConstructorDescription { - public class Cons_found: TypeConstructorDescription { - public var myResults: [Api.Peer] - public var results: [Api.Peer] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User]) { - self.myResults = myResults - self.results = results - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("found", [("myResults", ConstructorParameterDescription(self.myResults)), ("results", ConstructorParameterDescription(self.results)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case found(Cons_found) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .found(let _data): - if boxed { - buffer.appendInt32(-1290580579) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.myResults.count)) - for item in _data.myResults { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.results.count)) - for item in _data.results { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .found(let _data): - return ("found", [("myResults", ConstructorParameterDescription(_data.myResults)), ("results", ConstructorParameterDescription(_data.results)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_found(_ reader: BufferReader) -> Found? { - var _1: [Api.Peer]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) - } - var _2: [Api.Peer]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) - } - var _3: [Api.Chat]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.contacts.Found.found(Cons_found(myResults: _1!, results: _2!, chats: _3!, users: _4!)) - } - else { - return nil - } - } - } -} -public extension Api.contacts { - enum ImportedContacts: TypeConstructorDescription { - public class Cons_importedContacts: TypeConstructorDescription { - public var imported: [Api.ImportedContact] - public var popularInvites: [Api.PopularContact] - public var retryContacts: [Int64] - public var users: [Api.User] - public init(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User]) { - self.imported = imported - self.popularInvites = popularInvites - self.retryContacts = retryContacts - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("importedContacts", [("imported", ConstructorParameterDescription(self.imported)), ("popularInvites", ConstructorParameterDescription(self.popularInvites)), ("retryContacts", ConstructorParameterDescription(self.retryContacts)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case importedContacts(Cons_importedContacts) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .importedContacts(let _data): - if boxed { - buffer.appendInt32(2010127419) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.imported.count)) - for item in _data.imported { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.popularInvites.count)) - for item in _data.popularInvites { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.retryContacts.count)) - for item in _data.retryContacts { - serializeInt64(item, buffer: buffer, boxed: false) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .importedContacts(let _data): - return ("importedContacts", [("imported", ConstructorParameterDescription(_data.imported)), ("popularInvites", ConstructorParameterDescription(_data.popularInvites)), ("retryContacts", ConstructorParameterDescription(_data.retryContacts)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_importedContacts(_ reader: BufferReader) -> ImportedContacts? { - var _1: [Api.ImportedContact]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ImportedContact.self) - } - var _2: [Api.PopularContact]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PopularContact.self) - } - var _3: [Int64]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.contacts.ImportedContacts.importedContacts(Cons_importedContacts(imported: _1!, popularInvites: _2!, retryContacts: _3!, users: _4!)) - } - else { - return nil - } - } - } -} -public extension Api.contacts { - enum ResolvedPeer: TypeConstructorDescription { - public class Cons_resolvedPeer: TypeConstructorDescription { - public var peer: Api.Peer - public var chats: [Api.Chat] - public var users: [Api.User] - public init(peer: Api.Peer, chats: [Api.Chat], users: [Api.User]) { - self.peer = peer - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("resolvedPeer", [("peer", ConstructorParameterDescription(self.peer)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case resolvedPeer(Cons_resolvedPeer) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .resolvedPeer(let _data): - if boxed { - buffer.appendInt32(2131196633) - } - _data.peer.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .resolvedPeer(let _data): - return ("resolvedPeer", [("peer", ConstructorParameterDescription(_data.peer)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_resolvedPeer(_ reader: BufferReader) -> ResolvedPeer? { - var _1: Api.Peer? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.Peer - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.contacts.ResolvedPeer.resolvedPeer(Cons_resolvedPeer(peer: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.contacts { - enum SponsoredPeers: TypeConstructorDescription { - public class Cons_sponsoredPeers: TypeConstructorDescription { - public var peers: [Api.SponsoredPeer] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(peers: [Api.SponsoredPeer], chats: [Api.Chat], users: [Api.User]) { - self.peers = peers - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("sponsoredPeers", [("peers", ConstructorParameterDescription(self.peers)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case sponsoredPeers(Cons_sponsoredPeers) - case sponsoredPeersEmpty - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .sponsoredPeers(let _data): - if boxed { - buffer.appendInt32(-352114556) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.peers.count)) - for item in _data.peers { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .sponsoredPeersEmpty: - if boxed { - buffer.appendInt32(-365775695) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .sponsoredPeers(let _data): - return ("sponsoredPeers", [("peers", ConstructorParameterDescription(_data.peers)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - case .sponsoredPeersEmpty: - return ("sponsoredPeersEmpty", []) - } - } - - public static func parse_sponsoredPeers(_ reader: BufferReader) -> SponsoredPeers? { - var _1: [Api.SponsoredPeer]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SponsoredPeer.self) - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.contacts.SponsoredPeers.sponsoredPeers(Cons_sponsoredPeers(peers: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - public static func parse_sponsoredPeersEmpty(_ reader: BufferReader) -> SponsoredPeers? { - return Api.contacts.SponsoredPeers.sponsoredPeersEmpty - } - } -} -public extension Api.contacts { - enum TopPeers: TypeConstructorDescription { - public class Cons_topPeers: TypeConstructorDescription { - public var categories: [Api.TopPeerCategoryPeers] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User]) { - self.categories = categories - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("topPeers", [("categories", ConstructorParameterDescription(self.categories)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case topPeers(Cons_topPeers) - case topPeersDisabled - case topPeersNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .topPeers(let _data): - if boxed { - buffer.appendInt32(1891070632) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.categories.count)) - for item in _data.categories { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .topPeersDisabled: - if boxed { - buffer.appendInt32(-1255369827) - } - break - case .topPeersNotModified: - if boxed { - buffer.appendInt32(-567906571) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .topPeers(let _data): - return ("topPeers", [("categories", ConstructorParameterDescription(_data.categories)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - case .topPeersDisabled: - return ("topPeersDisabled", []) - case .topPeersNotModified: - return ("topPeersNotModified", []) - } - } - - public static func parse_topPeers(_ reader: BufferReader) -> TopPeers? { - var _1: [Api.TopPeerCategoryPeers]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TopPeerCategoryPeers.self) - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.contacts.TopPeers.topPeers(Cons_topPeers(categories: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - public static func parse_topPeersDisabled(_ reader: BufferReader) -> TopPeers? { - return Api.contacts.TopPeers.topPeersDisabled - } - public static func parse_topPeersNotModified(_ reader: BufferReader) -> TopPeers? { - return Api.contacts.TopPeers.topPeersNotModified - } - } -} -public extension Api.fragment { - enum CollectibleInfo: TypeConstructorDescription { - public class Cons_collectibleInfo: TypeConstructorDescription { - public var purchaseDate: Int32 - public var currency: String - public var amount: Int64 - public var cryptoCurrency: String - public var cryptoAmount: Int64 - public var url: String - public init(purchaseDate: Int32, currency: String, amount: Int64, cryptoCurrency: String, cryptoAmount: Int64, url: String) { - self.purchaseDate = purchaseDate - self.currency = currency - self.amount = amount - self.cryptoCurrency = cryptoCurrency - self.cryptoAmount = cryptoAmount - self.url = url - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("collectibleInfo", [("purchaseDate", ConstructorParameterDescription(self.purchaseDate)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("cryptoCurrency", ConstructorParameterDescription(self.cryptoCurrency)), ("cryptoAmount", ConstructorParameterDescription(self.cryptoAmount)), ("url", ConstructorParameterDescription(self.url))]) - } - } - case collectibleInfo(Cons_collectibleInfo) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .collectibleInfo(let _data): - if boxed { - buffer.appendInt32(1857945489) - } - serializeInt32(_data.purchaseDate, buffer: buffer, boxed: false) - serializeString(_data.currency, buffer: buffer, boxed: false) - serializeInt64(_data.amount, buffer: buffer, boxed: false) - serializeString(_data.cryptoCurrency, buffer: buffer, boxed: false) - serializeInt64(_data.cryptoAmount, buffer: buffer, boxed: false) - serializeString(_data.url, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .collectibleInfo(let _data): - return ("collectibleInfo", [("purchaseDate", ConstructorParameterDescription(_data.purchaseDate)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("cryptoCurrency", ConstructorParameterDescription(_data.cryptoCurrency)), ("cryptoAmount", ConstructorParameterDescription(_data.cryptoAmount)), ("url", ConstructorParameterDescription(_data.url))]) - } - } - - public static func parse_collectibleInfo(_ reader: BufferReader) -> CollectibleInfo? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: Int64? - _3 = reader.readInt64() - var _4: String? - _4 = parseString(reader) - var _5: Int64? - _5 = reader.readInt64() - var _6: String? - _6 = parseString(reader) - 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.fragment.CollectibleInfo.collectibleInfo(Cons_collectibleInfo(purchaseDate: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, url: _6!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api33.swift b/submodules/TelegramApi/Sources/Api33.swift index d3b185ee7f..826344f32c 100644 --- a/submodules/TelegramApi/Sources/Api33.swift +++ b/submodules/TelegramApi/Sources/Api33.swift @@ -1,3 +1,641 @@ +public extension Api.contacts { + enum ContactBirthdays: TypeConstructorDescription { + public class Cons_contactBirthdays: TypeConstructorDescription { + public var contacts: [Api.ContactBirthday] + public var users: [Api.User] + public init(contacts: [Api.ContactBirthday], users: [Api.User]) { + self.contacts = contacts + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("contactBirthdays", [("contacts", ConstructorParameterDescription(self.contacts)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case contactBirthdays(Cons_contactBirthdays) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .contactBirthdays(let _data): + if boxed { + buffer.appendInt32(290452237) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.contacts.count)) + for item in _data.contacts { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .contactBirthdays(let _data): + return ("contactBirthdays", [("contacts", ConstructorParameterDescription(_data.contacts)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_contactBirthdays(_ reader: BufferReader) -> ContactBirthdays? { + var _1: [Api.ContactBirthday]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ContactBirthday.self) + } + var _2: [Api.User]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.contacts.ContactBirthdays.contactBirthdays(Cons_contactBirthdays(contacts: _1!, users: _2!)) + } + else { + return nil + } + } + } +} +public extension Api.contacts { + enum Contacts: TypeConstructorDescription { + public class Cons_contacts: TypeConstructorDescription { + public var contacts: [Api.Contact] + public var savedCount: Int32 + public var users: [Api.User] + public init(contacts: [Api.Contact], savedCount: Int32, users: [Api.User]) { + self.contacts = contacts + self.savedCount = savedCount + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("contacts", [("contacts", ConstructorParameterDescription(self.contacts)), ("savedCount", ConstructorParameterDescription(self.savedCount)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case contacts(Cons_contacts) + case contactsNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .contacts(let _data): + if boxed { + buffer.appendInt32(-353862078) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.contacts.count)) + for item in _data.contacts { + item.serialize(buffer, true) + } + serializeInt32(_data.savedCount, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .contactsNotModified: + if boxed { + buffer.appendInt32(-1219778094) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .contacts(let _data): + return ("contacts", [("contacts", ConstructorParameterDescription(_data.contacts)), ("savedCount", ConstructorParameterDescription(_data.savedCount)), ("users", ConstructorParameterDescription(_data.users))]) + case .contactsNotModified: + return ("contactsNotModified", []) + } + } + + public static func parse_contacts(_ reader: BufferReader) -> Contacts? { + var _1: [Api.Contact]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Contact.self) + } + var _2: Int32? + _2 = reader.readInt32() + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.contacts.Contacts.contacts(Cons_contacts(contacts: _1!, savedCount: _2!, users: _3!)) + } + else { + return nil + } + } + public static func parse_contactsNotModified(_ reader: BufferReader) -> Contacts? { + return Api.contacts.Contacts.contactsNotModified + } + } +} +public extension Api.contacts { + enum Found: TypeConstructorDescription { + public class Cons_found: TypeConstructorDescription { + public var myResults: [Api.Peer] + public var results: [Api.Peer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(myResults: [Api.Peer], results: [Api.Peer], chats: [Api.Chat], users: [Api.User]) { + self.myResults = myResults + self.results = results + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("found", [("myResults", ConstructorParameterDescription(self.myResults)), ("results", ConstructorParameterDescription(self.results)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case found(Cons_found) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .found(let _data): + if boxed { + buffer.appendInt32(-1290580579) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.myResults.count)) + for item in _data.myResults { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.results.count)) + for item in _data.results { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .found(let _data): + return ("found", [("myResults", ConstructorParameterDescription(_data.myResults)), ("results", ConstructorParameterDescription(_data.results)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_found(_ reader: BufferReader) -> Found? { + var _1: [Api.Peer]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) + } + var _2: [Api.Peer]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self) + } + var _3: [Api.Chat]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.contacts.Found.found(Cons_found(myResults: _1!, results: _2!, chats: _3!, users: _4!)) + } + else { + return nil + } + } + } +} +public extension Api.contacts { + enum ImportedContacts: TypeConstructorDescription { + public class Cons_importedContacts: TypeConstructorDescription { + public var imported: [Api.ImportedContact] + public var popularInvites: [Api.PopularContact] + public var retryContacts: [Int64] + public var users: [Api.User] + public init(imported: [Api.ImportedContact], popularInvites: [Api.PopularContact], retryContacts: [Int64], users: [Api.User]) { + self.imported = imported + self.popularInvites = popularInvites + self.retryContacts = retryContacts + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("importedContacts", [("imported", ConstructorParameterDescription(self.imported)), ("popularInvites", ConstructorParameterDescription(self.popularInvites)), ("retryContacts", ConstructorParameterDescription(self.retryContacts)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case importedContacts(Cons_importedContacts) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .importedContacts(let _data): + if boxed { + buffer.appendInt32(2010127419) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.imported.count)) + for item in _data.imported { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.popularInvites.count)) + for item in _data.popularInvites { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.retryContacts.count)) + for item in _data.retryContacts { + serializeInt64(item, buffer: buffer, boxed: false) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .importedContacts(let _data): + return ("importedContacts", [("imported", ConstructorParameterDescription(_data.imported)), ("popularInvites", ConstructorParameterDescription(_data.popularInvites)), ("retryContacts", ConstructorParameterDescription(_data.retryContacts)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_importedContacts(_ reader: BufferReader) -> ImportedContacts? { + var _1: [Api.ImportedContact]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ImportedContact.self) + } + var _2: [Api.PopularContact]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.PopularContact.self) + } + var _3: [Int64]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.contacts.ImportedContacts.importedContacts(Cons_importedContacts(imported: _1!, popularInvites: _2!, retryContacts: _3!, users: _4!)) + } + else { + return nil + } + } + } +} +public extension Api.contacts { + enum ResolvedPeer: TypeConstructorDescription { + public class Cons_resolvedPeer: TypeConstructorDescription { + public var peer: Api.Peer + public var chats: [Api.Chat] + public var users: [Api.User] + public init(peer: Api.Peer, chats: [Api.Chat], users: [Api.User]) { + self.peer = peer + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("resolvedPeer", [("peer", ConstructorParameterDescription(self.peer)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case resolvedPeer(Cons_resolvedPeer) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .resolvedPeer(let _data): + if boxed { + buffer.appendInt32(2131196633) + } + _data.peer.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .resolvedPeer(let _data): + return ("resolvedPeer", [("peer", ConstructorParameterDescription(_data.peer)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_resolvedPeer(_ reader: BufferReader) -> ResolvedPeer? { + var _1: Api.Peer? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.Peer + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.contacts.ResolvedPeer.resolvedPeer(Cons_resolvedPeer(peer: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.contacts { + enum SponsoredPeers: TypeConstructorDescription { + public class Cons_sponsoredPeers: TypeConstructorDescription { + public var peers: [Api.SponsoredPeer] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(peers: [Api.SponsoredPeer], chats: [Api.Chat], users: [Api.User]) { + self.peers = peers + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("sponsoredPeers", [("peers", ConstructorParameterDescription(self.peers)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case sponsoredPeers(Cons_sponsoredPeers) + case sponsoredPeersEmpty + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .sponsoredPeers(let _data): + if boxed { + buffer.appendInt32(-352114556) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.peers.count)) + for item in _data.peers { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .sponsoredPeersEmpty: + if boxed { + buffer.appendInt32(-365775695) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .sponsoredPeers(let _data): + return ("sponsoredPeers", [("peers", ConstructorParameterDescription(_data.peers)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + case .sponsoredPeersEmpty: + return ("sponsoredPeersEmpty", []) + } + } + + public static func parse_sponsoredPeers(_ reader: BufferReader) -> SponsoredPeers? { + var _1: [Api.SponsoredPeer]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SponsoredPeer.self) + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.contacts.SponsoredPeers.sponsoredPeers(Cons_sponsoredPeers(peers: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + public static func parse_sponsoredPeersEmpty(_ reader: BufferReader) -> SponsoredPeers? { + return Api.contacts.SponsoredPeers.sponsoredPeersEmpty + } + } +} +public extension Api.contacts { + enum TopPeers: TypeConstructorDescription { + public class Cons_topPeers: TypeConstructorDescription { + public var categories: [Api.TopPeerCategoryPeers] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(categories: [Api.TopPeerCategoryPeers], chats: [Api.Chat], users: [Api.User]) { + self.categories = categories + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("topPeers", [("categories", ConstructorParameterDescription(self.categories)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case topPeers(Cons_topPeers) + case topPeersDisabled + case topPeersNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .topPeers(let _data): + if boxed { + buffer.appendInt32(1891070632) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.categories.count)) + for item in _data.categories { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .topPeersDisabled: + if boxed { + buffer.appendInt32(-1255369827) + } + break + case .topPeersNotModified: + if boxed { + buffer.appendInt32(-567906571) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .topPeers(let _data): + return ("topPeers", [("categories", ConstructorParameterDescription(_data.categories)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + case .topPeersDisabled: + return ("topPeersDisabled", []) + case .topPeersNotModified: + return ("topPeersNotModified", []) + } + } + + public static func parse_topPeers(_ reader: BufferReader) -> TopPeers? { + var _1: [Api.TopPeerCategoryPeers]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.TopPeerCategoryPeers.self) + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.contacts.TopPeers.topPeers(Cons_topPeers(categories: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + public static func parse_topPeersDisabled(_ reader: BufferReader) -> TopPeers? { + return Api.contacts.TopPeers.topPeersDisabled + } + public static func parse_topPeersNotModified(_ reader: BufferReader) -> TopPeers? { + return Api.contacts.TopPeers.topPeersNotModified + } + } +} +public extension Api.fragment { + enum CollectibleInfo: TypeConstructorDescription { + public class Cons_collectibleInfo: TypeConstructorDescription { + public var purchaseDate: Int32 + public var currency: String + public var amount: Int64 + public var cryptoCurrency: String + public var cryptoAmount: Int64 + public var url: String + public init(purchaseDate: Int32, currency: String, amount: Int64, cryptoCurrency: String, cryptoAmount: Int64, url: String) { + self.purchaseDate = purchaseDate + self.currency = currency + self.amount = amount + self.cryptoCurrency = cryptoCurrency + self.cryptoAmount = cryptoAmount + self.url = url + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("collectibleInfo", [("purchaseDate", ConstructorParameterDescription(self.purchaseDate)), ("currency", ConstructorParameterDescription(self.currency)), ("amount", ConstructorParameterDescription(self.amount)), ("cryptoCurrency", ConstructorParameterDescription(self.cryptoCurrency)), ("cryptoAmount", ConstructorParameterDescription(self.cryptoAmount)), ("url", ConstructorParameterDescription(self.url))]) + } + } + case collectibleInfo(Cons_collectibleInfo) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .collectibleInfo(let _data): + if boxed { + buffer.appendInt32(1857945489) + } + serializeInt32(_data.purchaseDate, buffer: buffer, boxed: false) + serializeString(_data.currency, buffer: buffer, boxed: false) + serializeInt64(_data.amount, buffer: buffer, boxed: false) + serializeString(_data.cryptoCurrency, buffer: buffer, boxed: false) + serializeInt64(_data.cryptoAmount, buffer: buffer, boxed: false) + serializeString(_data.url, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .collectibleInfo(let _data): + return ("collectibleInfo", [("purchaseDate", ConstructorParameterDescription(_data.purchaseDate)), ("currency", ConstructorParameterDescription(_data.currency)), ("amount", ConstructorParameterDescription(_data.amount)), ("cryptoCurrency", ConstructorParameterDescription(_data.cryptoCurrency)), ("cryptoAmount", ConstructorParameterDescription(_data.cryptoAmount)), ("url", ConstructorParameterDescription(_data.url))]) + } + } + + public static func parse_collectibleInfo(_ reader: BufferReader) -> CollectibleInfo? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: Int64? + _3 = reader.readInt64() + var _4: String? + _4 = parseString(reader) + var _5: Int64? + _5 = reader.readInt64() + var _6: String? + _6 = parseString(reader) + 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.fragment.CollectibleInfo.collectibleInfo(Cons_collectibleInfo(purchaseDate: _1!, currency: _2!, amount: _3!, cryptoCurrency: _4!, cryptoAmount: _5!, url: _6!)) + } + else { + return nil + } + } + } +} public extension Api.help { enum AppConfig: TypeConstructorDescription { public class Cons_appConfig: TypeConstructorDescription { @@ -1136,548 +1774,3 @@ public extension Api.help { } } } -public extension Api.help { - enum RecentMeUrls: TypeConstructorDescription { - public class Cons_recentMeUrls: TypeConstructorDescription { - public var urls: [Api.RecentMeUrl] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User]) { - self.urls = urls - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("recentMeUrls", [("urls", ConstructorParameterDescription(self.urls)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case recentMeUrls(Cons_recentMeUrls) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .recentMeUrls(let _data): - if boxed { - buffer.appendInt32(235081943) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.urls.count)) - for item in _data.urls { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .recentMeUrls(let _data): - return ("recentMeUrls", [("urls", ConstructorParameterDescription(_data.urls)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_recentMeUrls(_ reader: BufferReader) -> RecentMeUrls? { - var _1: [Api.RecentMeUrl]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RecentMeUrl.self) - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.help.RecentMeUrls.recentMeUrls(Cons_recentMeUrls(urls: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.help { - enum Support: TypeConstructorDescription { - public class Cons_support: TypeConstructorDescription { - public var phoneNumber: String - public var user: Api.User - public init(phoneNumber: String, user: Api.User) { - self.phoneNumber = phoneNumber - self.user = user - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("support", [("phoneNumber", ConstructorParameterDescription(self.phoneNumber)), ("user", ConstructorParameterDescription(self.user))]) - } - } - case support(Cons_support) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .support(let _data): - if boxed { - buffer.appendInt32(398898678) - } - serializeString(_data.phoneNumber, buffer: buffer, boxed: false) - _data.user.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .support(let _data): - return ("support", [("phoneNumber", ConstructorParameterDescription(_data.phoneNumber)), ("user", ConstructorParameterDescription(_data.user))]) - } - } - - public static func parse_support(_ reader: BufferReader) -> Support? { - var _1: String? - _1 = parseString(reader) - var _2: Api.User? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.User - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.help.Support.support(Cons_support(phoneNumber: _1!, user: _2!)) - } - else { - return nil - } - } - } -} -public extension Api.help { - enum SupportName: TypeConstructorDescription { - public class Cons_supportName: TypeConstructorDescription { - public var name: String - public init(name: String) { - self.name = name - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("supportName", [("name", ConstructorParameterDescription(self.name))]) - } - } - case supportName(Cons_supportName) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .supportName(let _data): - if boxed { - buffer.appendInt32(-1945767479) - } - serializeString(_data.name, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .supportName(let _data): - return ("supportName", [("name", ConstructorParameterDescription(_data.name))]) - } - } - - public static func parse_supportName(_ reader: BufferReader) -> SupportName? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.help.SupportName.supportName(Cons_supportName(name: _1!)) - } - else { - return nil - } - } - } -} -public extension Api.help { - enum TermsOfService: TypeConstructorDescription { - public class Cons_termsOfService: TypeConstructorDescription { - public var flags: Int32 - public var id: Api.DataJSON - public var text: String - public var entities: [Api.MessageEntity] - public var minAgeConfirm: Int32? - public init(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?) { - self.flags = flags - self.id = id - self.text = text - self.entities = entities - self.minAgeConfirm = minAgeConfirm - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("termsOfService", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("text", ConstructorParameterDescription(self.text)), ("entities", ConstructorParameterDescription(self.entities)), ("minAgeConfirm", ConstructorParameterDescription(self.minAgeConfirm))]) - } - } - case termsOfService(Cons_termsOfService) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .termsOfService(let _data): - if boxed { - buffer.appendInt32(2013922064) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.id.serialize(buffer, true) - serializeString(_data.text, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.entities.count)) - for item in _data.entities { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.minAgeConfirm!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .termsOfService(let _data): - return ("termsOfService", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("text", ConstructorParameterDescription(_data.text)), ("entities", ConstructorParameterDescription(_data.entities)), ("minAgeConfirm", ConstructorParameterDescription(_data.minAgeConfirm))]) - } - } - - public static func parse_termsOfService(_ reader: BufferReader) -> TermsOfService? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.DataJSON? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.DataJSON - } - var _3: String? - _3 = parseString(reader) - var _4: [Api.MessageEntity]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) - } - var _5: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _5 = reader.readInt32() - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.help.TermsOfService.termsOfService(Cons_termsOfService(flags: _1!, id: _2!, text: _3!, entities: _4!, minAgeConfirm: _5)) - } - else { - return nil - } - } - } -} -public extension Api.help { - enum TermsOfServiceUpdate: TypeConstructorDescription { - public class Cons_termsOfServiceUpdate: TypeConstructorDescription { - public var expires: Int32 - public var termsOfService: Api.help.TermsOfService - public init(expires: Int32, termsOfService: Api.help.TermsOfService) { - self.expires = expires - self.termsOfService = termsOfService - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("termsOfServiceUpdate", [("expires", ConstructorParameterDescription(self.expires)), ("termsOfService", ConstructorParameterDescription(self.termsOfService))]) - } - } - public class Cons_termsOfServiceUpdateEmpty: TypeConstructorDescription { - public var expires: Int32 - public init(expires: Int32) { - self.expires = expires - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("termsOfServiceUpdateEmpty", [("expires", ConstructorParameterDescription(self.expires))]) - } - } - case termsOfServiceUpdate(Cons_termsOfServiceUpdate) - case termsOfServiceUpdateEmpty(Cons_termsOfServiceUpdateEmpty) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .termsOfServiceUpdate(let _data): - if boxed { - buffer.appendInt32(686618977) - } - serializeInt32(_data.expires, buffer: buffer, boxed: false) - _data.termsOfService.serialize(buffer, true) - break - case .termsOfServiceUpdateEmpty(let _data): - if boxed { - buffer.appendInt32(-483352705) - } - serializeInt32(_data.expires, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .termsOfServiceUpdate(let _data): - return ("termsOfServiceUpdate", [("expires", ConstructorParameterDescription(_data.expires)), ("termsOfService", ConstructorParameterDescription(_data.termsOfService))]) - case .termsOfServiceUpdateEmpty(let _data): - return ("termsOfServiceUpdateEmpty", [("expires", ConstructorParameterDescription(_data.expires))]) - } - } - - public static func parse_termsOfServiceUpdate(_ reader: BufferReader) -> TermsOfServiceUpdate? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.help.TermsOfService? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.help.TermsOfService - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.help.TermsOfServiceUpdate.termsOfServiceUpdate(Cons_termsOfServiceUpdate(expires: _1!, termsOfService: _2!)) - } - else { - return nil - } - } - public static func parse_termsOfServiceUpdateEmpty(_ reader: BufferReader) -> TermsOfServiceUpdate? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.help.TermsOfServiceUpdate.termsOfServiceUpdateEmpty(Cons_termsOfServiceUpdateEmpty(expires: _1!)) - } - else { - return nil - } - } - } -} -public extension Api.help { - enum TimezonesList: TypeConstructorDescription { - public class Cons_timezonesList: TypeConstructorDescription { - public var timezones: [Api.Timezone] - public var hash: Int32 - public init(timezones: [Api.Timezone], hash: Int32) { - self.timezones = timezones - self.hash = hash - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("timezonesList", [("timezones", ConstructorParameterDescription(self.timezones)), ("hash", ConstructorParameterDescription(self.hash))]) - } - } - case timezonesList(Cons_timezonesList) - case timezonesListNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .timezonesList(let _data): - if boxed { - buffer.appendInt32(2071260529) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.timezones.count)) - for item in _data.timezones { - item.serialize(buffer, true) - } - serializeInt32(_data.hash, buffer: buffer, boxed: false) - break - case .timezonesListNotModified: - if boxed { - buffer.appendInt32(-1761146676) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .timezonesList(let _data): - return ("timezonesList", [("timezones", ConstructorParameterDescription(_data.timezones)), ("hash", ConstructorParameterDescription(_data.hash))]) - case .timezonesListNotModified: - return ("timezonesListNotModified", []) - } - } - - public static func parse_timezonesList(_ reader: BufferReader) -> TimezonesList? { - var _1: [Api.Timezone]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Timezone.self) - } - var _2: Int32? - _2 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.help.TimezonesList.timezonesList(Cons_timezonesList(timezones: _1!, hash: _2!)) - } - else { - return nil - } - } - public static func parse_timezonesListNotModified(_ reader: BufferReader) -> TimezonesList? { - return Api.help.TimezonesList.timezonesListNotModified - } - } -} -public extension Api.help { - enum UserInfo: TypeConstructorDescription { - public class Cons_userInfo: TypeConstructorDescription { - public var message: String - public var entities: [Api.MessageEntity] - public var author: String - public var date: Int32 - public init(message: String, entities: [Api.MessageEntity], author: String, date: Int32) { - self.message = message - self.entities = entities - self.author = author - self.date = date - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("userInfo", [("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("author", ConstructorParameterDescription(self.author)), ("date", ConstructorParameterDescription(self.date))]) - } - } - case userInfo(Cons_userInfo) - case userInfoEmpty - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .userInfo(let _data): - if boxed { - buffer.appendInt32(32192344) - } - serializeString(_data.message, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.entities.count)) - for item in _data.entities { - item.serialize(buffer, true) - } - serializeString(_data.author, buffer: buffer, boxed: false) - serializeInt32(_data.date, buffer: buffer, boxed: false) - break - case .userInfoEmpty: - if boxed { - buffer.appendInt32(-206688531) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .userInfo(let _data): - return ("userInfo", [("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("author", ConstructorParameterDescription(_data.author)), ("date", ConstructorParameterDescription(_data.date))]) - case .userInfoEmpty: - return ("userInfoEmpty", []) - } - } - - public static func parse_userInfo(_ reader: BufferReader) -> UserInfo? { - var _1: String? - _1 = parseString(reader) - var _2: [Api.MessageEntity]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) - } - var _3: String? - _3 = parseString(reader) - var _4: Int32? - _4 = reader.readInt32() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.help.UserInfo.userInfo(Cons_userInfo(message: _1!, entities: _2!, author: _3!, date: _4!)) - } - else { - return nil - } - } - public static func parse_userInfoEmpty(_ reader: BufferReader) -> UserInfo? { - return Api.help.UserInfo.userInfoEmpty - } - } -} -public extension Api.messages { - enum AffectedFoundMessages: TypeConstructorDescription { - public class Cons_affectedFoundMessages: TypeConstructorDescription { - public var pts: Int32 - public var ptsCount: Int32 - public var offset: Int32 - public var messages: [Int32] - public init(pts: Int32, ptsCount: Int32, offset: Int32, messages: [Int32]) { - self.pts = pts - self.ptsCount = ptsCount - self.offset = offset - self.messages = messages - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("affectedFoundMessages", [("pts", ConstructorParameterDescription(self.pts)), ("ptsCount", ConstructorParameterDescription(self.ptsCount)), ("offset", ConstructorParameterDescription(self.offset)), ("messages", ConstructorParameterDescription(self.messages))]) - } - } - case affectedFoundMessages(Cons_affectedFoundMessages) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .affectedFoundMessages(let _data): - if boxed { - buffer.appendInt32(-275956116) - } - serializeInt32(_data.pts, buffer: buffer, boxed: false) - serializeInt32(_data.ptsCount, buffer: buffer, boxed: false) - serializeInt32(_data.offset, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - serializeInt32(item, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .affectedFoundMessages(let _data): - return ("affectedFoundMessages", [("pts", ConstructorParameterDescription(_data.pts)), ("ptsCount", ConstructorParameterDescription(_data.ptsCount)), ("offset", ConstructorParameterDescription(_data.offset)), ("messages", ConstructorParameterDescription(_data.messages))]) - } - } - - public static func parse_affectedFoundMessages(_ reader: BufferReader) -> AffectedFoundMessages? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Int32? - _3 = reader.readInt32() - var _4: [Int32]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.messages.AffectedFoundMessages.affectedFoundMessages(Cons_affectedFoundMessages(pts: _1!, ptsCount: _2!, offset: _3!, messages: _4!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api34.swift b/submodules/TelegramApi/Sources/Api34.swift index f03ad72730..64528d990f 100644 --- a/submodules/TelegramApi/Sources/Api34.swift +++ b/submodules/TelegramApi/Sources/Api34.swift @@ -1,3 +1,548 @@ +public extension Api.help { + enum RecentMeUrls: TypeConstructorDescription { + public class Cons_recentMeUrls: TypeConstructorDescription { + public var urls: [Api.RecentMeUrl] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(urls: [Api.RecentMeUrl], chats: [Api.Chat], users: [Api.User]) { + self.urls = urls + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("recentMeUrls", [("urls", ConstructorParameterDescription(self.urls)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case recentMeUrls(Cons_recentMeUrls) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .recentMeUrls(let _data): + if boxed { + buffer.appendInt32(235081943) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.urls.count)) + for item in _data.urls { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .recentMeUrls(let _data): + return ("recentMeUrls", [("urls", ConstructorParameterDescription(_data.urls)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_recentMeUrls(_ reader: BufferReader) -> RecentMeUrls? { + var _1: [Api.RecentMeUrl]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.RecentMeUrl.self) + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.help.RecentMeUrls.recentMeUrls(Cons_recentMeUrls(urls: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.help { + enum Support: TypeConstructorDescription { + public class Cons_support: TypeConstructorDescription { + public var phoneNumber: String + public var user: Api.User + public init(phoneNumber: String, user: Api.User) { + self.phoneNumber = phoneNumber + self.user = user + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("support", [("phoneNumber", ConstructorParameterDescription(self.phoneNumber)), ("user", ConstructorParameterDescription(self.user))]) + } + } + case support(Cons_support) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .support(let _data): + if boxed { + buffer.appendInt32(398898678) + } + serializeString(_data.phoneNumber, buffer: buffer, boxed: false) + _data.user.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .support(let _data): + return ("support", [("phoneNumber", ConstructorParameterDescription(_data.phoneNumber)), ("user", ConstructorParameterDescription(_data.user))]) + } + } + + public static func parse_support(_ reader: BufferReader) -> Support? { + var _1: String? + _1 = parseString(reader) + var _2: Api.User? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.User + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.help.Support.support(Cons_support(phoneNumber: _1!, user: _2!)) + } + else { + return nil + } + } + } +} +public extension Api.help { + enum SupportName: TypeConstructorDescription { + public class Cons_supportName: TypeConstructorDescription { + public var name: String + public init(name: String) { + self.name = name + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("supportName", [("name", ConstructorParameterDescription(self.name))]) + } + } + case supportName(Cons_supportName) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .supportName(let _data): + if boxed { + buffer.appendInt32(-1945767479) + } + serializeString(_data.name, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .supportName(let _data): + return ("supportName", [("name", ConstructorParameterDescription(_data.name))]) + } + } + + public static func parse_supportName(_ reader: BufferReader) -> SupportName? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.help.SupportName.supportName(Cons_supportName(name: _1!)) + } + else { + return nil + } + } + } +} +public extension Api.help { + enum TermsOfService: TypeConstructorDescription { + public class Cons_termsOfService: TypeConstructorDescription { + public var flags: Int32 + public var id: Api.DataJSON + public var text: String + public var entities: [Api.MessageEntity] + public var minAgeConfirm: Int32? + public init(flags: Int32, id: Api.DataJSON, text: String, entities: [Api.MessageEntity], minAgeConfirm: Int32?) { + self.flags = flags + self.id = id + self.text = text + self.entities = entities + self.minAgeConfirm = minAgeConfirm + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("termsOfService", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("text", ConstructorParameterDescription(self.text)), ("entities", ConstructorParameterDescription(self.entities)), ("minAgeConfirm", ConstructorParameterDescription(self.minAgeConfirm))]) + } + } + case termsOfService(Cons_termsOfService) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .termsOfService(let _data): + if boxed { + buffer.appendInt32(2013922064) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.id.serialize(buffer, true) + serializeString(_data.text, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.entities.count)) + for item in _data.entities { + item.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.minAgeConfirm!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .termsOfService(let _data): + return ("termsOfService", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("text", ConstructorParameterDescription(_data.text)), ("entities", ConstructorParameterDescription(_data.entities)), ("minAgeConfirm", ConstructorParameterDescription(_data.minAgeConfirm))]) + } + } + + public static func parse_termsOfService(_ reader: BufferReader) -> TermsOfService? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.DataJSON? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.DataJSON + } + var _3: String? + _3 = parseString(reader) + var _4: [Api.MessageEntity]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) + } + var _5: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _5 = reader.readInt32() + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.help.TermsOfService.termsOfService(Cons_termsOfService(flags: _1!, id: _2!, text: _3!, entities: _4!, minAgeConfirm: _5)) + } + else { + return nil + } + } + } +} +public extension Api.help { + enum TermsOfServiceUpdate: TypeConstructorDescription { + public class Cons_termsOfServiceUpdate: TypeConstructorDescription { + public var expires: Int32 + public var termsOfService: Api.help.TermsOfService + public init(expires: Int32, termsOfService: Api.help.TermsOfService) { + self.expires = expires + self.termsOfService = termsOfService + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("termsOfServiceUpdate", [("expires", ConstructorParameterDescription(self.expires)), ("termsOfService", ConstructorParameterDescription(self.termsOfService))]) + } + } + public class Cons_termsOfServiceUpdateEmpty: TypeConstructorDescription { + public var expires: Int32 + public init(expires: Int32) { + self.expires = expires + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("termsOfServiceUpdateEmpty", [("expires", ConstructorParameterDescription(self.expires))]) + } + } + case termsOfServiceUpdate(Cons_termsOfServiceUpdate) + case termsOfServiceUpdateEmpty(Cons_termsOfServiceUpdateEmpty) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .termsOfServiceUpdate(let _data): + if boxed { + buffer.appendInt32(686618977) + } + serializeInt32(_data.expires, buffer: buffer, boxed: false) + _data.termsOfService.serialize(buffer, true) + break + case .termsOfServiceUpdateEmpty(let _data): + if boxed { + buffer.appendInt32(-483352705) + } + serializeInt32(_data.expires, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .termsOfServiceUpdate(let _data): + return ("termsOfServiceUpdate", [("expires", ConstructorParameterDescription(_data.expires)), ("termsOfService", ConstructorParameterDescription(_data.termsOfService))]) + case .termsOfServiceUpdateEmpty(let _data): + return ("termsOfServiceUpdateEmpty", [("expires", ConstructorParameterDescription(_data.expires))]) + } + } + + public static func parse_termsOfServiceUpdate(_ reader: BufferReader) -> TermsOfServiceUpdate? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.help.TermsOfService? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.help.TermsOfService + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.help.TermsOfServiceUpdate.termsOfServiceUpdate(Cons_termsOfServiceUpdate(expires: _1!, termsOfService: _2!)) + } + else { + return nil + } + } + public static func parse_termsOfServiceUpdateEmpty(_ reader: BufferReader) -> TermsOfServiceUpdate? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.help.TermsOfServiceUpdate.termsOfServiceUpdateEmpty(Cons_termsOfServiceUpdateEmpty(expires: _1!)) + } + else { + return nil + } + } + } +} +public extension Api.help { + enum TimezonesList: TypeConstructorDescription { + public class Cons_timezonesList: TypeConstructorDescription { + public var timezones: [Api.Timezone] + public var hash: Int32 + public init(timezones: [Api.Timezone], hash: Int32) { + self.timezones = timezones + self.hash = hash + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("timezonesList", [("timezones", ConstructorParameterDescription(self.timezones)), ("hash", ConstructorParameterDescription(self.hash))]) + } + } + case timezonesList(Cons_timezonesList) + case timezonesListNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .timezonesList(let _data): + if boxed { + buffer.appendInt32(2071260529) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.timezones.count)) + for item in _data.timezones { + item.serialize(buffer, true) + } + serializeInt32(_data.hash, buffer: buffer, boxed: false) + break + case .timezonesListNotModified: + if boxed { + buffer.appendInt32(-1761146676) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .timezonesList(let _data): + return ("timezonesList", [("timezones", ConstructorParameterDescription(_data.timezones)), ("hash", ConstructorParameterDescription(_data.hash))]) + case .timezonesListNotModified: + return ("timezonesListNotModified", []) + } + } + + public static func parse_timezonesList(_ reader: BufferReader) -> TimezonesList? { + var _1: [Api.Timezone]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Timezone.self) + } + var _2: Int32? + _2 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.help.TimezonesList.timezonesList(Cons_timezonesList(timezones: _1!, hash: _2!)) + } + else { + return nil + } + } + public static func parse_timezonesListNotModified(_ reader: BufferReader) -> TimezonesList? { + return Api.help.TimezonesList.timezonesListNotModified + } + } +} +public extension Api.help { + enum UserInfo: TypeConstructorDescription { + public class Cons_userInfo: TypeConstructorDescription { + public var message: String + public var entities: [Api.MessageEntity] + public var author: String + public var date: Int32 + public init(message: String, entities: [Api.MessageEntity], author: String, date: Int32) { + self.message = message + self.entities = entities + self.author = author + self.date = date + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("userInfo", [("message", ConstructorParameterDescription(self.message)), ("entities", ConstructorParameterDescription(self.entities)), ("author", ConstructorParameterDescription(self.author)), ("date", ConstructorParameterDescription(self.date))]) + } + } + case userInfo(Cons_userInfo) + case userInfoEmpty + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .userInfo(let _data): + if boxed { + buffer.appendInt32(32192344) + } + serializeString(_data.message, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.entities.count)) + for item in _data.entities { + item.serialize(buffer, true) + } + serializeString(_data.author, buffer: buffer, boxed: false) + serializeInt32(_data.date, buffer: buffer, boxed: false) + break + case .userInfoEmpty: + if boxed { + buffer.appendInt32(-206688531) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .userInfo(let _data): + return ("userInfo", [("message", ConstructorParameterDescription(_data.message)), ("entities", ConstructorParameterDescription(_data.entities)), ("author", ConstructorParameterDescription(_data.author)), ("date", ConstructorParameterDescription(_data.date))]) + case .userInfoEmpty: + return ("userInfoEmpty", []) + } + } + + public static func parse_userInfo(_ reader: BufferReader) -> UserInfo? { + var _1: String? + _1 = parseString(reader) + var _2: [Api.MessageEntity]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self) + } + var _3: String? + _3 = parseString(reader) + var _4: Int32? + _4 = reader.readInt32() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.help.UserInfo.userInfo(Cons_userInfo(message: _1!, entities: _2!, author: _3!, date: _4!)) + } + else { + return nil + } + } + public static func parse_userInfoEmpty(_ reader: BufferReader) -> UserInfo? { + return Api.help.UserInfo.userInfoEmpty + } + } +} +public extension Api.messages { + enum AffectedFoundMessages: TypeConstructorDescription { + public class Cons_affectedFoundMessages: TypeConstructorDescription { + public var pts: Int32 + public var ptsCount: Int32 + public var offset: Int32 + public var messages: [Int32] + public init(pts: Int32, ptsCount: Int32, offset: Int32, messages: [Int32]) { + self.pts = pts + self.ptsCount = ptsCount + self.offset = offset + self.messages = messages + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("affectedFoundMessages", [("pts", ConstructorParameterDescription(self.pts)), ("ptsCount", ConstructorParameterDescription(self.ptsCount)), ("offset", ConstructorParameterDescription(self.offset)), ("messages", ConstructorParameterDescription(self.messages))]) + } + } + case affectedFoundMessages(Cons_affectedFoundMessages) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .affectedFoundMessages(let _data): + if boxed { + buffer.appendInt32(-275956116) + } + serializeInt32(_data.pts, buffer: buffer, boxed: false) + serializeInt32(_data.ptsCount, buffer: buffer, boxed: false) + serializeInt32(_data.offset, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + serializeInt32(item, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .affectedFoundMessages(let _data): + return ("affectedFoundMessages", [("pts", ConstructorParameterDescription(_data.pts)), ("ptsCount", ConstructorParameterDescription(_data.ptsCount)), ("offset", ConstructorParameterDescription(_data.offset)), ("messages", ConstructorParameterDescription(_data.messages))]) + } + } + + public static func parse_affectedFoundMessages(_ reader: BufferReader) -> AffectedFoundMessages? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Int32? + _3 = reader.readInt32() + var _4: [Int32]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.messages.AffectedFoundMessages.affectedFoundMessages(Cons_affectedFoundMessages(pts: _1!, ptsCount: _2!, offset: _3!, messages: _4!)) + } + else { + return nil + } + } + } +} public extension Api.messages { enum AffectedHistory: TypeConstructorDescription { public class Cons_affectedHistory: TypeConstructorDescription { @@ -1149,585 +1694,3 @@ public extension Api.messages { } } } -public extension Api.messages { - enum DialogFilters: TypeConstructorDescription { - public class Cons_dialogFilters: TypeConstructorDescription { - public var flags: Int32 - public var filters: [Api.DialogFilter] - public init(flags: Int32, filters: [Api.DialogFilter]) { - self.flags = flags - self.filters = filters - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("dialogFilters", [("flags", ConstructorParameterDescription(self.flags)), ("filters", ConstructorParameterDescription(self.filters))]) - } - } - case dialogFilters(Cons_dialogFilters) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .dialogFilters(let _data): - if boxed { - buffer.appendInt32(718878489) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.filters.count)) - for item in _data.filters { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .dialogFilters(let _data): - return ("dialogFilters", [("flags", ConstructorParameterDescription(_data.flags)), ("filters", ConstructorParameterDescription(_data.filters))]) - } - } - - public static func parse_dialogFilters(_ reader: BufferReader) -> DialogFilters? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.DialogFilter]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogFilter.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.messages.DialogFilters.dialogFilters(Cons_dialogFilters(flags: _1!, filters: _2!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum Dialogs: TypeConstructorDescription { - public class Cons_dialogs: TypeConstructorDescription { - public var dialogs: [Api.Dialog] - public var messages: [Api.Message] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { - self.dialogs = dialogs - self.messages = messages - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("dialogs", [("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - public class Cons_dialogsNotModified: TypeConstructorDescription { - public var count: Int32 - public init(count: Int32) { - self.count = count - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("dialogsNotModified", [("count", ConstructorParameterDescription(self.count))]) - } - } - public class Cons_dialogsSlice: TypeConstructorDescription { - public var count: Int32 - public var dialogs: [Api.Dialog] - public var messages: [Api.Message] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { - self.count = count - self.dialogs = dialogs - self.messages = messages - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("dialogsSlice", [("count", ConstructorParameterDescription(self.count)), ("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case dialogs(Cons_dialogs) - case dialogsNotModified(Cons_dialogsNotModified) - case dialogsSlice(Cons_dialogsSlice) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .dialogs(let _data): - if boxed { - buffer.appendInt32(364538944) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.dialogs.count)) - for item in _data.dialogs { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .dialogsNotModified(let _data): - if boxed { - buffer.appendInt32(-253500010) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - break - case .dialogsSlice(let _data): - if boxed { - buffer.appendInt32(1910543603) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.dialogs.count)) - for item in _data.dialogs { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .dialogs(let _data): - return ("dialogs", [("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - case .dialogsNotModified(let _data): - return ("dialogsNotModified", [("count", ConstructorParameterDescription(_data.count))]) - case .dialogsSlice(let _data): - return ("dialogsSlice", [("count", ConstructorParameterDescription(_data.count)), ("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_dialogs(_ reader: BufferReader) -> Dialogs? { - var _1: [Api.Dialog]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) - } - var _2: [Api.Message]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) - } - var _3: [Api.Chat]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.messages.Dialogs.dialogs(Cons_dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)) - } - else { - return nil - } - } - public static func parse_dialogsNotModified(_ reader: BufferReader) -> Dialogs? { - var _1: Int32? - _1 = reader.readInt32() - let _c1 = _1 != nil - if _c1 { - return Api.messages.Dialogs.dialogsNotModified(Cons_dialogsNotModified(count: _1!)) - } - else { - return nil - } - } - public static func parse_dialogsSlice(_ reader: BufferReader) -> Dialogs? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.Dialog]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) - } - var _3: [Api.Message]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) - } - var _4: [Api.Chat]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _5: [Api.User]? - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.messages.Dialogs.dialogsSlice(Cons_dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum DiscussionMessage: TypeConstructorDescription { - public class Cons_discussionMessage: TypeConstructorDescription { - public var flags: Int32 - public var messages: [Api.Message] - public var maxId: Int32? - public var readInboxMaxId: Int32? - public var readOutboxMaxId: Int32? - public var unreadCount: Int32 - public var chats: [Api.Chat] - public var users: [Api.User] - public init(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User]) { - self.flags = flags - self.messages = messages - self.maxId = maxId - self.readInboxMaxId = readInboxMaxId - self.readOutboxMaxId = readOutboxMaxId - self.unreadCount = unreadCount - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("discussionMessage", [("flags", ConstructorParameterDescription(self.flags)), ("messages", ConstructorParameterDescription(self.messages)), ("maxId", ConstructorParameterDescription(self.maxId)), ("readInboxMaxId", ConstructorParameterDescription(self.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(self.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(self.unreadCount)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case discussionMessage(Cons_discussionMessage) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .discussionMessage(let _data): - if boxed { - buffer.appendInt32(-1506535550) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.maxId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.readInboxMaxId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt32(_data.readOutboxMaxId!, buffer: buffer, boxed: false) - } - serializeInt32(_data.unreadCount, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .discussionMessage(let _data): - return ("discussionMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("messages", ConstructorParameterDescription(_data.messages)), ("maxId", ConstructorParameterDescription(_data.maxId)), ("readInboxMaxId", ConstructorParameterDescription(_data.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(_data.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(_data.unreadCount)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_discussionMessage(_ reader: BufferReader) -> DiscussionMessage? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.Message]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) - } - var _3: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _3 = reader.readInt32() - } - var _4: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _4 = reader.readInt32() - } - var _5: Int32? - if Int(_1!) & Int(1 << 2) != 0 { - _5 = reader.readInt32() - } - var _6: Int32? - _6 = reader.readInt32() - var _7: [Api.Chat]? - if let _ = reader.readInt32() { - _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _8: [Api.User]? - if let _ = reader.readInt32() { - _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil - let _c6 = _6 != nil - let _c7 = _7 != nil - let _c8 = _8 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { - return Api.messages.DiscussionMessage.discussionMessage(Cons_discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum EmojiGameInfo: TypeConstructorDescription { - public class Cons_emojiGameDiceInfo: TypeConstructorDescription { - public var flags: Int32 - public var gameHash: String - public var prevStake: Int64 - public var currentStreak: Int32 - public var params: [Int32] - public var playsLeft: Int32? - public init(flags: Int32, gameHash: String, prevStake: Int64, currentStreak: Int32, params: [Int32], playsLeft: Int32?) { - self.flags = flags - self.gameHash = gameHash - self.prevStake = prevStake - self.currentStreak = currentStreak - self.params = params - self.playsLeft = playsLeft - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("emojiGameDiceInfo", [("flags", ConstructorParameterDescription(self.flags)), ("gameHash", ConstructorParameterDescription(self.gameHash)), ("prevStake", ConstructorParameterDescription(self.prevStake)), ("currentStreak", ConstructorParameterDescription(self.currentStreak)), ("params", ConstructorParameterDescription(self.params)), ("playsLeft", ConstructorParameterDescription(self.playsLeft))]) - } - } - case emojiGameDiceInfo(Cons_emojiGameDiceInfo) - case emojiGameUnavailable - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .emojiGameDiceInfo(let _data): - if boxed { - buffer.appendInt32(1155883043) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.gameHash, buffer: buffer, boxed: false) - serializeInt64(_data.prevStake, buffer: buffer, boxed: false) - serializeInt32(_data.currentStreak, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.params.count)) - for item in _data.params { - serializeInt32(item, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.playsLeft!, buffer: buffer, boxed: false) - } - break - case .emojiGameUnavailable: - if boxed { - buffer.appendInt32(1508266805) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .emojiGameDiceInfo(let _data): - return ("emojiGameDiceInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("gameHash", ConstructorParameterDescription(_data.gameHash)), ("prevStake", ConstructorParameterDescription(_data.prevStake)), ("currentStreak", ConstructorParameterDescription(_data.currentStreak)), ("params", ConstructorParameterDescription(_data.params)), ("playsLeft", ConstructorParameterDescription(_data.playsLeft))]) - case .emojiGameUnavailable: - return ("emojiGameUnavailable", []) - } - } - - public static func parse_emojiGameDiceInfo(_ reader: BufferReader) -> EmojiGameInfo? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: [Int32]? - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) - } - var _6: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _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 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.messages.EmojiGameInfo.emojiGameDiceInfo(Cons_emojiGameDiceInfo(flags: _1!, gameHash: _2!, prevStake: _3!, currentStreak: _4!, params: _5!, playsLeft: _6)) - } - else { - return nil - } - } - public static func parse_emojiGameUnavailable(_ reader: BufferReader) -> EmojiGameInfo? { - return Api.messages.EmojiGameInfo.emojiGameUnavailable - } - } -} -public extension Api.messages { - enum EmojiGameOutcome: TypeConstructorDescription { - public class Cons_emojiGameOutcome: TypeConstructorDescription { - public var seed: Buffer - public var stakeTonAmount: Int64 - public var tonAmount: Int64 - public init(seed: Buffer, stakeTonAmount: Int64, tonAmount: Int64) { - self.seed = seed - self.stakeTonAmount = stakeTonAmount - self.tonAmount = tonAmount - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("emojiGameOutcome", [("seed", ConstructorParameterDescription(self.seed)), ("stakeTonAmount", ConstructorParameterDescription(self.stakeTonAmount)), ("tonAmount", ConstructorParameterDescription(self.tonAmount))]) - } - } - case emojiGameOutcome(Cons_emojiGameOutcome) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .emojiGameOutcome(let _data): - if boxed { - buffer.appendInt32(-634726841) - } - serializeBytes(_data.seed, buffer: buffer, boxed: false) - serializeInt64(_data.stakeTonAmount, buffer: buffer, boxed: false) - serializeInt64(_data.tonAmount, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .emojiGameOutcome(let _data): - return ("emojiGameOutcome", [("seed", ConstructorParameterDescription(_data.seed)), ("stakeTonAmount", ConstructorParameterDescription(_data.stakeTonAmount)), ("tonAmount", ConstructorParameterDescription(_data.tonAmount))]) - } - } - - public static func parse_emojiGameOutcome(_ reader: BufferReader) -> EmojiGameOutcome? { - var _1: Buffer? - _1 = parseBytes(reader) - var _2: Int64? - _2 = reader.readInt64() - var _3: Int64? - _3 = reader.readInt64() - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.messages.EmojiGameOutcome.emojiGameOutcome(Cons_emojiGameOutcome(seed: _1!, stakeTonAmount: _2!, tonAmount: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum EmojiGroups: TypeConstructorDescription { - public class Cons_emojiGroups: TypeConstructorDescription { - public var hash: Int32 - public var groups: [Api.EmojiGroup] - public init(hash: Int32, groups: [Api.EmojiGroup]) { - self.hash = hash - self.groups = groups - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("emojiGroups", [("hash", ConstructorParameterDescription(self.hash)), ("groups", ConstructorParameterDescription(self.groups))]) - } - } - case emojiGroups(Cons_emojiGroups) - case emojiGroupsNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .emojiGroups(let _data): - if boxed { - buffer.appendInt32(-2011186869) - } - serializeInt32(_data.hash, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.groups.count)) - for item in _data.groups { - item.serialize(buffer, true) - } - break - case .emojiGroupsNotModified: - if boxed { - buffer.appendInt32(1874111879) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .emojiGroups(let _data): - return ("emojiGroups", [("hash", ConstructorParameterDescription(_data.hash)), ("groups", ConstructorParameterDescription(_data.groups))]) - case .emojiGroupsNotModified: - return ("emojiGroupsNotModified", []) - } - } - - public static func parse_emojiGroups(_ reader: BufferReader) -> EmojiGroups? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.EmojiGroup]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiGroup.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.messages.EmojiGroups.emojiGroups(Cons_emojiGroups(hash: _1!, groups: _2!)) - } - else { - return nil - } - } - public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? { - return Api.messages.EmojiGroups.emojiGroupsNotModified - } - } -} diff --git a/submodules/TelegramApi/Sources/Api35.swift b/submodules/TelegramApi/Sources/Api35.swift index 15431344d4..52a9f95471 100644 --- a/submodules/TelegramApi/Sources/Api35.swift +++ b/submodules/TelegramApi/Sources/Api35.swift @@ -1,3 +1,585 @@ +public extension Api.messages { + enum DialogFilters: TypeConstructorDescription { + public class Cons_dialogFilters: TypeConstructorDescription { + public var flags: Int32 + public var filters: [Api.DialogFilter] + public init(flags: Int32, filters: [Api.DialogFilter]) { + self.flags = flags + self.filters = filters + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("dialogFilters", [("flags", ConstructorParameterDescription(self.flags)), ("filters", ConstructorParameterDescription(self.filters))]) + } + } + case dialogFilters(Cons_dialogFilters) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .dialogFilters(let _data): + if boxed { + buffer.appendInt32(718878489) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.filters.count)) + for item in _data.filters { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .dialogFilters(let _data): + return ("dialogFilters", [("flags", ConstructorParameterDescription(_data.flags)), ("filters", ConstructorParameterDescription(_data.filters))]) + } + } + + public static func parse_dialogFilters(_ reader: BufferReader) -> DialogFilters? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.DialogFilter]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.DialogFilter.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.messages.DialogFilters.dialogFilters(Cons_dialogFilters(flags: _1!, filters: _2!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum Dialogs: TypeConstructorDescription { + public class Cons_dialogs: TypeConstructorDescription { + public var dialogs: [Api.Dialog] + public var messages: [Api.Message] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { + self.dialogs = dialogs + self.messages = messages + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("dialogs", [("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + public class Cons_dialogsNotModified: TypeConstructorDescription { + public var count: Int32 + public init(count: Int32) { + self.count = count + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("dialogsNotModified", [("count", ConstructorParameterDescription(self.count))]) + } + } + public class Cons_dialogsSlice: TypeConstructorDescription { + public var count: Int32 + public var dialogs: [Api.Dialog] + public var messages: [Api.Message] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(count: Int32, dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { + self.count = count + self.dialogs = dialogs + self.messages = messages + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("dialogsSlice", [("count", ConstructorParameterDescription(self.count)), ("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case dialogs(Cons_dialogs) + case dialogsNotModified(Cons_dialogsNotModified) + case dialogsSlice(Cons_dialogsSlice) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .dialogs(let _data): + if boxed { + buffer.appendInt32(364538944) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.dialogs.count)) + for item in _data.dialogs { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .dialogsNotModified(let _data): + if boxed { + buffer.appendInt32(-253500010) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + break + case .dialogsSlice(let _data): + if boxed { + buffer.appendInt32(1910543603) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.dialogs.count)) + for item in _data.dialogs { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .dialogs(let _data): + return ("dialogs", [("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + case .dialogsNotModified(let _data): + return ("dialogsNotModified", [("count", ConstructorParameterDescription(_data.count))]) + case .dialogsSlice(let _data): + return ("dialogsSlice", [("count", ConstructorParameterDescription(_data.count)), ("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_dialogs(_ reader: BufferReader) -> Dialogs? { + var _1: [Api.Dialog]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) + } + var _2: [Api.Message]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _3: [Api.Chat]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.messages.Dialogs.dialogs(Cons_dialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!)) + } + else { + return nil + } + } + public static func parse_dialogsNotModified(_ reader: BufferReader) -> Dialogs? { + var _1: Int32? + _1 = reader.readInt32() + let _c1 = _1 != nil + if _c1 { + return Api.messages.Dialogs.dialogsNotModified(Cons_dialogsNotModified(count: _1!)) + } + else { + return nil + } + } + public static func parse_dialogsSlice(_ reader: BufferReader) -> Dialogs? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.Dialog]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) + } + var _3: [Api.Message]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _4: [Api.Chat]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _5: [Api.User]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.messages.Dialogs.dialogsSlice(Cons_dialogsSlice(count: _1!, dialogs: _2!, messages: _3!, chats: _4!, users: _5!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum DiscussionMessage: TypeConstructorDescription { + public class Cons_discussionMessage: TypeConstructorDescription { + public var flags: Int32 + public var messages: [Api.Message] + public var maxId: Int32? + public var readInboxMaxId: Int32? + public var readOutboxMaxId: Int32? + public var unreadCount: Int32 + public var chats: [Api.Chat] + public var users: [Api.User] + public init(flags: Int32, messages: [Api.Message], maxId: Int32?, readInboxMaxId: Int32?, readOutboxMaxId: Int32?, unreadCount: Int32, chats: [Api.Chat], users: [Api.User]) { + self.flags = flags + self.messages = messages + self.maxId = maxId + self.readInboxMaxId = readInboxMaxId + self.readOutboxMaxId = readOutboxMaxId + self.unreadCount = unreadCount + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("discussionMessage", [("flags", ConstructorParameterDescription(self.flags)), ("messages", ConstructorParameterDescription(self.messages)), ("maxId", ConstructorParameterDescription(self.maxId)), ("readInboxMaxId", ConstructorParameterDescription(self.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(self.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(self.unreadCount)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case discussionMessage(Cons_discussionMessage) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .discussionMessage(let _data): + if boxed { + buffer.appendInt32(-1506535550) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + item.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.maxId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.readInboxMaxId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt32(_data.readOutboxMaxId!, buffer: buffer, boxed: false) + } + serializeInt32(_data.unreadCount, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .discussionMessage(let _data): + return ("discussionMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("messages", ConstructorParameterDescription(_data.messages)), ("maxId", ConstructorParameterDescription(_data.maxId)), ("readInboxMaxId", ConstructorParameterDescription(_data.readInboxMaxId)), ("readOutboxMaxId", ConstructorParameterDescription(_data.readOutboxMaxId)), ("unreadCount", ConstructorParameterDescription(_data.unreadCount)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_discussionMessage(_ reader: BufferReader) -> DiscussionMessage? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.Message]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _3: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _3 = reader.readInt32() + } + var _4: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _4 = reader.readInt32() + } + var _5: Int32? + if Int(_1!) & Int(1 << 2) != 0 { + _5 = reader.readInt32() + } + var _6: Int32? + _6 = reader.readInt32() + var _7: [Api.Chat]? + if let _ = reader.readInt32() { + _7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _8: [Api.User]? + if let _ = reader.readInt32() { + _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil + let _c6 = _6 != nil + let _c7 = _7 != nil + let _c8 = _8 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 { + return Api.messages.DiscussionMessage.discussionMessage(Cons_discussionMessage(flags: _1!, messages: _2!, maxId: _3, readInboxMaxId: _4, readOutboxMaxId: _5, unreadCount: _6!, chats: _7!, users: _8!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum EmojiGameInfo: TypeConstructorDescription { + public class Cons_emojiGameDiceInfo: TypeConstructorDescription { + public var flags: Int32 + public var gameHash: String + public var prevStake: Int64 + public var currentStreak: Int32 + public var params: [Int32] + public var playsLeft: Int32? + public init(flags: Int32, gameHash: String, prevStake: Int64, currentStreak: Int32, params: [Int32], playsLeft: Int32?) { + self.flags = flags + self.gameHash = gameHash + self.prevStake = prevStake + self.currentStreak = currentStreak + self.params = params + self.playsLeft = playsLeft + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("emojiGameDiceInfo", [("flags", ConstructorParameterDescription(self.flags)), ("gameHash", ConstructorParameterDescription(self.gameHash)), ("prevStake", ConstructorParameterDescription(self.prevStake)), ("currentStreak", ConstructorParameterDescription(self.currentStreak)), ("params", ConstructorParameterDescription(self.params)), ("playsLeft", ConstructorParameterDescription(self.playsLeft))]) + } + } + case emojiGameDiceInfo(Cons_emojiGameDiceInfo) + case emojiGameUnavailable + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .emojiGameDiceInfo(let _data): + if boxed { + buffer.appendInt32(1155883043) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeString(_data.gameHash, buffer: buffer, boxed: false) + serializeInt64(_data.prevStake, buffer: buffer, boxed: false) + serializeInt32(_data.currentStreak, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.params.count)) + for item in _data.params { + serializeInt32(item, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.playsLeft!, buffer: buffer, boxed: false) + } + break + case .emojiGameUnavailable: + if boxed { + buffer.appendInt32(1508266805) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .emojiGameDiceInfo(let _data): + return ("emojiGameDiceInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("gameHash", ConstructorParameterDescription(_data.gameHash)), ("prevStake", ConstructorParameterDescription(_data.prevStake)), ("currentStreak", ConstructorParameterDescription(_data.currentStreak)), ("params", ConstructorParameterDescription(_data.params)), ("playsLeft", ConstructorParameterDescription(_data.playsLeft))]) + case .emojiGameUnavailable: + return ("emojiGameUnavailable", []) + } + } + + public static func parse_emojiGameDiceInfo(_ reader: BufferReader) -> EmojiGameInfo? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: [Int32]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: -1471112230, elementType: Int32.self) + } + var _6: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _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 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.messages.EmojiGameInfo.emojiGameDiceInfo(Cons_emojiGameDiceInfo(flags: _1!, gameHash: _2!, prevStake: _3!, currentStreak: _4!, params: _5!, playsLeft: _6)) + } + else { + return nil + } + } + public static func parse_emojiGameUnavailable(_ reader: BufferReader) -> EmojiGameInfo? { + return Api.messages.EmojiGameInfo.emojiGameUnavailable + } + } +} +public extension Api.messages { + enum EmojiGameOutcome: TypeConstructorDescription { + public class Cons_emojiGameOutcome: TypeConstructorDescription { + public var seed: Buffer + public var stakeTonAmount: Int64 + public var tonAmount: Int64 + public init(seed: Buffer, stakeTonAmount: Int64, tonAmount: Int64) { + self.seed = seed + self.stakeTonAmount = stakeTonAmount + self.tonAmount = tonAmount + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("emojiGameOutcome", [("seed", ConstructorParameterDescription(self.seed)), ("stakeTonAmount", ConstructorParameterDescription(self.stakeTonAmount)), ("tonAmount", ConstructorParameterDescription(self.tonAmount))]) + } + } + case emojiGameOutcome(Cons_emojiGameOutcome) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .emojiGameOutcome(let _data): + if boxed { + buffer.appendInt32(-634726841) + } + serializeBytes(_data.seed, buffer: buffer, boxed: false) + serializeInt64(_data.stakeTonAmount, buffer: buffer, boxed: false) + serializeInt64(_data.tonAmount, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .emojiGameOutcome(let _data): + return ("emojiGameOutcome", [("seed", ConstructorParameterDescription(_data.seed)), ("stakeTonAmount", ConstructorParameterDescription(_data.stakeTonAmount)), ("tonAmount", ConstructorParameterDescription(_data.tonAmount))]) + } + } + + public static func parse_emojiGameOutcome(_ reader: BufferReader) -> EmojiGameOutcome? { + var _1: Buffer? + _1 = parseBytes(reader) + var _2: Int64? + _2 = reader.readInt64() + var _3: Int64? + _3 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.messages.EmojiGameOutcome.emojiGameOutcome(Cons_emojiGameOutcome(seed: _1!, stakeTonAmount: _2!, tonAmount: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum EmojiGroups: TypeConstructorDescription { + public class Cons_emojiGroups: TypeConstructorDescription { + public var hash: Int32 + public var groups: [Api.EmojiGroup] + public init(hash: Int32, groups: [Api.EmojiGroup]) { + self.hash = hash + self.groups = groups + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("emojiGroups", [("hash", ConstructorParameterDescription(self.hash)), ("groups", ConstructorParameterDescription(self.groups))]) + } + } + case emojiGroups(Cons_emojiGroups) + case emojiGroupsNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .emojiGroups(let _data): + if boxed { + buffer.appendInt32(-2011186869) + } + serializeInt32(_data.hash, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.groups.count)) + for item in _data.groups { + item.serialize(buffer, true) + } + break + case .emojiGroupsNotModified: + if boxed { + buffer.appendInt32(1874111879) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .emojiGroups(let _data): + return ("emojiGroups", [("hash", ConstructorParameterDescription(_data.hash)), ("groups", ConstructorParameterDescription(_data.groups))]) + case .emojiGroupsNotModified: + return ("emojiGroupsNotModified", []) + } + } + + public static func parse_emojiGroups(_ reader: BufferReader) -> EmojiGroups? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.EmojiGroup]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EmojiGroup.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.messages.EmojiGroups.emojiGroups(Cons_emojiGroups(hash: _1!, groups: _2!)) + } + else { + return nil + } + } + public static func parse_emojiGroupsNotModified(_ reader: BufferReader) -> EmojiGroups? { + return Api.messages.EmojiGroups.emojiGroupsNotModified + } + } +} public extension Api.messages { enum ExportedChatInvite: TypeConstructorDescription { public class Cons_exportedChatInvite: TypeConstructorDescription { @@ -1480,469 +2062,3 @@ public extension Api.messages { } } } -public extension Api.messages { - enum MyStickers: TypeConstructorDescription { - public class Cons_myStickers: TypeConstructorDescription { - public var count: Int32 - public var sets: [Api.StickerSetCovered] - public init(count: Int32, sets: [Api.StickerSetCovered]) { - self.count = count - self.sets = sets - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("myStickers", [("count", ConstructorParameterDescription(self.count)), ("sets", ConstructorParameterDescription(self.sets))]) - } - } - case myStickers(Cons_myStickers) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .myStickers(let _data): - if boxed { - buffer.appendInt32(-83926371) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.sets.count)) - for item in _data.sets { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .myStickers(let _data): - return ("myStickers", [("count", ConstructorParameterDescription(_data.count)), ("sets", ConstructorParameterDescription(_data.sets))]) - } - } - - public static func parse_myStickers(_ reader: BufferReader) -> MyStickers? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.StickerSetCovered]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.messages.MyStickers.myStickers(Cons_myStickers(count: _1!, sets: _2!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum PeerDialogs: TypeConstructorDescription { - public class Cons_peerDialogs: TypeConstructorDescription { - public var dialogs: [Api.Dialog] - public var messages: [Api.Message] - public var chats: [Api.Chat] - public var users: [Api.User] - public var state: Api.updates.State - public init(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], state: Api.updates.State) { - self.dialogs = dialogs - self.messages = messages - self.chats = chats - self.users = users - self.state = state - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("peerDialogs", [("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("state", ConstructorParameterDescription(self.state))]) - } - } - case peerDialogs(Cons_peerDialogs) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .peerDialogs(let _data): - if boxed { - buffer.appendInt32(863093588) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.dialogs.count)) - for item in _data.dialogs { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - _data.state.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .peerDialogs(let _data): - return ("peerDialogs", [("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("state", ConstructorParameterDescription(_data.state))]) - } - } - - public static func parse_peerDialogs(_ reader: BufferReader) -> PeerDialogs? { - var _1: [Api.Dialog]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) - } - var _2: [Api.Message]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) - } - var _3: [Api.Chat]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - var _5: Api.updates.State? - if let signature = reader.readInt32() { - _5 = Api.parse(reader, signature: signature) as? Api.updates.State - } - 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.messages.PeerDialogs.peerDialogs(Cons_peerDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!, state: _5!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum PeerSettings: TypeConstructorDescription { - public class Cons_peerSettings: TypeConstructorDescription { - public var settings: Api.PeerSettings - public var chats: [Api.Chat] - public var users: [Api.User] - public init(settings: Api.PeerSettings, chats: [Api.Chat], users: [Api.User]) { - self.settings = settings - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("peerSettings", [("settings", ConstructorParameterDescription(self.settings)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case peerSettings(Cons_peerSettings) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .peerSettings(let _data): - if boxed { - buffer.appendInt32(1753266509) - } - _data.settings.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .peerSettings(let _data): - return ("peerSettings", [("settings", ConstructorParameterDescription(_data.settings)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_peerSettings(_ reader: BufferReader) -> PeerSettings? { - var _1: Api.PeerSettings? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.PeerSettings - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.messages.PeerSettings.peerSettings(Cons_peerSettings(settings: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum PreparedInlineMessage: TypeConstructorDescription { - public class Cons_preparedInlineMessage: TypeConstructorDescription { - public var queryId: Int64 - public var result: Api.BotInlineResult - public var peerTypes: [Api.InlineQueryPeerType] - public var cacheTime: Int32 - public var users: [Api.User] - public init(queryId: Int64, result: Api.BotInlineResult, peerTypes: [Api.InlineQueryPeerType], cacheTime: Int32, users: [Api.User]) { - self.queryId = queryId - self.result = result - self.peerTypes = peerTypes - self.cacheTime = cacheTime - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("preparedInlineMessage", [("queryId", ConstructorParameterDescription(self.queryId)), ("result", ConstructorParameterDescription(self.result)), ("peerTypes", ConstructorParameterDescription(self.peerTypes)), ("cacheTime", ConstructorParameterDescription(self.cacheTime)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case preparedInlineMessage(Cons_preparedInlineMessage) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .preparedInlineMessage(let _data): - if boxed { - buffer.appendInt32(-11046771) - } - serializeInt64(_data.queryId, buffer: buffer, boxed: false) - _data.result.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.peerTypes.count)) - for item in _data.peerTypes { - item.serialize(buffer, true) - } - serializeInt32(_data.cacheTime, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .preparedInlineMessage(let _data): - return ("preparedInlineMessage", [("queryId", ConstructorParameterDescription(_data.queryId)), ("result", ConstructorParameterDescription(_data.result)), ("peerTypes", ConstructorParameterDescription(_data.peerTypes)), ("cacheTime", ConstructorParameterDescription(_data.cacheTime)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_preparedInlineMessage(_ reader: BufferReader) -> PreparedInlineMessage? { - var _1: Int64? - _1 = reader.readInt64() - var _2: Api.BotInlineResult? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.BotInlineResult - } - var _3: [Api.InlineQueryPeerType]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InlineQueryPeerType.self) - } - var _4: Int32? - _4 = reader.readInt32() - var _5: [Api.User]? - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.messages.PreparedInlineMessage.preparedInlineMessage(Cons_preparedInlineMessage(queryId: _1!, result: _2!, peerTypes: _3!, cacheTime: _4!, users: _5!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum QuickReplies: TypeConstructorDescription { - public class Cons_quickReplies: TypeConstructorDescription { - public var quickReplies: [Api.QuickReply] - public var messages: [Api.Message] - public var chats: [Api.Chat] - public var users: [Api.User] - public init(quickReplies: [Api.QuickReply], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { - self.quickReplies = quickReplies - self.messages = messages - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("quickReplies", [("quickReplies", ConstructorParameterDescription(self.quickReplies)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case quickReplies(Cons_quickReplies) - case quickRepliesNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .quickReplies(let _data): - if boxed { - buffer.appendInt32(-963811691) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.quickReplies.count)) - for item in _data.quickReplies { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.messages.count)) - for item in _data.messages { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - case .quickRepliesNotModified: - if boxed { - buffer.appendInt32(1603398491) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .quickReplies(let _data): - return ("quickReplies", [("quickReplies", ConstructorParameterDescription(_data.quickReplies)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - case .quickRepliesNotModified: - return ("quickRepliesNotModified", []) - } - } - - public static func parse_quickReplies(_ reader: BufferReader) -> QuickReplies? { - var _1: [Api.QuickReply]? - if let _ = reader.readInt32() { - _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.QuickReply.self) - } - var _2: [Api.Message]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) - } - var _3: [Api.Chat]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.messages.QuickReplies.quickReplies(Cons_quickReplies(quickReplies: _1!, messages: _2!, chats: _3!, users: _4!)) - } - else { - return nil - } - } - public static func parse_quickRepliesNotModified(_ reader: BufferReader) -> QuickReplies? { - return Api.messages.QuickReplies.quickRepliesNotModified - } - } -} -public extension Api.messages { - enum Reactions: TypeConstructorDescription { - public class Cons_reactions: TypeConstructorDescription { - public var hash: Int64 - public var reactions: [Api.Reaction] - public init(hash: Int64, reactions: [Api.Reaction]) { - self.hash = hash - self.reactions = reactions - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("reactions", [("hash", ConstructorParameterDescription(self.hash)), ("reactions", ConstructorParameterDescription(self.reactions))]) - } - } - case reactions(Cons_reactions) - case reactionsNotModified - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .reactions(let _data): - if boxed { - buffer.appendInt32(-352454890) - } - serializeInt64(_data.hash, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.reactions.count)) - for item in _data.reactions { - item.serialize(buffer, true) - } - break - case .reactionsNotModified: - if boxed { - buffer.appendInt32(-1334846497) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .reactions(let _data): - return ("reactions", [("hash", ConstructorParameterDescription(_data.hash)), ("reactions", ConstructorParameterDescription(_data.reactions))]) - case .reactionsNotModified: - return ("reactionsNotModified", []) - } - } - - public static func parse_reactions(_ reader: BufferReader) -> Reactions? { - var _1: Int64? - _1 = reader.readInt64() - var _2: [Api.Reaction]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Reaction.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.messages.Reactions.reactions(Cons_reactions(hash: _1!, reactions: _2!)) - } - else { - return nil - } - } - public static func parse_reactionsNotModified(_ reader: BufferReader) -> Reactions? { - return Api.messages.Reactions.reactionsNotModified - } - } -} diff --git a/submodules/TelegramApi/Sources/Api36.swift b/submodules/TelegramApi/Sources/Api36.swift index 2ad050397d..5ebc6101e0 100644 --- a/submodules/TelegramApi/Sources/Api36.swift +++ b/submodules/TelegramApi/Sources/Api36.swift @@ -1,3 +1,469 @@ +public extension Api.messages { + enum MyStickers: TypeConstructorDescription { + public class Cons_myStickers: TypeConstructorDescription { + public var count: Int32 + public var sets: [Api.StickerSetCovered] + public init(count: Int32, sets: [Api.StickerSetCovered]) { + self.count = count + self.sets = sets + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("myStickers", [("count", ConstructorParameterDescription(self.count)), ("sets", ConstructorParameterDescription(self.sets))]) + } + } + case myStickers(Cons_myStickers) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .myStickers(let _data): + if boxed { + buffer.appendInt32(-83926371) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.sets.count)) + for item in _data.sets { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .myStickers(let _data): + return ("myStickers", [("count", ConstructorParameterDescription(_data.count)), ("sets", ConstructorParameterDescription(_data.sets))]) + } + } + + public static func parse_myStickers(_ reader: BufferReader) -> MyStickers? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.StickerSetCovered]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.messages.MyStickers.myStickers(Cons_myStickers(count: _1!, sets: _2!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum PeerDialogs: TypeConstructorDescription { + public class Cons_peerDialogs: TypeConstructorDescription { + public var dialogs: [Api.Dialog] + public var messages: [Api.Message] + public var chats: [Api.Chat] + public var users: [Api.User] + public var state: Api.updates.State + public init(dialogs: [Api.Dialog], messages: [Api.Message], chats: [Api.Chat], users: [Api.User], state: Api.updates.State) { + self.dialogs = dialogs + self.messages = messages + self.chats = chats + self.users = users + self.state = state + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("peerDialogs", [("dialogs", ConstructorParameterDescription(self.dialogs)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("state", ConstructorParameterDescription(self.state))]) + } + } + case peerDialogs(Cons_peerDialogs) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .peerDialogs(let _data): + if boxed { + buffer.appendInt32(863093588) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.dialogs.count)) + for item in _data.dialogs { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + _data.state.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .peerDialogs(let _data): + return ("peerDialogs", [("dialogs", ConstructorParameterDescription(_data.dialogs)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("state", ConstructorParameterDescription(_data.state))]) + } + } + + public static func parse_peerDialogs(_ reader: BufferReader) -> PeerDialogs? { + var _1: [Api.Dialog]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Dialog.self) + } + var _2: [Api.Message]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _3: [Api.Chat]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + var _5: Api.updates.State? + if let signature = reader.readInt32() { + _5 = Api.parse(reader, signature: signature) as? Api.updates.State + } + 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.messages.PeerDialogs.peerDialogs(Cons_peerDialogs(dialogs: _1!, messages: _2!, chats: _3!, users: _4!, state: _5!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum PeerSettings: TypeConstructorDescription { + public class Cons_peerSettings: TypeConstructorDescription { + public var settings: Api.PeerSettings + public var chats: [Api.Chat] + public var users: [Api.User] + public init(settings: Api.PeerSettings, chats: [Api.Chat], users: [Api.User]) { + self.settings = settings + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("peerSettings", [("settings", ConstructorParameterDescription(self.settings)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case peerSettings(Cons_peerSettings) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .peerSettings(let _data): + if boxed { + buffer.appendInt32(1753266509) + } + _data.settings.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .peerSettings(let _data): + return ("peerSettings", [("settings", ConstructorParameterDescription(_data.settings)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_peerSettings(_ reader: BufferReader) -> PeerSettings? { + var _1: Api.PeerSettings? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.PeerSettings + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.messages.PeerSettings.peerSettings(Cons_peerSettings(settings: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum PreparedInlineMessage: TypeConstructorDescription { + public class Cons_preparedInlineMessage: TypeConstructorDescription { + public var queryId: Int64 + public var result: Api.BotInlineResult + public var peerTypes: [Api.InlineQueryPeerType] + public var cacheTime: Int32 + public var users: [Api.User] + public init(queryId: Int64, result: Api.BotInlineResult, peerTypes: [Api.InlineQueryPeerType], cacheTime: Int32, users: [Api.User]) { + self.queryId = queryId + self.result = result + self.peerTypes = peerTypes + self.cacheTime = cacheTime + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("preparedInlineMessage", [("queryId", ConstructorParameterDescription(self.queryId)), ("result", ConstructorParameterDescription(self.result)), ("peerTypes", ConstructorParameterDescription(self.peerTypes)), ("cacheTime", ConstructorParameterDescription(self.cacheTime)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case preparedInlineMessage(Cons_preparedInlineMessage) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .preparedInlineMessage(let _data): + if boxed { + buffer.appendInt32(-11046771) + } + serializeInt64(_data.queryId, buffer: buffer, boxed: false) + _data.result.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.peerTypes.count)) + for item in _data.peerTypes { + item.serialize(buffer, true) + } + serializeInt32(_data.cacheTime, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .preparedInlineMessage(let _data): + return ("preparedInlineMessage", [("queryId", ConstructorParameterDescription(_data.queryId)), ("result", ConstructorParameterDescription(_data.result)), ("peerTypes", ConstructorParameterDescription(_data.peerTypes)), ("cacheTime", ConstructorParameterDescription(_data.cacheTime)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_preparedInlineMessage(_ reader: BufferReader) -> PreparedInlineMessage? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Api.BotInlineResult? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.BotInlineResult + } + var _3: [Api.InlineQueryPeerType]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InlineQueryPeerType.self) + } + var _4: Int32? + _4 = reader.readInt32() + var _5: [Api.User]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.messages.PreparedInlineMessage.preparedInlineMessage(Cons_preparedInlineMessage(queryId: _1!, result: _2!, peerTypes: _3!, cacheTime: _4!, users: _5!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum QuickReplies: TypeConstructorDescription { + public class Cons_quickReplies: TypeConstructorDescription { + public var quickReplies: [Api.QuickReply] + public var messages: [Api.Message] + public var chats: [Api.Chat] + public var users: [Api.User] + public init(quickReplies: [Api.QuickReply], messages: [Api.Message], chats: [Api.Chat], users: [Api.User]) { + self.quickReplies = quickReplies + self.messages = messages + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("quickReplies", [("quickReplies", ConstructorParameterDescription(self.quickReplies)), ("messages", ConstructorParameterDescription(self.messages)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case quickReplies(Cons_quickReplies) + case quickRepliesNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .quickReplies(let _data): + if boxed { + buffer.appendInt32(-963811691) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.quickReplies.count)) + for item in _data.quickReplies { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.messages.count)) + for item in _data.messages { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + case .quickRepliesNotModified: + if boxed { + buffer.appendInt32(1603398491) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .quickReplies(let _data): + return ("quickReplies", [("quickReplies", ConstructorParameterDescription(_data.quickReplies)), ("messages", ConstructorParameterDescription(_data.messages)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + case .quickRepliesNotModified: + return ("quickRepliesNotModified", []) + } + } + + public static func parse_quickReplies(_ reader: BufferReader) -> QuickReplies? { + var _1: [Api.QuickReply]? + if let _ = reader.readInt32() { + _1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.QuickReply.self) + } + var _2: [Api.Message]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self) + } + var _3: [Api.Chat]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.messages.QuickReplies.quickReplies(Cons_quickReplies(quickReplies: _1!, messages: _2!, chats: _3!, users: _4!)) + } + else { + return nil + } + } + public static func parse_quickRepliesNotModified(_ reader: BufferReader) -> QuickReplies? { + return Api.messages.QuickReplies.quickRepliesNotModified + } + } +} +public extension Api.messages { + enum Reactions: TypeConstructorDescription { + public class Cons_reactions: TypeConstructorDescription { + public var hash: Int64 + public var reactions: [Api.Reaction] + public init(hash: Int64, reactions: [Api.Reaction]) { + self.hash = hash + self.reactions = reactions + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("reactions", [("hash", ConstructorParameterDescription(self.hash)), ("reactions", ConstructorParameterDescription(self.reactions))]) + } + } + case reactions(Cons_reactions) + case reactionsNotModified + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .reactions(let _data): + if boxed { + buffer.appendInt32(-352454890) + } + serializeInt64(_data.hash, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.reactions.count)) + for item in _data.reactions { + item.serialize(buffer, true) + } + break + case .reactionsNotModified: + if boxed { + buffer.appendInt32(-1334846497) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .reactions(let _data): + return ("reactions", [("hash", ConstructorParameterDescription(_data.hash)), ("reactions", ConstructorParameterDescription(_data.reactions))]) + case .reactionsNotModified: + return ("reactionsNotModified", []) + } + } + + public static func parse_reactions(_ reader: BufferReader) -> Reactions? { + var _1: Int64? + _1 = reader.readInt64() + var _2: [Api.Reaction]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Reaction.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.messages.Reactions.reactions(Cons_reactions(hash: _1!, reactions: _2!)) + } + else { + return nil + } + } + public static func parse_reactionsNotModified(_ reader: BufferReader) -> Reactions? { + return Api.messages.Reactions.reactionsNotModified + } + } +} public extension Api.messages { enum RecentStickers: TypeConstructorDescription { public class Cons_recentStickers: TypeConstructorDescription { @@ -1198,542 +1664,3 @@ public extension Api.messages { } } } -public extension Api.messages { - enum VotesList: TypeConstructorDescription { - public class Cons_votesList: TypeConstructorDescription { - public var flags: Int32 - public var count: Int32 - public var votes: [Api.MessagePeerVote] - public var chats: [Api.Chat] - public var users: [Api.User] - public var nextOffset: String? - public init(flags: Int32, count: Int32, votes: [Api.MessagePeerVote], chats: [Api.Chat], users: [Api.User], nextOffset: String?) { - self.flags = flags - self.count = count - self.votes = votes - self.chats = chats - self.users = users - self.nextOffset = nextOffset - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("votesList", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("votes", ConstructorParameterDescription(self.votes)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))]) - } - } - case votesList(Cons_votesList) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .votesList(let _data): - if boxed { - buffer.appendInt32(1218005070) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.count, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.votes.count)) - for item in _data.votes { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.nextOffset!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .votesList(let _data): - return ("votesList", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("votes", ConstructorParameterDescription(_data.votes)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))]) - } - } - - public static func parse_votesList(_ reader: BufferReader) -> VotesList? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: [Api.MessagePeerVote]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessagePeerVote.self) - } - var _4: [Api.Chat]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _5: [Api.User]? - if let _ = reader.readInt32() { - _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - var _6: String? - if Int(_1!) & Int(1 << 0) != 0 { - _6 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { - return Api.messages.VotesList.votesList(Cons_votesList(flags: _1!, count: _2!, votes: _3!, chats: _4!, users: _5!, nextOffset: _6)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - enum WebPage: TypeConstructorDescription { - public class Cons_webPage: TypeConstructorDescription { - public var webpage: Api.WebPage - public var chats: [Api.Chat] - public var users: [Api.User] - public init(webpage: Api.WebPage, chats: [Api.Chat], users: [Api.User]) { - self.webpage = webpage - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("webPage", [("webpage", ConstructorParameterDescription(self.webpage)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case webPage(Cons_webPage) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .webPage(let _data): - if boxed { - buffer.appendInt32(-44166467) - } - _data.webpage.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .webPage(let _data): - return ("webPage", [("webpage", ConstructorParameterDescription(_data.webpage)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_webPage(_ reader: BufferReader) -> WebPage? { - var _1: Api.WebPage? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.WebPage - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.messages.WebPage.webPage(Cons_webPage(webpage: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.messages { - indirect enum WebPagePreview: TypeConstructorDescription { - public class Cons_webPagePreview: TypeConstructorDescription { - public var media: Api.MessageMedia - public var chats: [Api.Chat] - public var users: [Api.User] - public init(media: Api.MessageMedia, chats: [Api.Chat], users: [Api.User]) { - self.media = media - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("webPagePreview", [("media", ConstructorParameterDescription(self.media)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case webPagePreview(Cons_webPagePreview) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .webPagePreview(let _data): - if boxed { - buffer.appendInt32(-1936029524) - } - _data.media.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .webPagePreview(let _data): - return ("webPagePreview", [("media", ConstructorParameterDescription(_data.media)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_webPagePreview(_ reader: BufferReader) -> WebPagePreview? { - var _1: Api.MessageMedia? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.MessageMedia - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.messages.WebPagePreview.webPagePreview(Cons_webPagePreview(media: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum BankCardData: TypeConstructorDescription { - public class Cons_bankCardData: TypeConstructorDescription { - public var title: String - public var openUrls: [Api.BankCardOpenUrl] - public init(title: String, openUrls: [Api.BankCardOpenUrl]) { - self.title = title - self.openUrls = openUrls - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("bankCardData", [("title", ConstructorParameterDescription(self.title)), ("openUrls", ConstructorParameterDescription(self.openUrls))]) - } - } - case bankCardData(Cons_bankCardData) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .bankCardData(let _data): - if boxed { - buffer.appendInt32(1042605427) - } - serializeString(_data.title, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.openUrls.count)) - for item in _data.openUrls { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .bankCardData(let _data): - return ("bankCardData", [("title", ConstructorParameterDescription(_data.title)), ("openUrls", ConstructorParameterDescription(_data.openUrls))]) - } - } - - public static func parse_bankCardData(_ reader: BufferReader) -> BankCardData? { - var _1: String? - _1 = parseString(reader) - var _2: [Api.BankCardOpenUrl]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BankCardOpenUrl.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - if _c1 && _c2 { - return Api.payments.BankCardData.bankCardData(Cons_bankCardData(title: _1!, openUrls: _2!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum CheckCanSendGiftResult: TypeConstructorDescription { - public class Cons_checkCanSendGiftResultFail: TypeConstructorDescription { - public var reason: Api.TextWithEntities - public init(reason: Api.TextWithEntities) { - self.reason = reason - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("checkCanSendGiftResultFail", [("reason", ConstructorParameterDescription(self.reason))]) - } - } - case checkCanSendGiftResultFail(Cons_checkCanSendGiftResultFail) - case checkCanSendGiftResultOk - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .checkCanSendGiftResultFail(let _data): - if boxed { - buffer.appendInt32(-706379148) - } - _data.reason.serialize(buffer, true) - break - case .checkCanSendGiftResultOk: - if boxed { - buffer.appendInt32(927967149) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .checkCanSendGiftResultFail(let _data): - return ("checkCanSendGiftResultFail", [("reason", ConstructorParameterDescription(_data.reason))]) - case .checkCanSendGiftResultOk: - return ("checkCanSendGiftResultOk", []) - } - } - - public static func parse_checkCanSendGiftResultFail(_ reader: BufferReader) -> CheckCanSendGiftResult? { - var _1: Api.TextWithEntities? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.TextWithEntities - } - let _c1 = _1 != nil - if _c1 { - return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultFail(Cons_checkCanSendGiftResultFail(reason: _1!)) - } - else { - return nil - } - } - public static func parse_checkCanSendGiftResultOk(_ reader: BufferReader) -> CheckCanSendGiftResult? { - return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultOk - } - } -} -public extension Api.payments { - enum CheckedGiftCode: TypeConstructorDescription { - public class Cons_checkedGiftCode: TypeConstructorDescription { - public var flags: Int32 - public var fromId: Api.Peer? - public var giveawayMsgId: Int32? - public var toId: Int64? - public var date: Int32 - public var days: Int32 - public var usedDate: Int32? - public var chats: [Api.Chat] - public var users: [Api.User] - public init(flags: Int32, fromId: Api.Peer?, giveawayMsgId: Int32?, toId: Int64?, date: Int32, days: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User]) { - self.flags = flags - self.fromId = fromId - self.giveawayMsgId = giveawayMsgId - self.toId = toId - self.date = date - self.days = days - self.usedDate = usedDate - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("checkedGiftCode", [("flags", ConstructorParameterDescription(self.flags)), ("fromId", ConstructorParameterDescription(self.fromId)), ("giveawayMsgId", ConstructorParameterDescription(self.giveawayMsgId)), ("toId", ConstructorParameterDescription(self.toId)), ("date", ConstructorParameterDescription(self.date)), ("days", ConstructorParameterDescription(self.days)), ("usedDate", ConstructorParameterDescription(self.usedDate)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case checkedGiftCode(Cons_checkedGiftCode) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .checkedGiftCode(let _data): - if boxed { - buffer.appendInt32(-342343793) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 4) != 0 { - _data.fromId!.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt32(_data.giveawayMsgId!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt64(_data.toId!, buffer: buffer, boxed: false) - } - serializeInt32(_data.date, buffer: buffer, boxed: false) - serializeInt32(_data.days, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 1) != 0 { - serializeInt32(_data.usedDate!, buffer: buffer, boxed: false) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .checkedGiftCode(let _data): - return ("checkedGiftCode", [("flags", ConstructorParameterDescription(_data.flags)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("giveawayMsgId", ConstructorParameterDescription(_data.giveawayMsgId)), ("toId", ConstructorParameterDescription(_data.toId)), ("date", ConstructorParameterDescription(_data.date)), ("days", ConstructorParameterDescription(_data.days)), ("usedDate", ConstructorParameterDescription(_data.usedDate)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_checkedGiftCode(_ reader: BufferReader) -> CheckedGiftCode? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.Peer? - if Int(_1!) & Int(1 << 4) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.Peer - } - } - var _3: Int32? - if Int(_1!) & Int(1 << 3) != 0 { - _3 = reader.readInt32() - } - var _4: Int64? - if Int(_1!) & Int(1 << 0) != 0 { - _4 = reader.readInt64() - } - var _5: Int32? - _5 = reader.readInt32() - var _6: Int32? - _6 = reader.readInt32() - var _7: Int32? - if Int(_1!) & Int(1 << 1) != 0 { - _7 = reader.readInt32() - } - var _8: [Api.Chat]? - if let _ = reader.readInt32() { - _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _9: [Api.User]? - if let _ = reader.readInt32() { - _9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil - let _c8 = _8 != nil - let _c9 = _9 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { - return Api.payments.CheckedGiftCode.checkedGiftCode(Cons_checkedGiftCode(flags: _1!, fromId: _2, giveawayMsgId: _3, toId: _4, date: _5!, days: _6!, usedDate: _7, chats: _8!, users: _9!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum ConnectedStarRefBots: TypeConstructorDescription { - public class Cons_connectedStarRefBots: TypeConstructorDescription { - public var count: Int32 - public var connectedBots: [Api.ConnectedBotStarRef] - public var users: [Api.User] - public init(count: Int32, connectedBots: [Api.ConnectedBotStarRef], users: [Api.User]) { - self.count = count - self.connectedBots = connectedBots - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("connectedStarRefBots", [("count", ConstructorParameterDescription(self.count)), ("connectedBots", ConstructorParameterDescription(self.connectedBots)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case connectedStarRefBots(Cons_connectedStarRefBots) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .connectedStarRefBots(let _data): - if boxed { - buffer.appendInt32(-1730811363) - } - serializeInt32(_data.count, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.connectedBots.count)) - for item in _data.connectedBots { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .connectedStarRefBots(let _data): - return ("connectedStarRefBots", [("count", ConstructorParameterDescription(_data.count)), ("connectedBots", ConstructorParameterDescription(_data.connectedBots)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_connectedStarRefBots(_ reader: BufferReader) -> ConnectedStarRefBots? { - var _1: Int32? - _1 = reader.readInt32() - var _2: [Api.ConnectedBotStarRef]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ConnectedBotStarRef.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.payments.ConnectedStarRefBots.connectedStarRefBots(Cons_connectedStarRefBots(count: _1!, connectedBots: _2!, users: _3!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api37.swift b/submodules/TelegramApi/Sources/Api37.swift index c4a2ad6d96..4da43721cf 100644 --- a/submodules/TelegramApi/Sources/Api37.swift +++ b/submodules/TelegramApi/Sources/Api37.swift @@ -1,3 +1,542 @@ +public extension Api.messages { + enum VotesList: TypeConstructorDescription { + public class Cons_votesList: TypeConstructorDescription { + public var flags: Int32 + public var count: Int32 + public var votes: [Api.MessagePeerVote] + public var chats: [Api.Chat] + public var users: [Api.User] + public var nextOffset: String? + public init(flags: Int32, count: Int32, votes: [Api.MessagePeerVote], chats: [Api.Chat], users: [Api.User], nextOffset: String?) { + self.flags = flags + self.count = count + self.votes = votes + self.chats = chats + self.users = users + self.nextOffset = nextOffset + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("votesList", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("votes", ConstructorParameterDescription(self.votes)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))]) + } + } + case votesList(Cons_votesList) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .votesList(let _data): + if boxed { + buffer.appendInt32(1218005070) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.count, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.votes.count)) + for item in _data.votes { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.nextOffset!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .votesList(let _data): + return ("votesList", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("votes", ConstructorParameterDescription(_data.votes)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))]) + } + } + + public static func parse_votesList(_ reader: BufferReader) -> VotesList? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: [Api.MessagePeerVote]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessagePeerVote.self) + } + var _4: [Api.Chat]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _5: [Api.User]? + if let _ = reader.readInt32() { + _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + var _6: String? + if Int(_1!) & Int(1 << 0) != 0 { + _6 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 { + return Api.messages.VotesList.votesList(Cons_votesList(flags: _1!, count: _2!, votes: _3!, chats: _4!, users: _5!, nextOffset: _6)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + enum WebPage: TypeConstructorDescription { + public class Cons_webPage: TypeConstructorDescription { + public var webpage: Api.WebPage + public var chats: [Api.Chat] + public var users: [Api.User] + public init(webpage: Api.WebPage, chats: [Api.Chat], users: [Api.User]) { + self.webpage = webpage + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("webPage", [("webpage", ConstructorParameterDescription(self.webpage)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case webPage(Cons_webPage) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .webPage(let _data): + if boxed { + buffer.appendInt32(-44166467) + } + _data.webpage.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .webPage(let _data): + return ("webPage", [("webpage", ConstructorParameterDescription(_data.webpage)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_webPage(_ reader: BufferReader) -> WebPage? { + var _1: Api.WebPage? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.WebPage + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.messages.WebPage.webPage(Cons_webPage(webpage: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.messages { + indirect enum WebPagePreview: TypeConstructorDescription { + public class Cons_webPagePreview: TypeConstructorDescription { + public var media: Api.MessageMedia + public var chats: [Api.Chat] + public var users: [Api.User] + public init(media: Api.MessageMedia, chats: [Api.Chat], users: [Api.User]) { + self.media = media + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("webPagePreview", [("media", ConstructorParameterDescription(self.media)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case webPagePreview(Cons_webPagePreview) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .webPagePreview(let _data): + if boxed { + buffer.appendInt32(-1936029524) + } + _data.media.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .webPagePreview(let _data): + return ("webPagePreview", [("media", ConstructorParameterDescription(_data.media)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_webPagePreview(_ reader: BufferReader) -> WebPagePreview? { + var _1: Api.MessageMedia? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.MessageMedia + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.messages.WebPagePreview.webPagePreview(Cons_webPagePreview(media: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum BankCardData: TypeConstructorDescription { + public class Cons_bankCardData: TypeConstructorDescription { + public var title: String + public var openUrls: [Api.BankCardOpenUrl] + public init(title: String, openUrls: [Api.BankCardOpenUrl]) { + self.title = title + self.openUrls = openUrls + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("bankCardData", [("title", ConstructorParameterDescription(self.title)), ("openUrls", ConstructorParameterDescription(self.openUrls))]) + } + } + case bankCardData(Cons_bankCardData) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .bankCardData(let _data): + if boxed { + buffer.appendInt32(1042605427) + } + serializeString(_data.title, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.openUrls.count)) + for item in _data.openUrls { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .bankCardData(let _data): + return ("bankCardData", [("title", ConstructorParameterDescription(_data.title)), ("openUrls", ConstructorParameterDescription(_data.openUrls))]) + } + } + + public static func parse_bankCardData(_ reader: BufferReader) -> BankCardData? { + var _1: String? + _1 = parseString(reader) + var _2: [Api.BankCardOpenUrl]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.BankCardOpenUrl.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.payments.BankCardData.bankCardData(Cons_bankCardData(title: _1!, openUrls: _2!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum CheckCanSendGiftResult: TypeConstructorDescription { + public class Cons_checkCanSendGiftResultFail: TypeConstructorDescription { + public var reason: Api.TextWithEntities + public init(reason: Api.TextWithEntities) { + self.reason = reason + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("checkCanSendGiftResultFail", [("reason", ConstructorParameterDescription(self.reason))]) + } + } + case checkCanSendGiftResultFail(Cons_checkCanSendGiftResultFail) + case checkCanSendGiftResultOk + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .checkCanSendGiftResultFail(let _data): + if boxed { + buffer.appendInt32(-706379148) + } + _data.reason.serialize(buffer, true) + break + case .checkCanSendGiftResultOk: + if boxed { + buffer.appendInt32(927967149) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .checkCanSendGiftResultFail(let _data): + return ("checkCanSendGiftResultFail", [("reason", ConstructorParameterDescription(_data.reason))]) + case .checkCanSendGiftResultOk: + return ("checkCanSendGiftResultOk", []) + } + } + + public static func parse_checkCanSendGiftResultFail(_ reader: BufferReader) -> CheckCanSendGiftResult? { + var _1: Api.TextWithEntities? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.TextWithEntities + } + let _c1 = _1 != nil + if _c1 { + return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultFail(Cons_checkCanSendGiftResultFail(reason: _1!)) + } + else { + return nil + } + } + public static func parse_checkCanSendGiftResultOk(_ reader: BufferReader) -> CheckCanSendGiftResult? { + return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultOk + } + } +} +public extension Api.payments { + enum CheckedGiftCode: TypeConstructorDescription { + public class Cons_checkedGiftCode: TypeConstructorDescription { + public var flags: Int32 + public var fromId: Api.Peer? + public var giveawayMsgId: Int32? + public var toId: Int64? + public var date: Int32 + public var days: Int32 + public var usedDate: Int32? + public var chats: [Api.Chat] + public var users: [Api.User] + public init(flags: Int32, fromId: Api.Peer?, giveawayMsgId: Int32?, toId: Int64?, date: Int32, days: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User]) { + self.flags = flags + self.fromId = fromId + self.giveawayMsgId = giveawayMsgId + self.toId = toId + self.date = date + self.days = days + self.usedDate = usedDate + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("checkedGiftCode", [("flags", ConstructorParameterDescription(self.flags)), ("fromId", ConstructorParameterDescription(self.fromId)), ("giveawayMsgId", ConstructorParameterDescription(self.giveawayMsgId)), ("toId", ConstructorParameterDescription(self.toId)), ("date", ConstructorParameterDescription(self.date)), ("days", ConstructorParameterDescription(self.days)), ("usedDate", ConstructorParameterDescription(self.usedDate)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case checkedGiftCode(Cons_checkedGiftCode) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .checkedGiftCode(let _data): + if boxed { + buffer.appendInt32(-342343793) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 4) != 0 { + _data.fromId!.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt32(_data.giveawayMsgId!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt64(_data.toId!, buffer: buffer, boxed: false) + } + serializeInt32(_data.date, buffer: buffer, boxed: false) + serializeInt32(_data.days, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 1) != 0 { + serializeInt32(_data.usedDate!, buffer: buffer, boxed: false) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .checkedGiftCode(let _data): + return ("checkedGiftCode", [("flags", ConstructorParameterDescription(_data.flags)), ("fromId", ConstructorParameterDescription(_data.fromId)), ("giveawayMsgId", ConstructorParameterDescription(_data.giveawayMsgId)), ("toId", ConstructorParameterDescription(_data.toId)), ("date", ConstructorParameterDescription(_data.date)), ("days", ConstructorParameterDescription(_data.days)), ("usedDate", ConstructorParameterDescription(_data.usedDate)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_checkedGiftCode(_ reader: BufferReader) -> CheckedGiftCode? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.Peer? + if Int(_1!) & Int(1 << 4) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.Peer + } + } + var _3: Int32? + if Int(_1!) & Int(1 << 3) != 0 { + _3 = reader.readInt32() + } + var _4: Int64? + if Int(_1!) & Int(1 << 0) != 0 { + _4 = reader.readInt64() + } + var _5: Int32? + _5 = reader.readInt32() + var _6: Int32? + _6 = reader.readInt32() + var _7: Int32? + if Int(_1!) & Int(1 << 1) != 0 { + _7 = reader.readInt32() + } + var _8: [Api.Chat]? + if let _ = reader.readInt32() { + _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _9: [Api.User]? + if let _ = reader.readInt32() { + _9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil + let _c8 = _8 != nil + let _c9 = _9 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { + return Api.payments.CheckedGiftCode.checkedGiftCode(Cons_checkedGiftCode(flags: _1!, fromId: _2, giveawayMsgId: _3, toId: _4, date: _5!, days: _6!, usedDate: _7, chats: _8!, users: _9!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum ConnectedStarRefBots: TypeConstructorDescription { + public class Cons_connectedStarRefBots: TypeConstructorDescription { + public var count: Int32 + public var connectedBots: [Api.ConnectedBotStarRef] + public var users: [Api.User] + public init(count: Int32, connectedBots: [Api.ConnectedBotStarRef], users: [Api.User]) { + self.count = count + self.connectedBots = connectedBots + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("connectedStarRefBots", [("count", ConstructorParameterDescription(self.count)), ("connectedBots", ConstructorParameterDescription(self.connectedBots)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case connectedStarRefBots(Cons_connectedStarRefBots) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .connectedStarRefBots(let _data): + if boxed { + buffer.appendInt32(-1730811363) + } + serializeInt32(_data.count, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.connectedBots.count)) + for item in _data.connectedBots { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .connectedStarRefBots(let _data): + return ("connectedStarRefBots", [("count", ConstructorParameterDescription(_data.count)), ("connectedBots", ConstructorParameterDescription(_data.connectedBots)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_connectedStarRefBots(_ reader: BufferReader) -> ConnectedStarRefBots? { + var _1: Int32? + _1 = reader.readInt32() + var _2: [Api.ConnectedBotStarRef]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ConnectedBotStarRef.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.payments.ConnectedStarRefBots.connectedStarRefBots(Cons_connectedStarRefBots(count: _1!, connectedBots: _2!, users: _3!)) + } + else { + return nil + } + } + } +} public extension Api.payments { enum ExportedInvoice: TypeConstructorDescription { public class Cons_exportedInvoice: TypeConstructorDescription { @@ -1708,675 +2247,3 @@ public extension Api.payments { } } } -public extension Api.payments { - enum StarsRevenueAdsAccountUrl: TypeConstructorDescription { - public class Cons_starsRevenueAdsAccountUrl: TypeConstructorDescription { - public var url: String - public init(url: String) { - self.url = url - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starsRevenueAdsAccountUrl", [("url", ConstructorParameterDescription(self.url))]) - } - } - case starsRevenueAdsAccountUrl(Cons_starsRevenueAdsAccountUrl) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starsRevenueAdsAccountUrl(let _data): - if boxed { - buffer.appendInt32(961445665) - } - serializeString(_data.url, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starsRevenueAdsAccountUrl(let _data): - return ("starsRevenueAdsAccountUrl", [("url", ConstructorParameterDescription(_data.url))]) - } - } - - public static func parse_starsRevenueAdsAccountUrl(_ reader: BufferReader) -> StarsRevenueAdsAccountUrl? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.payments.StarsRevenueAdsAccountUrl.starsRevenueAdsAccountUrl(Cons_starsRevenueAdsAccountUrl(url: _1!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum StarsRevenueStats: TypeConstructorDescription { - public class Cons_starsRevenueStats: TypeConstructorDescription { - public var flags: Int32 - public var topHoursGraph: Api.StatsGraph? - public var revenueGraph: Api.StatsGraph - public var status: Api.StarsRevenueStatus - public var usdRate: Double - public init(flags: Int32, topHoursGraph: Api.StatsGraph?, revenueGraph: Api.StatsGraph, status: Api.StarsRevenueStatus, usdRate: Double) { - self.flags = flags - self.topHoursGraph = topHoursGraph - self.revenueGraph = revenueGraph - self.status = status - self.usdRate = usdRate - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starsRevenueStats", [("flags", ConstructorParameterDescription(self.flags)), ("topHoursGraph", ConstructorParameterDescription(self.topHoursGraph)), ("revenueGraph", ConstructorParameterDescription(self.revenueGraph)), ("status", ConstructorParameterDescription(self.status)), ("usdRate", ConstructorParameterDescription(self.usdRate))]) - } - } - case starsRevenueStats(Cons_starsRevenueStats) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starsRevenueStats(let _data): - if boxed { - buffer.appendInt32(1814066038) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - _data.topHoursGraph!.serialize(buffer, true) - } - _data.revenueGraph.serialize(buffer, true) - _data.status.serialize(buffer, true) - serializeDouble(_data.usdRate, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starsRevenueStats(let _data): - return ("starsRevenueStats", [("flags", ConstructorParameterDescription(_data.flags)), ("topHoursGraph", ConstructorParameterDescription(_data.topHoursGraph)), ("revenueGraph", ConstructorParameterDescription(_data.revenueGraph)), ("status", ConstructorParameterDescription(_data.status)), ("usdRate", ConstructorParameterDescription(_data.usdRate))]) - } - } - - public static func parse_starsRevenueStats(_ reader: BufferReader) -> StarsRevenueStats? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.StatsGraph? - if Int(_1!) & Int(1 << 0) != 0 { - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.StatsGraph - } - } - var _3: Api.StatsGraph? - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.StatsGraph - } - var _4: Api.StarsRevenueStatus? - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.StarsRevenueStatus - } - var _5: Double? - _5 = reader.readDouble() - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.payments.StarsRevenueStats.starsRevenueStats(Cons_starsRevenueStats(flags: _1!, topHoursGraph: _2, revenueGraph: _3!, status: _4!, usdRate: _5!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum StarsRevenueWithdrawalUrl: TypeConstructorDescription { - public class Cons_starsRevenueWithdrawalUrl: TypeConstructorDescription { - public var url: String - public init(url: String) { - self.url = url - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starsRevenueWithdrawalUrl", [("url", ConstructorParameterDescription(self.url))]) - } - } - case starsRevenueWithdrawalUrl(Cons_starsRevenueWithdrawalUrl) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starsRevenueWithdrawalUrl(let _data): - if boxed { - buffer.appendInt32(497778871) - } - serializeString(_data.url, buffer: buffer, boxed: false) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starsRevenueWithdrawalUrl(let _data): - return ("starsRevenueWithdrawalUrl", [("url", ConstructorParameterDescription(_data.url))]) - } - } - - public static func parse_starsRevenueWithdrawalUrl(_ reader: BufferReader) -> StarsRevenueWithdrawalUrl? { - var _1: String? - _1 = parseString(reader) - let _c1 = _1 != nil - if _c1 { - return Api.payments.StarsRevenueWithdrawalUrl.starsRevenueWithdrawalUrl(Cons_starsRevenueWithdrawalUrl(url: _1!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum StarsStatus: TypeConstructorDescription { - public class Cons_starsStatus: TypeConstructorDescription { - public var flags: Int32 - public var balance: Api.StarsAmount - public var subscriptions: [Api.StarsSubscription]? - public var subscriptionsNextOffset: String? - public var subscriptionsMissingBalance: Int64? - public var history: [Api.StarsTransaction]? - public var nextOffset: String? - public var chats: [Api.Chat] - public var users: [Api.User] - public init(flags: Int32, balance: Api.StarsAmount, subscriptions: [Api.StarsSubscription]?, subscriptionsNextOffset: String?, subscriptionsMissingBalance: Int64?, history: [Api.StarsTransaction]?, nextOffset: String?, chats: [Api.Chat], users: [Api.User]) { - self.flags = flags - self.balance = balance - self.subscriptions = subscriptions - self.subscriptionsNextOffset = subscriptionsNextOffset - self.subscriptionsMissingBalance = subscriptionsMissingBalance - self.history = history - self.nextOffset = nextOffset - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("starsStatus", [("flags", ConstructorParameterDescription(self.flags)), ("balance", ConstructorParameterDescription(self.balance)), ("subscriptions", ConstructorParameterDescription(self.subscriptions)), ("subscriptionsNextOffset", ConstructorParameterDescription(self.subscriptionsNextOffset)), ("subscriptionsMissingBalance", ConstructorParameterDescription(self.subscriptionsMissingBalance)), ("history", ConstructorParameterDescription(self.history)), ("nextOffset", ConstructorParameterDescription(self.nextOffset)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case starsStatus(Cons_starsStatus) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .starsStatus(let _data): - if boxed { - buffer.appendInt32(1822222573) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - _data.balance.serialize(buffer, true) - if Int(_data.flags) & Int(1 << 1) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.subscriptions!.count)) - for item in _data.subscriptions! { - item.serialize(buffer, true) - } - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeString(_data.subscriptionsNextOffset!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt64(_data.subscriptionsMissingBalance!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.history!.count)) - for item in _data.history! { - item.serialize(buffer, true) - } - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.nextOffset!, buffer: buffer, boxed: false) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .starsStatus(let _data): - return ("starsStatus", [("flags", ConstructorParameterDescription(_data.flags)), ("balance", ConstructorParameterDescription(_data.balance)), ("subscriptions", ConstructorParameterDescription(_data.subscriptions)), ("subscriptionsNextOffset", ConstructorParameterDescription(_data.subscriptionsNextOffset)), ("subscriptionsMissingBalance", ConstructorParameterDescription(_data.subscriptionsMissingBalance)), ("history", ConstructorParameterDescription(_data.history)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_starsStatus(_ reader: BufferReader) -> StarsStatus? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Api.StarsAmount? - if let signature = reader.readInt32() { - _2 = Api.parse(reader, signature: signature) as? Api.StarsAmount - } - var _3: [Api.StarsSubscription]? - if Int(_1!) & Int(1 << 1) != 0 { - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarsSubscription.self) - } - } - var _4: String? - if Int(_1!) & Int(1 << 2) != 0 { - _4 = parseString(reader) - } - var _5: Int64? - if Int(_1!) & Int(1 << 4) != 0 { - _5 = reader.readInt64() - } - var _6: [Api.StarsTransaction]? - if Int(_1!) & Int(1 << 3) != 0 { - if let _ = reader.readInt32() { - _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarsTransaction.self) - } - } - var _7: String? - if Int(_1!) & Int(1 << 0) != 0 { - _7 = parseString(reader) - } - var _8: [Api.Chat]? - if let _ = reader.readInt32() { - _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _9: [Api.User]? - if let _ = reader.readInt32() { - _9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil - let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil - let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil - let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil - let _c8 = _8 != nil - let _c9 = _9 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { - return Api.payments.StarsStatus.starsStatus(Cons_starsStatus(flags: _1!, balance: _2!, subscriptions: _3, subscriptionsNextOffset: _4, subscriptionsMissingBalance: _5, history: _6, nextOffset: _7, chats: _8!, users: _9!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum SuggestedStarRefBots: TypeConstructorDescription { - public class Cons_suggestedStarRefBots: TypeConstructorDescription { - public var flags: Int32 - public var count: Int32 - public var suggestedBots: [Api.StarRefProgram] - public var users: [Api.User] - public var nextOffset: String? - public init(flags: Int32, count: Int32, suggestedBots: [Api.StarRefProgram], users: [Api.User], nextOffset: String?) { - self.flags = flags - self.count = count - self.suggestedBots = suggestedBots - self.users = users - self.nextOffset = nextOffset - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("suggestedStarRefBots", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("suggestedBots", ConstructorParameterDescription(self.suggestedBots)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))]) - } - } - case suggestedStarRefBots(Cons_suggestedStarRefBots) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .suggestedStarRefBots(let _data): - if boxed { - buffer.appendInt32(-1261053863) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.count, buffer: buffer, boxed: false) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.suggestedBots.count)) - for item in _data.suggestedBots { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.nextOffset!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .suggestedStarRefBots(let _data): - return ("suggestedStarRefBots", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("suggestedBots", ConstructorParameterDescription(_data.suggestedBots)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))]) - } - } - - public static func parse_suggestedStarRefBots(_ reader: BufferReader) -> SuggestedStarRefBots? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: [Api.StarRefProgram]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarRefProgram.self) - } - var _4: [Api.User]? - if let _ = reader.readInt32() { - _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - var _5: String? - if Int(_1!) & Int(1 << 0) != 0 { - _5 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 { - return Api.payments.SuggestedStarRefBots.suggestedStarRefBots(Cons_suggestedStarRefBots(flags: _1!, count: _2!, suggestedBots: _3!, users: _4!, nextOffset: _5)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum UniqueStarGift: TypeConstructorDescription { - public class Cons_uniqueStarGift: TypeConstructorDescription { - public var gift: Api.StarGift - public var chats: [Api.Chat] - public var users: [Api.User] - public init(gift: Api.StarGift, chats: [Api.Chat], users: [Api.User]) { - self.gift = gift - self.chats = chats - self.users = users - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("uniqueStarGift", [("gift", ConstructorParameterDescription(self.gift)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) - } - } - case uniqueStarGift(Cons_uniqueStarGift) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .uniqueStarGift(let _data): - if boxed { - buffer.appendInt32(1097619176) - } - _data.gift.serialize(buffer, true) - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.chats.count)) - for item in _data.chats { - item.serialize(buffer, true) - } - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.users.count)) - for item in _data.users { - item.serialize(buffer, true) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .uniqueStarGift(let _data): - return ("uniqueStarGift", [("gift", ConstructorParameterDescription(_data.gift)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) - } - } - - public static func parse_uniqueStarGift(_ reader: BufferReader) -> UniqueStarGift? { - var _1: Api.StarGift? - if let signature = reader.readInt32() { - _1 = Api.parse(reader, signature: signature) as? Api.StarGift - } - var _2: [Api.Chat]? - if let _ = reader.readInt32() { - _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) - } - var _3: [Api.User]? - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - if _c1 && _c2 && _c3 { - return Api.payments.UniqueStarGift.uniqueStarGift(Cons_uniqueStarGift(gift: _1!, chats: _2!, users: _3!)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum UniqueStarGiftValueInfo: TypeConstructorDescription { - public class Cons_uniqueStarGiftValueInfo: TypeConstructorDescription { - public var flags: Int32 - public var currency: String - public var value: Int64 - public var initialSaleDate: Int32 - public var initialSaleStars: Int64 - public var initialSalePrice: Int64 - public var lastSaleDate: Int32? - public var lastSalePrice: Int64? - public var floorPrice: Int64? - public var averagePrice: Int64? - public var listedCount: Int32? - public var fragmentListedCount: Int32? - public var fragmentListedUrl: String? - public init(flags: Int32, currency: String, value: Int64, initialSaleDate: Int32, initialSaleStars: Int64, initialSalePrice: Int64, lastSaleDate: Int32?, lastSalePrice: Int64?, floorPrice: Int64?, averagePrice: Int64?, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?) { - self.flags = flags - self.currency = currency - self.value = value - self.initialSaleDate = initialSaleDate - self.initialSaleStars = initialSaleStars - self.initialSalePrice = initialSalePrice - self.lastSaleDate = lastSaleDate - self.lastSalePrice = lastSalePrice - self.floorPrice = floorPrice - self.averagePrice = averagePrice - self.listedCount = listedCount - self.fragmentListedCount = fragmentListedCount - self.fragmentListedUrl = fragmentListedUrl - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("uniqueStarGiftValueInfo", [("flags", ConstructorParameterDescription(self.flags)), ("currency", ConstructorParameterDescription(self.currency)), ("value", ConstructorParameterDescription(self.value)), ("initialSaleDate", ConstructorParameterDescription(self.initialSaleDate)), ("initialSaleStars", ConstructorParameterDescription(self.initialSaleStars)), ("initialSalePrice", ConstructorParameterDescription(self.initialSalePrice)), ("lastSaleDate", ConstructorParameterDescription(self.lastSaleDate)), ("lastSalePrice", ConstructorParameterDescription(self.lastSalePrice)), ("floorPrice", ConstructorParameterDescription(self.floorPrice)), ("averagePrice", ConstructorParameterDescription(self.averagePrice)), ("listedCount", ConstructorParameterDescription(self.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(self.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(self.fragmentListedUrl))]) - } - } - case uniqueStarGiftValueInfo(Cons_uniqueStarGiftValueInfo) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .uniqueStarGiftValueInfo(let _data): - if boxed { - buffer.appendInt32(1362093126) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeString(_data.currency, buffer: buffer, boxed: false) - serializeInt64(_data.value, buffer: buffer, boxed: false) - serializeInt32(_data.initialSaleDate, buffer: buffer, boxed: false) - serializeInt64(_data.initialSaleStars, buffer: buffer, boxed: false) - serializeInt64(_data.initialSalePrice, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt32(_data.lastSaleDate!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeInt64(_data.lastSalePrice!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 2) != 0 { - serializeInt64(_data.floorPrice!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 3) != 0 { - serializeInt64(_data.averagePrice!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 4) != 0 { - serializeInt32(_data.listedCount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 5) != 0 { - serializeInt32(_data.fragmentListedCount!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 5) != 0 { - serializeString(_data.fragmentListedUrl!, buffer: buffer, boxed: false) - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .uniqueStarGiftValueInfo(let _data): - return ("uniqueStarGiftValueInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("currency", ConstructorParameterDescription(_data.currency)), ("value", ConstructorParameterDescription(_data.value)), ("initialSaleDate", ConstructorParameterDescription(_data.initialSaleDate)), ("initialSaleStars", ConstructorParameterDescription(_data.initialSaleStars)), ("initialSalePrice", ConstructorParameterDescription(_data.initialSalePrice)), ("lastSaleDate", ConstructorParameterDescription(_data.lastSaleDate)), ("lastSalePrice", ConstructorParameterDescription(_data.lastSalePrice)), ("floorPrice", ConstructorParameterDescription(_data.floorPrice)), ("averagePrice", ConstructorParameterDescription(_data.averagePrice)), ("listedCount", ConstructorParameterDescription(_data.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(_data.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(_data.fragmentListedUrl))]) - } - } - - public static func parse_uniqueStarGiftValueInfo(_ reader: BufferReader) -> UniqueStarGiftValueInfo? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - _2 = parseString(reader) - var _3: Int64? - _3 = reader.readInt64() - var _4: Int32? - _4 = reader.readInt32() - var _5: Int64? - _5 = reader.readInt64() - var _6: Int64? - _6 = reader.readInt64() - var _7: Int32? - if Int(_1!) & Int(1 << 0) != 0 { - _7 = reader.readInt32() - } - var _8: Int64? - if Int(_1!) & Int(1 << 0) != 0 { - _8 = reader.readInt64() - } - var _9: Int64? - if Int(_1!) & Int(1 << 2) != 0 { - _9 = reader.readInt64() - } - var _10: Int64? - if Int(_1!) & Int(1 << 3) != 0 { - _10 = reader.readInt64() - } - var _11: Int32? - if Int(_1!) & Int(1 << 4) != 0 { - _11 = reader.readInt32() - } - var _12: Int32? - if Int(_1!) & Int(1 << 5) != 0 { - _12 = reader.readInt32() - } - var _13: String? - if Int(_1!) & Int(1 << 5) != 0 { - _13 = parseString(reader) - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - let _c5 = _5 != nil - let _c6 = _6 != nil - let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil - let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil - let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil - let _c10 = (Int(_1!) & Int(1 << 3) == 0) || _10 != nil - let _c11 = (Int(_1!) & Int(1 << 4) == 0) || _11 != nil - let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil - let _c13 = (Int(_1!) & Int(1 << 5) == 0) || _13 != nil - if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 { - return Api.payments.UniqueStarGiftValueInfo.uniqueStarGiftValueInfo(Cons_uniqueStarGiftValueInfo(flags: _1!, currency: _2!, value: _3!, initialSaleDate: _4!, initialSaleStars: _5!, initialSalePrice: _6!, lastSaleDate: _7, lastSalePrice: _8, floorPrice: _9, averagePrice: _10, listedCount: _11, fragmentListedCount: _12, fragmentListedUrl: _13)) - } - else { - return nil - } - } - } -} -public extension Api.payments { - enum ValidatedRequestedInfo: TypeConstructorDescription { - public class Cons_validatedRequestedInfo: TypeConstructorDescription { - public var flags: Int32 - public var id: String? - public var shippingOptions: [Api.ShippingOption]? - public init(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?) { - self.flags = flags - self.id = id - self.shippingOptions = shippingOptions - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("validatedRequestedInfo", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("shippingOptions", ConstructorParameterDescription(self.shippingOptions))]) - } - } - case validatedRequestedInfo(Cons_validatedRequestedInfo) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .validatedRequestedInfo(let _data): - if boxed { - buffer.appendInt32(-784000893) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - if Int(_data.flags) & Int(1 << 0) != 0 { - serializeString(_data.id!, buffer: buffer, boxed: false) - } - if Int(_data.flags) & Int(1 << 1) != 0 { - buffer.appendInt32(481674261) - buffer.appendInt32(Int32(_data.shippingOptions!.count)) - for item in _data.shippingOptions! { - item.serialize(buffer, true) - } - } - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .validatedRequestedInfo(let _data): - return ("validatedRequestedInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("shippingOptions", ConstructorParameterDescription(_data.shippingOptions))]) - } - } - - public static func parse_validatedRequestedInfo(_ reader: BufferReader) -> ValidatedRequestedInfo? { - var _1: Int32? - _1 = reader.readInt32() - var _2: String? - if Int(_1!) & Int(1 << 0) != 0 { - _2 = parseString(reader) - } - var _3: [Api.ShippingOption]? - if Int(_1!) & Int(1 << 1) != 0 { - if let _ = reader.readInt32() { - _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ShippingOption.self) - } - } - let _c1 = _1 != nil - let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil - let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil - if _c1 && _c2 && _c3 { - return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(Cons_validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api38.swift b/submodules/TelegramApi/Sources/Api38.swift index 36500500ca..cd35317f0d 100644 --- a/submodules/TelegramApi/Sources/Api38.swift +++ b/submodules/TelegramApi/Sources/Api38.swift @@ -1,3 +1,675 @@ +public extension Api.payments { + enum StarsRevenueAdsAccountUrl: TypeConstructorDescription { + public class Cons_starsRevenueAdsAccountUrl: TypeConstructorDescription { + public var url: String + public init(url: String) { + self.url = url + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starsRevenueAdsAccountUrl", [("url", ConstructorParameterDescription(self.url))]) + } + } + case starsRevenueAdsAccountUrl(Cons_starsRevenueAdsAccountUrl) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starsRevenueAdsAccountUrl(let _data): + if boxed { + buffer.appendInt32(961445665) + } + serializeString(_data.url, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starsRevenueAdsAccountUrl(let _data): + return ("starsRevenueAdsAccountUrl", [("url", ConstructorParameterDescription(_data.url))]) + } + } + + public static func parse_starsRevenueAdsAccountUrl(_ reader: BufferReader) -> StarsRevenueAdsAccountUrl? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.payments.StarsRevenueAdsAccountUrl.starsRevenueAdsAccountUrl(Cons_starsRevenueAdsAccountUrl(url: _1!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum StarsRevenueStats: TypeConstructorDescription { + public class Cons_starsRevenueStats: TypeConstructorDescription { + public var flags: Int32 + public var topHoursGraph: Api.StatsGraph? + public var revenueGraph: Api.StatsGraph + public var status: Api.StarsRevenueStatus + public var usdRate: Double + public init(flags: Int32, topHoursGraph: Api.StatsGraph?, revenueGraph: Api.StatsGraph, status: Api.StarsRevenueStatus, usdRate: Double) { + self.flags = flags + self.topHoursGraph = topHoursGraph + self.revenueGraph = revenueGraph + self.status = status + self.usdRate = usdRate + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starsRevenueStats", [("flags", ConstructorParameterDescription(self.flags)), ("topHoursGraph", ConstructorParameterDescription(self.topHoursGraph)), ("revenueGraph", ConstructorParameterDescription(self.revenueGraph)), ("status", ConstructorParameterDescription(self.status)), ("usdRate", ConstructorParameterDescription(self.usdRate))]) + } + } + case starsRevenueStats(Cons_starsRevenueStats) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starsRevenueStats(let _data): + if boxed { + buffer.appendInt32(1814066038) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + _data.topHoursGraph!.serialize(buffer, true) + } + _data.revenueGraph.serialize(buffer, true) + _data.status.serialize(buffer, true) + serializeDouble(_data.usdRate, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starsRevenueStats(let _data): + return ("starsRevenueStats", [("flags", ConstructorParameterDescription(_data.flags)), ("topHoursGraph", ConstructorParameterDescription(_data.topHoursGraph)), ("revenueGraph", ConstructorParameterDescription(_data.revenueGraph)), ("status", ConstructorParameterDescription(_data.status)), ("usdRate", ConstructorParameterDescription(_data.usdRate))]) + } + } + + public static func parse_starsRevenueStats(_ reader: BufferReader) -> StarsRevenueStats? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.StatsGraph? + if Int(_1!) & Int(1 << 0) != 0 { + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.StatsGraph + } + } + var _3: Api.StatsGraph? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.StatsGraph + } + var _4: Api.StarsRevenueStatus? + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.StarsRevenueStatus + } + var _5: Double? + _5 = reader.readDouble() + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.payments.StarsRevenueStats.starsRevenueStats(Cons_starsRevenueStats(flags: _1!, topHoursGraph: _2, revenueGraph: _3!, status: _4!, usdRate: _5!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum StarsRevenueWithdrawalUrl: TypeConstructorDescription { + public class Cons_starsRevenueWithdrawalUrl: TypeConstructorDescription { + public var url: String + public init(url: String) { + self.url = url + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starsRevenueWithdrawalUrl", [("url", ConstructorParameterDescription(self.url))]) + } + } + case starsRevenueWithdrawalUrl(Cons_starsRevenueWithdrawalUrl) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starsRevenueWithdrawalUrl(let _data): + if boxed { + buffer.appendInt32(497778871) + } + serializeString(_data.url, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starsRevenueWithdrawalUrl(let _data): + return ("starsRevenueWithdrawalUrl", [("url", ConstructorParameterDescription(_data.url))]) + } + } + + public static func parse_starsRevenueWithdrawalUrl(_ reader: BufferReader) -> StarsRevenueWithdrawalUrl? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.payments.StarsRevenueWithdrawalUrl.starsRevenueWithdrawalUrl(Cons_starsRevenueWithdrawalUrl(url: _1!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum StarsStatus: TypeConstructorDescription { + public class Cons_starsStatus: TypeConstructorDescription { + public var flags: Int32 + public var balance: Api.StarsAmount + public var subscriptions: [Api.StarsSubscription]? + public var subscriptionsNextOffset: String? + public var subscriptionsMissingBalance: Int64? + public var history: [Api.StarsTransaction]? + public var nextOffset: String? + public var chats: [Api.Chat] + public var users: [Api.User] + public init(flags: Int32, balance: Api.StarsAmount, subscriptions: [Api.StarsSubscription]?, subscriptionsNextOffset: String?, subscriptionsMissingBalance: Int64?, history: [Api.StarsTransaction]?, nextOffset: String?, chats: [Api.Chat], users: [Api.User]) { + self.flags = flags + self.balance = balance + self.subscriptions = subscriptions + self.subscriptionsNextOffset = subscriptionsNextOffset + self.subscriptionsMissingBalance = subscriptionsMissingBalance + self.history = history + self.nextOffset = nextOffset + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("starsStatus", [("flags", ConstructorParameterDescription(self.flags)), ("balance", ConstructorParameterDescription(self.balance)), ("subscriptions", ConstructorParameterDescription(self.subscriptions)), ("subscriptionsNextOffset", ConstructorParameterDescription(self.subscriptionsNextOffset)), ("subscriptionsMissingBalance", ConstructorParameterDescription(self.subscriptionsMissingBalance)), ("history", ConstructorParameterDescription(self.history)), ("nextOffset", ConstructorParameterDescription(self.nextOffset)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case starsStatus(Cons_starsStatus) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .starsStatus(let _data): + if boxed { + buffer.appendInt32(1822222573) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + _data.balance.serialize(buffer, true) + if Int(_data.flags) & Int(1 << 1) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.subscriptions!.count)) + for item in _data.subscriptions! { + item.serialize(buffer, true) + } + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeString(_data.subscriptionsNextOffset!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt64(_data.subscriptionsMissingBalance!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.history!.count)) + for item in _data.history! { + item.serialize(buffer, true) + } + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.nextOffset!, buffer: buffer, boxed: false) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .starsStatus(let _data): + return ("starsStatus", [("flags", ConstructorParameterDescription(_data.flags)), ("balance", ConstructorParameterDescription(_data.balance)), ("subscriptions", ConstructorParameterDescription(_data.subscriptions)), ("subscriptionsNextOffset", ConstructorParameterDescription(_data.subscriptionsNextOffset)), ("subscriptionsMissingBalance", ConstructorParameterDescription(_data.subscriptionsMissingBalance)), ("history", ConstructorParameterDescription(_data.history)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_starsStatus(_ reader: BufferReader) -> StarsStatus? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Api.StarsAmount? + if let signature = reader.readInt32() { + _2 = Api.parse(reader, signature: signature) as? Api.StarsAmount + } + var _3: [Api.StarsSubscription]? + if Int(_1!) & Int(1 << 1) != 0 { + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarsSubscription.self) + } + } + var _4: String? + if Int(_1!) & Int(1 << 2) != 0 { + _4 = parseString(reader) + } + var _5: Int64? + if Int(_1!) & Int(1 << 4) != 0 { + _5 = reader.readInt64() + } + var _6: [Api.StarsTransaction]? + if Int(_1!) & Int(1 << 3) != 0 { + if let _ = reader.readInt32() { + _6 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarsTransaction.self) + } + } + var _7: String? + if Int(_1!) & Int(1 << 0) != 0 { + _7 = parseString(reader) + } + var _8: [Api.Chat]? + if let _ = reader.readInt32() { + _8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _9: [Api.User]? + if let _ = reader.readInt32() { + _9 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil + let _c5 = (Int(_1!) & Int(1 << 4) == 0) || _5 != nil + let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil + let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil + let _c8 = _8 != nil + let _c9 = _9 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 { + return Api.payments.StarsStatus.starsStatus(Cons_starsStatus(flags: _1!, balance: _2!, subscriptions: _3, subscriptionsNextOffset: _4, subscriptionsMissingBalance: _5, history: _6, nextOffset: _7, chats: _8!, users: _9!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum SuggestedStarRefBots: TypeConstructorDescription { + public class Cons_suggestedStarRefBots: TypeConstructorDescription { + public var flags: Int32 + public var count: Int32 + public var suggestedBots: [Api.StarRefProgram] + public var users: [Api.User] + public var nextOffset: String? + public init(flags: Int32, count: Int32, suggestedBots: [Api.StarRefProgram], users: [Api.User], nextOffset: String?) { + self.flags = flags + self.count = count + self.suggestedBots = suggestedBots + self.users = users + self.nextOffset = nextOffset + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("suggestedStarRefBots", [("flags", ConstructorParameterDescription(self.flags)), ("count", ConstructorParameterDescription(self.count)), ("suggestedBots", ConstructorParameterDescription(self.suggestedBots)), ("users", ConstructorParameterDescription(self.users)), ("nextOffset", ConstructorParameterDescription(self.nextOffset))]) + } + } + case suggestedStarRefBots(Cons_suggestedStarRefBots) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .suggestedStarRefBots(let _data): + if boxed { + buffer.appendInt32(-1261053863) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.count, buffer: buffer, boxed: false) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.suggestedBots.count)) + for item in _data.suggestedBots { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.nextOffset!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .suggestedStarRefBots(let _data): + return ("suggestedStarRefBots", [("flags", ConstructorParameterDescription(_data.flags)), ("count", ConstructorParameterDescription(_data.count)), ("suggestedBots", ConstructorParameterDescription(_data.suggestedBots)), ("users", ConstructorParameterDescription(_data.users)), ("nextOffset", ConstructorParameterDescription(_data.nextOffset))]) + } + } + + public static func parse_suggestedStarRefBots(_ reader: BufferReader) -> SuggestedStarRefBots? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: [Api.StarRefProgram]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StarRefProgram.self) + } + var _4: [Api.User]? + if let _ = reader.readInt32() { + _4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + var _5: String? + if Int(_1!) & Int(1 << 0) != 0 { + _5 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 { + return Api.payments.SuggestedStarRefBots.suggestedStarRefBots(Cons_suggestedStarRefBots(flags: _1!, count: _2!, suggestedBots: _3!, users: _4!, nextOffset: _5)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum UniqueStarGift: TypeConstructorDescription { + public class Cons_uniqueStarGift: TypeConstructorDescription { + public var gift: Api.StarGift + public var chats: [Api.Chat] + public var users: [Api.User] + public init(gift: Api.StarGift, chats: [Api.Chat], users: [Api.User]) { + self.gift = gift + self.chats = chats + self.users = users + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("uniqueStarGift", [("gift", ConstructorParameterDescription(self.gift)), ("chats", ConstructorParameterDescription(self.chats)), ("users", ConstructorParameterDescription(self.users))]) + } + } + case uniqueStarGift(Cons_uniqueStarGift) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .uniqueStarGift(let _data): + if boxed { + buffer.appendInt32(1097619176) + } + _data.gift.serialize(buffer, true) + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.chats.count)) + for item in _data.chats { + item.serialize(buffer, true) + } + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.users.count)) + for item in _data.users { + item.serialize(buffer, true) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .uniqueStarGift(let _data): + return ("uniqueStarGift", [("gift", ConstructorParameterDescription(_data.gift)), ("chats", ConstructorParameterDescription(_data.chats)), ("users", ConstructorParameterDescription(_data.users))]) + } + } + + public static func parse_uniqueStarGift(_ reader: BufferReader) -> UniqueStarGift? { + var _1: Api.StarGift? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.StarGift + } + var _2: [Api.Chat]? + if let _ = reader.readInt32() { + _2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self) + } + var _3: [Api.User]? + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + if _c1 && _c2 && _c3 { + return Api.payments.UniqueStarGift.uniqueStarGift(Cons_uniqueStarGift(gift: _1!, chats: _2!, users: _3!)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum UniqueStarGiftValueInfo: TypeConstructorDescription { + public class Cons_uniqueStarGiftValueInfo: TypeConstructorDescription { + public var flags: Int32 + public var currency: String + public var value: Int64 + public var initialSaleDate: Int32 + public var initialSaleStars: Int64 + public var initialSalePrice: Int64 + public var lastSaleDate: Int32? + public var lastSalePrice: Int64? + public var floorPrice: Int64? + public var averagePrice: Int64? + public var listedCount: Int32? + public var fragmentListedCount: Int32? + public var fragmentListedUrl: String? + public init(flags: Int32, currency: String, value: Int64, initialSaleDate: Int32, initialSaleStars: Int64, initialSalePrice: Int64, lastSaleDate: Int32?, lastSalePrice: Int64?, floorPrice: Int64?, averagePrice: Int64?, listedCount: Int32?, fragmentListedCount: Int32?, fragmentListedUrl: String?) { + self.flags = flags + self.currency = currency + self.value = value + self.initialSaleDate = initialSaleDate + self.initialSaleStars = initialSaleStars + self.initialSalePrice = initialSalePrice + self.lastSaleDate = lastSaleDate + self.lastSalePrice = lastSalePrice + self.floorPrice = floorPrice + self.averagePrice = averagePrice + self.listedCount = listedCount + self.fragmentListedCount = fragmentListedCount + self.fragmentListedUrl = fragmentListedUrl + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("uniqueStarGiftValueInfo", [("flags", ConstructorParameterDescription(self.flags)), ("currency", ConstructorParameterDescription(self.currency)), ("value", ConstructorParameterDescription(self.value)), ("initialSaleDate", ConstructorParameterDescription(self.initialSaleDate)), ("initialSaleStars", ConstructorParameterDescription(self.initialSaleStars)), ("initialSalePrice", ConstructorParameterDescription(self.initialSalePrice)), ("lastSaleDate", ConstructorParameterDescription(self.lastSaleDate)), ("lastSalePrice", ConstructorParameterDescription(self.lastSalePrice)), ("floorPrice", ConstructorParameterDescription(self.floorPrice)), ("averagePrice", ConstructorParameterDescription(self.averagePrice)), ("listedCount", ConstructorParameterDescription(self.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(self.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(self.fragmentListedUrl))]) + } + } + case uniqueStarGiftValueInfo(Cons_uniqueStarGiftValueInfo) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .uniqueStarGiftValueInfo(let _data): + if boxed { + buffer.appendInt32(1362093126) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeString(_data.currency, buffer: buffer, boxed: false) + serializeInt64(_data.value, buffer: buffer, boxed: false) + serializeInt32(_data.initialSaleDate, buffer: buffer, boxed: false) + serializeInt64(_data.initialSaleStars, buffer: buffer, boxed: false) + serializeInt64(_data.initialSalePrice, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt32(_data.lastSaleDate!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeInt64(_data.lastSalePrice!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 2) != 0 { + serializeInt64(_data.floorPrice!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 3) != 0 { + serializeInt64(_data.averagePrice!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 4) != 0 { + serializeInt32(_data.listedCount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 5) != 0 { + serializeInt32(_data.fragmentListedCount!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 5) != 0 { + serializeString(_data.fragmentListedUrl!, buffer: buffer, boxed: false) + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .uniqueStarGiftValueInfo(let _data): + return ("uniqueStarGiftValueInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("currency", ConstructorParameterDescription(_data.currency)), ("value", ConstructorParameterDescription(_data.value)), ("initialSaleDate", ConstructorParameterDescription(_data.initialSaleDate)), ("initialSaleStars", ConstructorParameterDescription(_data.initialSaleStars)), ("initialSalePrice", ConstructorParameterDescription(_data.initialSalePrice)), ("lastSaleDate", ConstructorParameterDescription(_data.lastSaleDate)), ("lastSalePrice", ConstructorParameterDescription(_data.lastSalePrice)), ("floorPrice", ConstructorParameterDescription(_data.floorPrice)), ("averagePrice", ConstructorParameterDescription(_data.averagePrice)), ("listedCount", ConstructorParameterDescription(_data.listedCount)), ("fragmentListedCount", ConstructorParameterDescription(_data.fragmentListedCount)), ("fragmentListedUrl", ConstructorParameterDescription(_data.fragmentListedUrl))]) + } + } + + public static func parse_uniqueStarGiftValueInfo(_ reader: BufferReader) -> UniqueStarGiftValueInfo? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + var _3: Int64? + _3 = reader.readInt64() + var _4: Int32? + _4 = reader.readInt32() + var _5: Int64? + _5 = reader.readInt64() + var _6: Int64? + _6 = reader.readInt64() + var _7: Int32? + if Int(_1!) & Int(1 << 0) != 0 { + _7 = reader.readInt32() + } + var _8: Int64? + if Int(_1!) & Int(1 << 0) != 0 { + _8 = reader.readInt64() + } + var _9: Int64? + if Int(_1!) & Int(1 << 2) != 0 { + _9 = reader.readInt64() + } + var _10: Int64? + if Int(_1!) & Int(1 << 3) != 0 { + _10 = reader.readInt64() + } + var _11: Int32? + if Int(_1!) & Int(1 << 4) != 0 { + _11 = reader.readInt32() + } + var _12: Int32? + if Int(_1!) & Int(1 << 5) != 0 { + _12 = reader.readInt32() + } + var _13: String? + if Int(_1!) & Int(1 << 5) != 0 { + _13 = parseString(reader) + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + let _c5 = _5 != nil + let _c6 = _6 != nil + let _c7 = (Int(_1!) & Int(1 << 0) == 0) || _7 != nil + let _c8 = (Int(_1!) & Int(1 << 0) == 0) || _8 != nil + let _c9 = (Int(_1!) & Int(1 << 2) == 0) || _9 != nil + let _c10 = (Int(_1!) & Int(1 << 3) == 0) || _10 != nil + let _c11 = (Int(_1!) & Int(1 << 4) == 0) || _11 != nil + let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil + let _c13 = (Int(_1!) & Int(1 << 5) == 0) || _13 != nil + if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 { + return Api.payments.UniqueStarGiftValueInfo.uniqueStarGiftValueInfo(Cons_uniqueStarGiftValueInfo(flags: _1!, currency: _2!, value: _3!, initialSaleDate: _4!, initialSaleStars: _5!, initialSalePrice: _6!, lastSaleDate: _7, lastSalePrice: _8, floorPrice: _9, averagePrice: _10, listedCount: _11, fragmentListedCount: _12, fragmentListedUrl: _13)) + } + else { + return nil + } + } + } +} +public extension Api.payments { + enum ValidatedRequestedInfo: TypeConstructorDescription { + public class Cons_validatedRequestedInfo: TypeConstructorDescription { + public var flags: Int32 + public var id: String? + public var shippingOptions: [Api.ShippingOption]? + public init(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?) { + self.flags = flags + self.id = id + self.shippingOptions = shippingOptions + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("validatedRequestedInfo", [("flags", ConstructorParameterDescription(self.flags)), ("id", ConstructorParameterDescription(self.id)), ("shippingOptions", ConstructorParameterDescription(self.shippingOptions))]) + } + } + case validatedRequestedInfo(Cons_validatedRequestedInfo) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .validatedRequestedInfo(let _data): + if boxed { + buffer.appendInt32(-784000893) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + if Int(_data.flags) & Int(1 << 0) != 0 { + serializeString(_data.id!, buffer: buffer, boxed: false) + } + if Int(_data.flags) & Int(1 << 1) != 0 { + buffer.appendInt32(481674261) + buffer.appendInt32(Int32(_data.shippingOptions!.count)) + for item in _data.shippingOptions! { + item.serialize(buffer, true) + } + } + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .validatedRequestedInfo(let _data): + return ("validatedRequestedInfo", [("flags", ConstructorParameterDescription(_data.flags)), ("id", ConstructorParameterDescription(_data.id)), ("shippingOptions", ConstructorParameterDescription(_data.shippingOptions))]) + } + } + + public static func parse_validatedRequestedInfo(_ reader: BufferReader) -> ValidatedRequestedInfo? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + if Int(_1!) & Int(1 << 0) != 0 { + _2 = parseString(reader) + } + var _3: [Api.ShippingOption]? + if Int(_1!) & Int(1 << 1) != 0 { + if let _ = reader.readInt32() { + _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ShippingOption.self) + } + } + let _c1 = _1 != nil + let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil + let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil + if _c1 && _c2 && _c3 { + return Api.payments.ValidatedRequestedInfo.validatedRequestedInfo(Cons_validatedRequestedInfo(flags: _1!, id: _2, shippingOptions: _3)) + } + else { + return nil + } + } + } +} public extension Api.phone { enum ExportedGroupCallInvite: TypeConstructorDescription { public class Cons_exportedGroupCallInvite: TypeConstructorDescription { @@ -1599,6 +2271,52 @@ public extension Api.stats { } } } +public extension Api.stats { + enum PollStats: TypeConstructorDescription { + public class Cons_pollStats: TypeConstructorDescription { + public var votesGraph: Api.StatsGraph + public init(votesGraph: Api.StatsGraph) { + self.votesGraph = votesGraph + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("pollStats", [("votesGraph", ConstructorParameterDescription(self.votesGraph))]) + } + } + case pollStats(Cons_pollStats) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .pollStats(let _data): + if boxed { + buffer.appendInt32(697941741) + } + _data.votesGraph.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .pollStats(let _data): + return ("pollStats", [("votesGraph", ConstructorParameterDescription(_data.votesGraph))]) + } + } + + public static func parse_pollStats(_ reader: BufferReader) -> PollStats? { + var _1: Api.StatsGraph? + if let signature = reader.readInt32() { + _1 = Api.parse(reader, signature: signature) as? Api.StatsGraph + } + let _c1 = _1 != nil + if _c1 { + return Api.stats.PollStats.pollStats(Cons_pollStats(votesGraph: _1!)) + } + else { + return nil + } + } + } +} public extension Api.stats { enum PublicForwards: TypeConstructorDescription { public class Cons_publicForwards: TypeConstructorDescription { diff --git a/submodules/TelegramApi/Sources/Api4.swift b/submodules/TelegramApi/Sources/Api4.swift index 1b2814cb3a..2a15a92573 100644 --- a/submodules/TelegramApi/Sources/Api4.swift +++ b/submodules/TelegramApi/Sources/Api4.swift @@ -754,6 +754,56 @@ public extension Api { } } } +public extension Api { + enum ChannelTopic: TypeConstructorDescription { + public class Cons_channelTopic: TypeConstructorDescription { + public var id: Int32 + public var title: String + public init(id: Int32, title: String) { + self.id = id + self.title = title + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("channelTopic", [("id", ConstructorParameterDescription(self.id)), ("title", ConstructorParameterDescription(self.title))]) + } + } + case channelTopic(Cons_channelTopic) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .channelTopic(let _data): + if boxed { + buffer.appendInt32(-1817845901) + } + serializeInt32(_data.id, buffer: buffer, boxed: false) + serializeString(_data.title, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .channelTopic(let _data): + return ("channelTopic", [("id", ConstructorParameterDescription(_data.id)), ("title", ConstructorParameterDescription(_data.title))]) + } + } + + public static func parse_channelTopic(_ reader: BufferReader) -> ChannelTopic? { + var _1: Int32? + _1 = reader.readInt32() + var _2: String? + _2 = parseString(reader) + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.ChannelTopic.channelTopic(Cons_channelTopic(id: _1!, title: _2!)) + } + else { + return nil + } + } + } +} public extension Api { indirect enum Chat: TypeConstructorDescription { public class Cons_channel: TypeConstructorDescription { diff --git a/submodules/TelegramApi/Sources/Api40.swift b/submodules/TelegramApi/Sources/Api40.swift index 3ed3e4f75b..e0c4b24491 100644 --- a/submodules/TelegramApi/Sources/Api40.swift +++ b/submodules/TelegramApi/Sources/Api40.swift @@ -2022,6 +2022,115 @@ public extension Api.functions.account { }) } } +public extension Api.functions.aicompose { + static func createTone(flags: Int32, emojiId: Int64?, title: String, prompt: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(118454008) + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 1) != 0 { + serializeInt64(emojiId!, buffer: buffer, boxed: false) + } + serializeString(title, buffer: buffer, boxed: false) + serializeString(prompt, buffer: buffer, boxed: false) + return (FunctionDescription(name: "aicompose.createTone", parameters: [("flags", ConstructorParameterDescription(flags)), ("emojiId", ConstructorParameterDescription(emojiId)), ("title", ConstructorParameterDescription(title)), ("prompt", ConstructorParameterDescription(prompt))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.AiComposeTone? in + let reader = BufferReader(buffer) + var result: Api.AiComposeTone? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.AiComposeTone + } + return result + }) + } +} +public extension Api.functions.aicompose { + static func deleteTone(tone: Api.InputAiComposeTone) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-583454358) + tone.serialize(buffer, true) + return (FunctionDescription(name: "aicompose.deleteTone", parameters: [("tone", ConstructorParameterDescription(tone))]), 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 extension Api.functions.aicompose { + static func getTone(tone: Api.InputAiComposeTone) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(1182392799) + tone.serialize(buffer, true) + return (FunctionDescription(name: "aicompose.getTone", parameters: [("tone", ConstructorParameterDescription(tone))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.AiComposeTone? in + let reader = BufferReader(buffer) + var result: Api.AiComposeTone? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.AiComposeTone + } + return result + }) + } +} +public extension Api.functions.aicompose { + static func getTones(hash: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1412066815) + serializeInt64(hash, buffer: buffer, boxed: false) + return (FunctionDescription(name: "aicompose.getTones", parameters: [("hash", ConstructorParameterDescription(hash))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.aicompose.Tones? in + let reader = BufferReader(buffer) + var result: Api.aicompose.Tones? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.aicompose.Tones + } + return result + }) + } +} +public extension Api.functions.aicompose { + static func saveTone(tone: Api.InputAiComposeTone, unsave: Api.Bool) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(394447793) + tone.serialize(buffer, true) + unsave.serialize(buffer, true) + return (FunctionDescription(name: "aicompose.saveTone", parameters: [("tone", ConstructorParameterDescription(tone)), ("unsave", ConstructorParameterDescription(unsave))]), 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 extension Api.functions.aicompose { + static func updateTone(flags: Int32, tone: Api.InputAiComposeTone, displayAuthor: Api.Bool?, emojiId: Int64?, title: String?, prompt: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1875128487) + serializeInt32(flags, buffer: buffer, boxed: false) + tone.serialize(buffer, true) + if Int(flags) & Int(1 << 0) != 0 { + displayAuthor!.serialize(buffer, true) + } + if Int(flags) & Int(1 << 1) != 0 { + serializeInt64(emojiId!, buffer: buffer, boxed: false) + } + if Int(flags) & Int(1 << 2) != 0 { + serializeString(title!, buffer: buffer, boxed: false) + } + if Int(flags) & Int(1 << 3) != 0 { + serializeString(prompt!, buffer: buffer, boxed: false) + } + return (FunctionDescription(name: "aicompose.updateTone", parameters: [("flags", ConstructorParameterDescription(flags)), ("tone", ConstructorParameterDescription(tone)), ("displayAuthor", ConstructorParameterDescription(displayAuthor)), ("emojiId", ConstructorParameterDescription(emojiId)), ("title", ConstructorParameterDescription(title)), ("prompt", ConstructorParameterDescription(prompt))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.AiComposeTone? in + let reader = BufferReader(buffer) + var result: Api.AiComposeTone? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.AiComposeTone + } + return result + }) + } +} public extension Api.functions.auth { static func acceptLoginToken(token: Buffer) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() @@ -3423,6 +3532,20 @@ public extension Api.functions.channels { }) } } +public extension Api.functions.channels { + static func getContactPersonalChannels() -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(1352350822) + return (FunctionDescription(name: "channels.getContactPersonalChannels", parameters: []), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.PersonalChannels? in + let reader = BufferReader(buffer) + var result: Api.channels.PersonalChannels? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.channels.PersonalChannels + } + return result + }) + } +} public extension Api.functions.channels { static func getFullChannel(channel: Api.InputChannel) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() @@ -3568,6 +3691,21 @@ public extension Api.functions.channels { }) } } +public extension Api.functions.channels { + static func getTopics(langCode: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<[Api.ChannelTopic]>) { + let buffer = Buffer() + buffer.appendInt32(2058456524) + serializeString(langCode, buffer: buffer, boxed: false) + return (FunctionDescription(name: "channels.getTopics", parameters: [("langCode", ConstructorParameterDescription(langCode))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> [Api.ChannelTopic]? in + let reader = BufferReader(buffer) + var result: [Api.ChannelTopic]? + if let _ = reader.readInt32() { + result = Api.parseVector(reader, elementSignature: 0, elementType: Api.ChannelTopic.self) + } + return result + }) + } +} public extension Api.functions.channels { static func inviteToChannel(channel: Api.InputChannel, users: [Api.InputUser]) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() @@ -3727,6 +3865,28 @@ public extension Api.functions.channels { }) } } +public extension Api.functions.channels { + static func search(flags: Int32, q: String?, topicId: Int32?, offset: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(668439895) + serializeInt32(flags, buffer: buffer, boxed: false) + if Int(flags) & Int(1 << 0) != 0 { + serializeString(q!, buffer: buffer, boxed: false) + } + if Int(flags) & Int(1 << 1) != 0 { + serializeInt32(topicId!, buffer: buffer, boxed: false) + } + serializeString(offset, buffer: buffer, boxed: false) + return (FunctionDescription(name: "channels.search", parameters: [("flags", ConstructorParameterDescription(flags)), ("q", ConstructorParameterDescription(q)), ("topicId", ConstructorParameterDescription(topicId)), ("offset", ConstructorParameterDescription(offset))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.channels.Found? in + let reader = BufferReader(buffer) + var result: Api.channels.Found? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.channels.Found + } + return result + }) + } +} public extension Api.functions.channels { static func searchPosts(flags: Int32, hashtag: String?, query: String?, offsetRate: Int32, offsetPeer: Api.InputPeer, offsetId: Int32, limit: Int32, allowPaidStars: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() @@ -5496,18 +5656,18 @@ public extension Api.functions.messages { } } public extension Api.functions.messages { - static func composeMessageWithAI(flags: Int32, text: Api.TextWithEntities, translateToLang: String?, changeTone: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + static func composeMessageWithAI(flags: Int32, text: Api.TextWithEntities, translateToLang: String?, tone: Api.InputAiComposeTone?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() - buffer.appendInt32(-45978882) + buffer.appendInt32(-622017143) serializeInt32(flags, buffer: buffer, boxed: false) text.serialize(buffer, true) if Int(flags) & Int(1 << 1) != 0 { serializeString(translateToLang!, buffer: buffer, boxed: false) } if Int(flags) & Int(1 << 2) != 0 { - serializeString(changeTone!, buffer: buffer, boxed: false) + tone!.serialize(buffer, true) } - return (FunctionDescription(name: "messages.composeMessageWithAI", parameters: [("flags", ConstructorParameterDescription(flags)), ("text", ConstructorParameterDescription(text)), ("translateToLang", ConstructorParameterDescription(translateToLang)), ("changeTone", ConstructorParameterDescription(changeTone))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ComposedMessageWithAI? in + return (FunctionDescription(name: "messages.composeMessageWithAI", parameters: [("flags", ConstructorParameterDescription(flags)), ("text", ConstructorParameterDescription(text)), ("translateToLang", ConstructorParameterDescription(translateToLang)), ("tone", ConstructorParameterDescription(tone))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.messages.ComposedMessageWithAI? in let reader = BufferReader(buffer) var result: Api.messages.ComposedMessageWithAI? if let signature = reader.readInt32() { @@ -9393,6 +9553,22 @@ public extension Api.functions.messages { }) } } +public extension Api.functions.messages { + static func setBotGuestChatResult(queryId: Int64, result: Api.InputBotInlineResult) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(86706395) + serializeInt64(queryId, buffer: buffer, boxed: false) + result.serialize(buffer, true) + return (FunctionDescription(name: "messages.setBotGuestChatResult", parameters: [("queryId", ConstructorParameterDescription(queryId)), ("result", ConstructorParameterDescription(result))]), 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 extension Api.functions.messages { static func setBotPrecheckoutResults(flags: Int32, queryId: Int64, error: String?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() @@ -12446,6 +12622,23 @@ public extension Api.functions.stats { }) } } +public extension Api.functions.stats { + static func getPollStats(flags: Int32, peer: Api.InputPeer, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { + let buffer = Buffer() + buffer.appendInt32(-1031931288) + serializeInt32(flags, buffer: buffer, boxed: false) + peer.serialize(buffer, true) + serializeInt32(msgId, buffer: buffer, boxed: false) + return (FunctionDescription(name: "stats.getPollStats", parameters: [("flags", ConstructorParameterDescription(flags)), ("peer", ConstructorParameterDescription(peer)), ("msgId", ConstructorParameterDescription(msgId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.stats.PollStats? in + let reader = BufferReader(buffer) + var result: Api.stats.PollStats? + if let signature = reader.readInt32() { + result = Api.parse(reader, signature: signature) as? Api.stats.PollStats + } + return result + }) + } +} public extension Api.functions.stats { static func getStoryPublicForwards(peer: Api.InputPeer, id: Int32, offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse) { let buffer = Buffer() diff --git a/submodules/TelegramApi/Sources/Api8.swift b/submodules/TelegramApi/Sources/Api8.swift index 0a41db4fc6..05c7d7bfde 100644 --- a/submodules/TelegramApi/Sources/Api8.swift +++ b/submodules/TelegramApi/Sources/Api8.swift @@ -607,6 +607,114 @@ public extension Api { } } } +public extension Api { + enum InputAiComposeTone: TypeConstructorDescription { + public class Cons_inputAiComposeToneDefault: TypeConstructorDescription { + public var tone: String + public init(tone: String) { + self.tone = tone + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputAiComposeToneDefault", [("tone", ConstructorParameterDescription(self.tone))]) + } + } + public class Cons_inputAiComposeToneID: TypeConstructorDescription { + public var id: Int64 + public var accessHash: Int64 + public init(id: Int64, accessHash: Int64) { + self.id = id + self.accessHash = accessHash + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputAiComposeToneID", [("id", ConstructorParameterDescription(self.id)), ("accessHash", ConstructorParameterDescription(self.accessHash))]) + } + } + public class Cons_inputAiComposeToneSlug: TypeConstructorDescription { + public var slug: String + public init(slug: String) { + self.slug = slug + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputAiComposeToneSlug", [("slug", ConstructorParameterDescription(self.slug))]) + } + } + case inputAiComposeToneDefault(Cons_inputAiComposeToneDefault) + case inputAiComposeToneID(Cons_inputAiComposeToneID) + case inputAiComposeToneSlug(Cons_inputAiComposeToneSlug) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputAiComposeToneDefault(let _data): + if boxed { + buffer.appendInt32(535407039) + } + serializeString(_data.tone, buffer: buffer, boxed: false) + break + case .inputAiComposeToneID(let _data): + if boxed { + buffer.appendInt32(125026432) + } + serializeInt64(_data.id, buffer: buffer, boxed: false) + serializeInt64(_data.accessHash, buffer: buffer, boxed: false) + break + case .inputAiComposeToneSlug(let _data): + if boxed { + buffer.appendInt32(530584407) + } + serializeString(_data.slug, buffer: buffer, boxed: false) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .inputAiComposeToneDefault(let _data): + return ("inputAiComposeToneDefault", [("tone", ConstructorParameterDescription(_data.tone))]) + case .inputAiComposeToneID(let _data): + return ("inputAiComposeToneID", [("id", ConstructorParameterDescription(_data.id)), ("accessHash", ConstructorParameterDescription(_data.accessHash))]) + case .inputAiComposeToneSlug(let _data): + return ("inputAiComposeToneSlug", [("slug", ConstructorParameterDescription(_data.slug))]) + } + } + + public static func parse_inputAiComposeToneDefault(_ reader: BufferReader) -> InputAiComposeTone? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.InputAiComposeTone.inputAiComposeToneDefault(Cons_inputAiComposeToneDefault(tone: _1!)) + } + else { + return nil + } + } + public static func parse_inputAiComposeToneID(_ reader: BufferReader) -> InputAiComposeTone? { + var _1: Int64? + _1 = reader.readInt64() + var _2: Int64? + _2 = reader.readInt64() + let _c1 = _1 != nil + let _c2 = _2 != nil + if _c1 && _c2 { + return Api.InputAiComposeTone.inputAiComposeToneID(Cons_inputAiComposeToneID(id: _1!, accessHash: _2!)) + } + else { + return nil + } + } + public static func parse_inputAiComposeToneSlug(_ reader: BufferReader) -> InputAiComposeTone? { + var _1: String? + _1 = parseString(reader) + let _c1 = _1 != nil + if _c1 { + return Api.InputAiComposeTone.inputAiComposeToneSlug(Cons_inputAiComposeToneSlug(slug: _1!)) + } + else { + return nil + } + } + } +} public extension Api { enum InputAppEvent: TypeConstructorDescription { public class Cons_inputAppEvent: TypeConstructorDescription { @@ -1717,69 +1825,3 @@ public extension Api { } } } -public extension Api { - enum InputBusinessAwayMessage: TypeConstructorDescription { - public class Cons_inputBusinessAwayMessage: TypeConstructorDescription { - public var flags: Int32 - public var shortcutId: Int32 - public var schedule: Api.BusinessAwayMessageSchedule - public var recipients: Api.InputBusinessRecipients - public init(flags: Int32, shortcutId: Int32, schedule: Api.BusinessAwayMessageSchedule, recipients: Api.InputBusinessRecipients) { - self.flags = flags - self.shortcutId = shortcutId - self.schedule = schedule - self.recipients = recipients - } - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - return ("inputBusinessAwayMessage", [("flags", ConstructorParameterDescription(self.flags)), ("shortcutId", ConstructorParameterDescription(self.shortcutId)), ("schedule", ConstructorParameterDescription(self.schedule)), ("recipients", ConstructorParameterDescription(self.recipients))]) - } - } - case inputBusinessAwayMessage(Cons_inputBusinessAwayMessage) - - public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { - switch self { - case .inputBusinessAwayMessage(let _data): - if boxed { - buffer.appendInt32(-2094959136) - } - serializeInt32(_data.flags, buffer: buffer, boxed: false) - serializeInt32(_data.shortcutId, buffer: buffer, boxed: false) - _data.schedule.serialize(buffer, true) - _data.recipients.serialize(buffer, true) - break - } - } - - public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { - switch self { - case .inputBusinessAwayMessage(let _data): - return ("inputBusinessAwayMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("shortcutId", ConstructorParameterDescription(_data.shortcutId)), ("schedule", ConstructorParameterDescription(_data.schedule)), ("recipients", ConstructorParameterDescription(_data.recipients))]) - } - } - - public static func parse_inputBusinessAwayMessage(_ reader: BufferReader) -> InputBusinessAwayMessage? { - var _1: Int32? - _1 = reader.readInt32() - var _2: Int32? - _2 = reader.readInt32() - var _3: Api.BusinessAwayMessageSchedule? - if let signature = reader.readInt32() { - _3 = Api.parse(reader, signature: signature) as? Api.BusinessAwayMessageSchedule - } - var _4: Api.InputBusinessRecipients? - if let signature = reader.readInt32() { - _4 = Api.parse(reader, signature: signature) as? Api.InputBusinessRecipients - } - let _c1 = _1 != nil - let _c2 = _2 != nil - let _c3 = _3 != nil - let _c4 = _4 != nil - if _c1 && _c2 && _c3 && _c4 { - return Api.InputBusinessAwayMessage.inputBusinessAwayMessage(Cons_inputBusinessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)) - } - else { - return nil - } - } - } -} diff --git a/submodules/TelegramApi/Sources/Api9.swift b/submodules/TelegramApi/Sources/Api9.swift index c31a55774b..2215b0b419 100644 --- a/submodules/TelegramApi/Sources/Api9.swift +++ b/submodules/TelegramApi/Sources/Api9.swift @@ -1,3 +1,69 @@ +public extension Api { + enum InputBusinessAwayMessage: TypeConstructorDescription { + public class Cons_inputBusinessAwayMessage: TypeConstructorDescription { + public var flags: Int32 + public var shortcutId: Int32 + public var schedule: Api.BusinessAwayMessageSchedule + public var recipients: Api.InputBusinessRecipients + public init(flags: Int32, shortcutId: Int32, schedule: Api.BusinessAwayMessageSchedule, recipients: Api.InputBusinessRecipients) { + self.flags = flags + self.shortcutId = shortcutId + self.schedule = schedule + self.recipients = recipients + } + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + return ("inputBusinessAwayMessage", [("flags", ConstructorParameterDescription(self.flags)), ("shortcutId", ConstructorParameterDescription(self.shortcutId)), ("schedule", ConstructorParameterDescription(self.schedule)), ("recipients", ConstructorParameterDescription(self.recipients))]) + } + } + case inputBusinessAwayMessage(Cons_inputBusinessAwayMessage) + + public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { + switch self { + case .inputBusinessAwayMessage(let _data): + if boxed { + buffer.appendInt32(-2094959136) + } + serializeInt32(_data.flags, buffer: buffer, boxed: false) + serializeInt32(_data.shortcutId, buffer: buffer, boxed: false) + _data.schedule.serialize(buffer, true) + _data.recipients.serialize(buffer, true) + break + } + } + + public func descriptionFields() -> (String, [(String, ConstructorParameterDescription)]) { + switch self { + case .inputBusinessAwayMessage(let _data): + return ("inputBusinessAwayMessage", [("flags", ConstructorParameterDescription(_data.flags)), ("shortcutId", ConstructorParameterDescription(_data.shortcutId)), ("schedule", ConstructorParameterDescription(_data.schedule)), ("recipients", ConstructorParameterDescription(_data.recipients))]) + } + } + + public static func parse_inputBusinessAwayMessage(_ reader: BufferReader) -> InputBusinessAwayMessage? { + var _1: Int32? + _1 = reader.readInt32() + var _2: Int32? + _2 = reader.readInt32() + var _3: Api.BusinessAwayMessageSchedule? + if let signature = reader.readInt32() { + _3 = Api.parse(reader, signature: signature) as? Api.BusinessAwayMessageSchedule + } + var _4: Api.InputBusinessRecipients? + if let signature = reader.readInt32() { + _4 = Api.parse(reader, signature: signature) as? Api.InputBusinessRecipients + } + let _c1 = _1 != nil + let _c2 = _2 != nil + let _c3 = _3 != nil + let _c4 = _4 != nil + if _c1 && _c2 && _c3 && _c4 { + return Api.InputBusinessAwayMessage.inputBusinessAwayMessage(Cons_inputBusinessAwayMessage(flags: _1!, shortcutId: _2!, schedule: _3!, recipients: _4!)) + } + else { + return nil + } + } + } +} public extension Api { enum InputBusinessBotRecipients: TypeConstructorDescription { public class Cons_inputBusinessBotRecipients: TypeConstructorDescription { diff --git a/submodules/TelegramCore/Sources/Account/AccountManager.swift b/submodules/TelegramCore/Sources/Account/AccountManager.swift index 0024856b50..e9ea0821e5 100644 --- a/submodules/TelegramCore/Sources/Account/AccountManager.swift +++ b/submodules/TelegramCore/Sources/Account/AccountManager.swift @@ -242,6 +242,7 @@ private var declaredEncodables: Void = { declareEncodable(TelegramMediaLiveStream.self, f: { TelegramMediaLiveStream(decoder: $0) }) declareEncodable(ScheduledRepeatAttribute.self, f: { ScheduledRepeatAttribute(decoder: $0) }) declareEncodable(SummarizationMessageAttribute.self, f: { SummarizationMessageAttribute(decoder: $0) }) + declareEncodable(GuestChatMessageAttribute.self, f: { GuestChatMessageAttribute(decoder: $0) }) return }() diff --git a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift index db7cd5ebd2..30e939643c 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/StoreMessage_Telegram.swift @@ -463,7 +463,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI let (poll, results) = (messageMediaPollData.poll, messageMediaPollData.results) switch poll { case let .poll(pollData): - let (id, flags, question, answers, closePeriod, closeDate, pollHash) = (pollData.id, pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash) + let (id, flags, question, answers, closePeriod, closeDate, pollHash, countries) = (pollData.id, pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash, pollData.countriesIso2) let publicity: TelegramMediaPollPublicity if (flags & (1 << 1)) != 0 { publicity = .public @@ -482,7 +482,8 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI let shuffleAnswers = (flags & (1 << 8)) != 0 let hideResultsUntilClose = (flags & (1 << 9)) != 0 let isCreator = (flags & (1 << 10)) != 0 - + let restrictToSubscribers = (flags & (1 << 11)) != 0 + let questionText: String let questionEntities: [MessageTextEntity] switch question { @@ -496,7 +497,7 @@ func textMediaAndExpirationTimerFromApiMedia(_ media: Api.MessageMedia?, _ peerI if let apiAttachedMedia = messageMediaPollData.attachedMedia { parsedAttachedMedia = textMediaAndExpirationTimerFromApiMedia(apiAttachedMedia, peerId).media } - return (TelegramMediaPoll(pollId: MediaId(namespace: Namespaces.Media.CloudPoll, id: id), publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: TelegramMediaPollResults(apiResults: results), isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, isCreator: isCreator, attachedMedia: parsedAttachedMedia), nil, nil, nil, nil, nil) + return (TelegramMediaPoll(pollId: MediaId(namespace: Namespaces.Media.CloudPoll, id: id), publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: TelegramMediaPollResults(apiResults: results), isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, isCreator: isCreator, attachedMedia: parsedAttachedMedia, restrictToSubscribers: restrictToSubscribers, countries: countries ?? []), nil, nil, nil, nil, nil) } case let .messageMediaToDo(messageMediaToDoData): let (todo, completions) = (messageMediaToDoData.todo, messageMediaToDoData.completions) @@ -847,7 +848,7 @@ extension StoreMessage { convenience init?(apiMessage: Api.Message, accountPeerId: PeerId, peerIsForum: Bool, namespace: MessageId.Namespace = Namespaces.Message.Cloud) { switch apiMessage { case let .message(messageData): - let (flags, flags2, id, fromId, boosts, rank, chatPeerId, savedPeerId, fwdFrom, viaBotId, viaBusinessBotId, replyTo, date, message, media, replyMarkup, entities, views, forwards, replies, editDate, postAuthor, groupingId, reactions, restrictionReason, ttlPeriod, quickReplyShortcutId, messageEffectId, factCheck, reportDeliveryUntilDate, paidMessageStars, suggestedPost, scheduledRepeatPeriod, summaryFromLanguage) = (messageData.flags, messageData.flags2, messageData.id, messageData.fromId, messageData.fromBoostsApplied, messageData.fromRank, messageData.peerId, messageData.savedPeerId, messageData.fwdFrom, messageData.viaBotId, messageData.viaBusinessBotId, messageData.replyTo, messageData.date, messageData.message, messageData.media, messageData.replyMarkup, messageData.entities, messageData.views, messageData.forwards, messageData.replies, messageData.editDate, messageData.postAuthor, messageData.groupedId, messageData.reactions, messageData.restrictionReason, messageData.ttlPeriod, messageData.quickReplyShortcutId, messageData.effect, messageData.factcheck, messageData.reportDeliveryUntilDate, messageData.paidMessageStars, messageData.suggestedPost, messageData.scheduleRepeatPeriod, messageData.summaryFromLanguage) + let (flags, flags2, id, fromId, boosts, rank, chatPeerId, savedPeerId, fwdFrom, viaBotId, viaBusinessBotId, guestChatViaFrom, replyTo, date, message, media, replyMarkup, entities, views, forwards, replies, editDate, postAuthor, groupingId, reactions, restrictionReason, ttlPeriod, quickReplyShortcutId, messageEffectId, factCheck, reportDeliveryUntilDate, paidMessageStars, suggestedPost, scheduledRepeatPeriod, summaryFromLanguage) = (messageData.flags, messageData.flags2, messageData.id, messageData.fromId, messageData.fromBoostsApplied, messageData.fromRank, messageData.peerId, messageData.savedPeerId, messageData.fwdFrom, messageData.viaBotId, messageData.viaBusinessBotId, messageData.guestchatViaFrom, messageData.replyTo, messageData.date, messageData.message, messageData.media, messageData.replyMarkup, messageData.entities, messageData.views, messageData.forwards, messageData.replies, messageData.editDate, messageData.postAuthor, messageData.groupedId, messageData.reactions, messageData.restrictionReason, messageData.ttlPeriod, messageData.quickReplyShortcutId, messageData.effect, messageData.factcheck, messageData.reportDeliveryUntilDate, messageData.paidMessageStars, messageData.suggestedPost, messageData.scheduleRepeatPeriod, messageData.summaryFromLanguage) var attributes: [MessageAttribute] = [] if (flags2 & (1 << 4)) != 0 { @@ -1086,6 +1087,10 @@ extension StoreMessage { if let viaBusinessBotId { attributes.append(InlineBusinessBotMessageAttribute(peerId: PeerId(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(viaBusinessBotId)), title: nil)) } + + if let guestChatViaFrom { + attributes.append(GuestChatMessageAttribute(peerId: guestChatViaFrom.peerId)) + } if !Namespaces.Message.allNonRegular.contains(namespace) { if let views = views { diff --git a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift index 7e5d355ecb..4580acf837 100644 --- a/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift +++ b/submodules/TelegramCore/Sources/ApiUtils/TelegramMediaPoll.swift @@ -71,10 +71,12 @@ extension TelegramMediaPollResults { if (flags & (1 << 0)) == 0 {//isMin hasUnseenVotes = (flags & (1 << 6)) != 0 } + + let canViewStats = (flags & (1 << 7)) != 0 self.init(voters: results.flatMap({ $0.map(TelegramMediaPollOptionVoters.init(apiVoters:)) }), totalVoters: totalVoters, recentVoters: recentVoters.flatMap { recentVoters in return recentVoters.map { $0.peerId } - } ?? [], solution: parsedSolution, hasUnseenVotes: hasUnseenVotes) + } ?? [], solution: parsedSolution, hasUnseenVotes: hasUnseenVotes, canViewStats: canViewStats) } } } diff --git a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift index bea55f4b28..b1ec80f12f 100644 --- a/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift +++ b/submodules/TelegramCore/Sources/PendingMessages/PendingMessageUploadedContent.swift @@ -345,11 +345,25 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post if poll.deadlineDate != nil { pollFlags |= 1 << 5 } - if poll.openAnswers { pollFlags |= 1 << 6 } - if poll.revotingDisabled { pollFlags |= 1 << 7 } - if poll.shuffleAnswers { pollFlags |= 1 << 8 } - if poll.hideResultsUntilClose { pollFlags |= 1 << 9 } - + if poll.openAnswers { + pollFlags |= 1 << 6 + } + if poll.revotingDisabled { + pollFlags |= 1 << 7 + } + if poll.shuffleAnswers { + pollFlags |= 1 << 8 + } + if poll.hideResultsUntilClose { + pollFlags |= 1 << 9 + } + if poll.restrictToSubscribers { + pollFlags |= 1 << 11 + } + if !poll.countries.isEmpty { + pollFlags |= 1 << 12 + } + var mappedSolution: String? var mappedSolutionEntities: [Api.MessageEntity]? if let solution = poll.results.solution { @@ -376,7 +390,24 @@ func mediaContentToUpload(accountPeerId: PeerId, network: Network, postbox: Post if solutionInputMedia != nil { pollMediaFlags |= 1 << 2 } - let inputPoll = Api.InputMedia.inputMediaPoll(.init(flags: pollMediaFlags, poll: .poll(.init(id: 0, flags: pollFlags, question: .textWithEntities(.init( text: poll.text, entities: apiEntitiesFromMessageTextEntities(poll.textEntities, associatedPeers: SimpleDictionary()) )), answers: apiAnswers, closePeriod: poll.deadlineTimeout, closeDate: poll.deadlineDate, hash: 0)), correctAnswers: correctAnswers, attachedMedia: attachedInputMedia, solution: mappedSolution, solutionEntities: mappedSolutionEntities, solutionMedia: solutionInputMedia)) + let inputPoll = Api.InputMedia.inputMediaPoll(.init( + flags: pollMediaFlags, + poll: .poll(.init( + id: 0, + flags: pollFlags, + question: .textWithEntities(.init( text: poll.text, entities: apiEntitiesFromMessageTextEntities(poll.textEntities, associatedPeers: SimpleDictionary()) )), + answers: apiAnswers, + closePeriod: poll.deadlineTimeout, + closeDate: poll.deadlineDate, + countriesIso2: poll.countries, + hash: 0 + )), + correctAnswers: correctAnswers, + attachedMedia: attachedInputMedia, + solution: mappedSolution, + solutionEntities: mappedSolutionEntities, + solutionMedia: solutionInputMedia + )) return .single(.content(PendingMessageUploadedContentAndReuploadInfo(content: .media(inputPoll, text), reuploadInfo: nil, cacheReferenceKey: nil))) } else if let todo = media as? TelegramMediaTodo { var flags: Int32 = 0 diff --git a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift index 8afe3cfffc..37fe0b2cbd 100644 --- a/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift +++ b/submodules/TelegramCore/Sources/State/AccountStateManagementUtils.swift @@ -4515,7 +4515,7 @@ func replayFinalState( if let apiPoll = apiPoll { switch apiPoll { case let .poll(pollData): - let (id, flags, question, answers, closePeriod, closeDate, pollHash) = (pollData.id, pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash) + let (id, flags, question, answers, closePeriod, closeDate, pollHash, countries) = (pollData.id, pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash, pollData.countriesIso2) let publicity: TelegramMediaPollPublicity if (flags & (1 << 1)) != 0 { publicity = .public @@ -4533,6 +4533,7 @@ func replayFinalState( let shuffleAnswers = (flags & (1 << 8)) != 0 let hideResultsUntilClose = (flags & (1 << 9)) != 0 let isCreator = (flags & (1 << 10)) != 0 + let restrictToSubscribers = (flags & (1 << 11)) != 0 let questionText: String let questionEntities: [MessageTextEntity] @@ -4543,7 +4544,7 @@ func replayFinalState( questionEntities = messageTextEntitiesFromApiEntities(entities) } - updatedPoll = TelegramMediaPoll(pollId: MediaId(namespace: Namespaces.Media.CloudPoll, id: id), publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: poll.results, isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, isCreator: isCreator, attachedMedia: poll.attachedMedia) + updatedPoll = TelegramMediaPoll(pollId: MediaId(namespace: Namespaces.Media.CloudPoll, id: id), publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: poll.results, isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, isCreator: isCreator, attachedMedia: poll.attachedMedia, restrictToSubscribers: restrictToSubscribers, countries: countries ?? []) } } updatedPoll = updatedPoll.withUpdatedResults(TelegramMediaPollResults(apiResults: results), min: resultsMin) diff --git a/submodules/TelegramCore/Sources/State/Serialization.swift b/submodules/TelegramCore/Sources/State/Serialization.swift index 913e49ab09..832c5530cc 100644 --- a/submodules/TelegramCore/Sources/State/Serialization.swift +++ b/submodules/TelegramCore/Sources/State/Serialization.swift @@ -260,7 +260,7 @@ public class BoxedMessage: NSObject { public class Serialization: NSObject, MTSerialization { public func currentLayer() -> UInt { - return 224 + return 225 } public func parseMessage(_ data: Data!) -> Any! { diff --git a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift index 5207a6c23c..3a7916a82e 100644 --- a/submodules/TelegramCore/Sources/State/UpdateMessageService.swift +++ b/submodules/TelegramCore/Sources/State/UpdateMessageService.swift @@ -62,7 +62,7 @@ class UpdateMessageService: NSObject, MTMessageService { } case let .updateShortChatMessage(updateShortChatMessageData): let (flags, id, fromId, chatId, message, pts, ptsCount, date, fwdFrom, viaBotId, replyHeader, entities, ttlPeriod) = (updateShortChatMessageData.flags, updateShortChatMessageData.id, updateShortChatMessageData.fromId, updateShortChatMessageData.chatId, updateShortChatMessageData.message, updateShortChatMessageData.pts, updateShortChatMessageData.ptsCount, updateShortChatMessageData.date, updateShortChatMessageData.fwdFrom, updateShortChatMessageData.viaBotId, updateShortChatMessageData.replyTo, updateShortChatMessageData.entities, updateShortChatMessageData.ttlPeriod) - let generatedMessage = Api.Message.message(.init(flags: flags, flags2: 0, id: id, fromId: .peerUser(.init(userId: fromId)), fromBoostsApplied: nil, fromRank: nil, peerId: Api.Peer.peerChat(.init(chatId: chatId)), savedPeerId: nil, fwdFrom: fwdFrom, viaBotId: viaBotId, viaBusinessBotId: nil, replyTo: replyHeader, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, reactions: nil, restrictionReason: nil, ttlPeriod: ttlPeriod, quickReplyShortcutId: nil, effect: nil, factcheck: nil, reportDeliveryUntilDate: nil, paidMessageStars: nil, suggestedPost: nil, scheduleRepeatPeriod: nil, summaryFromLanguage: nil)) + let generatedMessage = Api.Message.message(.init(flags: flags, flags2: 0, id: id, fromId: .peerUser(.init(userId: fromId)), fromBoostsApplied: nil, fromRank: nil, peerId: Api.Peer.peerChat(.init(chatId: chatId)), savedPeerId: nil, fwdFrom: fwdFrom, viaBotId: viaBotId, viaBusinessBotId: nil, guestchatViaFrom: nil, replyTo: replyHeader, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, reactions: nil, restrictionReason: nil, ttlPeriod: ttlPeriod, quickReplyShortcutId: nil, effect: nil, factcheck: nil, reportDeliveryUntilDate: nil, paidMessageStars: nil, suggestedPost: nil, scheduleRepeatPeriod: nil, summaryFromLanguage: nil)) let update = Api.Update.updateNewMessage(.init(message: generatedMessage, pts: pts, ptsCount: ptsCount)) let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil) if groups.count != 0 { @@ -79,7 +79,7 @@ class UpdateMessageService: NSObject, MTMessageService { let generatedPeerId = Api.Peer.peerUser(.init(userId: userId)) - let generatedMessage = Api.Message.message(.init(flags: flags, flags2: 0, id: id, fromId: generatedFromId, fromBoostsApplied: nil, fromRank: nil, peerId: generatedPeerId, savedPeerId: nil, fwdFrom: fwdFrom, viaBotId: viaBotId, viaBusinessBotId: nil, replyTo: replyHeader, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, reactions: nil, restrictionReason: nil, ttlPeriod: ttlPeriod, quickReplyShortcutId: nil, effect: nil, factcheck: nil, reportDeliveryUntilDate: nil, paidMessageStars: nil, suggestedPost: nil, scheduleRepeatPeriod: nil, summaryFromLanguage: nil)) + let generatedMessage = Api.Message.message(.init(flags: flags, flags2: 0, id: id, fromId: generatedFromId, fromBoostsApplied: nil, fromRank: nil, peerId: generatedPeerId, savedPeerId: nil, fwdFrom: fwdFrom, viaBotId: viaBotId, viaBusinessBotId: nil, guestchatViaFrom: nil, replyTo: replyHeader, date: date, message: message, media: Api.MessageMedia.messageMediaEmpty, replyMarkup: nil, entities: entities, views: nil, forwards: nil, replies: nil, editDate: nil, postAuthor: nil, groupedId: nil, reactions: nil, restrictionReason: nil, ttlPeriod: ttlPeriod, quickReplyShortcutId: nil, effect: nil, factcheck: nil, reportDeliveryUntilDate: nil, paidMessageStars: nil, suggestedPost: nil, scheduleRepeatPeriod: nil, summaryFromLanguage: nil)) let update = Api.Update.updateNewMessage(.init(message: generatedMessage, pts: pts, ptsCount: ptsCount)) let groups = groupUpdates([update], users: [], chats: [], date: date, seqRange: nil) if groups.count != 0 { diff --git a/submodules/TelegramCore/Sources/Statistics/PollStatistics.swift b/submodules/TelegramCore/Sources/Statistics/PollStatistics.swift new file mode 100644 index 0000000000..ff24a510a2 --- /dev/null +++ b/submodules/TelegramCore/Sources/Statistics/PollStatistics.swift @@ -0,0 +1,193 @@ +import Foundation +import SwiftSignalKit +import Postbox +import TelegramApi +import MtProtoKit + +public struct PollStats: Equatable { + public let votesGraph: StatsGraph + + init(votesGraph: StatsGraph) { + self.votesGraph = votesGraph + } + + public static func == (lhs: PollStats, rhs: PollStats) -> Bool { + if lhs.votesGraph != rhs.votesGraph { + return false + } + return true + } + + public func withUpdatedVotesGraph(_ votesGraph: StatsGraph) -> PollStats { + return PollStats(votesGraph: votesGraph) + } +} + +public struct PollStatsContextState: Equatable { + public var stats: PollStats? +} + +private func requestPollStats(postbox: Postbox, network: Network, messageId: MessageId, dark: Bool = false) -> Signal { + return postbox.transaction { transaction -> (Int32, Peer)? in + if let peer = transaction.getPeer(messageId.peerId){ + if let cachedData = transaction.getPeerCachedData(peerId: messageId.peerId) as? CachedChannelData, cachedData.statsDatacenterId != 0 { + return (cachedData.statsDatacenterId, peer) + } else { + return (Int32(network.datacenterId), peer) + } + } else { + return nil + } + } |> mapToSignal { data -> Signal in + guard let (datacenterId, peer) = data, let inputPeer = apiInputPeer(peer) else { + return .never() + } + + var flags: Int32 = 0 + if dark { + flags |= (1 << 1) + } + + let request = Api.functions.stats.getPollStats(flags: flags, peer: inputPeer, msgId: messageId.id) + let signal: Signal + if network.datacenterId != datacenterId { + signal = network.download(datacenterId: Int(datacenterId), isMedia: false, tag: nil) + |> castError(MTRpcError.self) + |> mapToSignal { worker in + return worker.request(request) + } + } else { + signal = network.request(request) + } + + return signal + |> mapToSignal { result -> Signal in + switch result { + case let .pollStats(pollStatsData): + let votesGraph = StatsGraph(apiStatsGraph: pollStatsData.votesGraph) + return .single(PollStats(votesGraph: votesGraph)) + } + } + |> retryRequest + } +} + +private final class PollStatsContextImpl { + private let postbox: Postbox + private let network: Network + private let messageId: MessageId + + private var _state: PollStatsContextState { + didSet { + if self._state != oldValue { + self._statePromise.set(.single(self._state)) + } + } + } + private let _statePromise = Promise() + var state: Signal { + return self._statePromise.get() + } + + private let disposable = MetaDisposable() + private let disposables = DisposableDict() + + init(postbox: Postbox, network: Network, messageId: MessageId) { + assert(Queue.mainQueue().isCurrent()) + + self.postbox = postbox + self.network = network + self.messageId = messageId + self._state = PollStatsContextState(stats: nil) + self._statePromise.set(.single(self._state)) + + self.load() + } + + deinit { + assert(Queue.mainQueue().isCurrent()) + self.disposable.dispose() + self.disposables.dispose() + } + + private func load() { + assert(Queue.mainQueue().isCurrent()) + + self.disposable.set((requestPollStats(postbox: self.postbox, network: self.network, messageId: self.messageId) + |> deliverOnMainQueue).start(next: { [weak self] stats in + if let strongSelf = self { + strongSelf._state = PollStatsContextState(stats: stats) + strongSelf._statePromise.set(.single(strongSelf._state)) + } + })) + } + + func loadVotesGraph() { + assert(Queue.mainQueue().isCurrent()) + + guard let stats = self._state.stats else { + return + } + if case let .OnDemand(token) = stats.votesGraph { + guard !token.isEmpty else { + return + } + self.disposables.set((requestGraph(postbox: self.postbox, network: self.network, peerId: self.messageId.peerId, token: token) + |> deliverOnMainQueue).start(next: { [weak self] graph in + if let strongSelf = self, let graph = graph { + strongSelf._state = PollStatsContextState(stats: strongSelf._state.stats?.withUpdatedVotesGraph(graph)) + strongSelf._statePromise.set(.single(strongSelf._state)) + } + }), forKey: token) + } + } + + func loadDetailedGraph(_ graph: StatsGraph, x: Int64) -> Signal { + if let token = graph.token { + return requestGraph(postbox: self.postbox, network: self.network, peerId: self.messageId.peerId, token: token, x: x) + } else { + return .single(nil) + } + } +} + +public final class PollStatsContext { + private let impl: QueueLocalObject + + public var state: Signal { + return Signal { subscriber in + let disposable = MetaDisposable() + self.impl.with { impl in + disposable.set(impl.state.start(next: { value in + subscriber.putNext(value) + })) + } + return disposable + } + } + + public init(account: Account, messageId: MessageId) { + self.impl = QueueLocalObject(queue: Queue.mainQueue(), generate: { + return PollStatsContextImpl(postbox: account.postbox, network: account.network, messageId: messageId) + }) + } + + public func loadVotesGraph() { + self.impl.with { impl in + impl.loadVotesGraph() + } + } + + public func loadDetailedGraph(_ graph: StatsGraph, x: Int64) -> Signal { + return Signal { subscriber in + let disposable = MetaDisposable() + self.impl.with { impl in + disposable.set(impl.loadDetailedGraph(graph, x: x).start(next: { value in + subscriber.putNext(value) + subscriber.putCompletion() + })) + } + return disposable + } + } +} diff --git a/submodules/TelegramCore/Sources/SyncCore/GuestChatMessageAttribute.swift b/submodules/TelegramCore/Sources/SyncCore/GuestChatMessageAttribute.swift new file mode 100644 index 0000000000..cb5b4d2511 --- /dev/null +++ b/submodules/TelegramCore/Sources/SyncCore/GuestChatMessageAttribute.swift @@ -0,0 +1,22 @@ +import Foundation +import Postbox + +public class GuestChatMessageAttribute: MessageAttribute { + public let peerId: EnginePeer.Id + + public var associatedPeerIds: [PeerId] { + return [self.peerId] + } + + public init(peerId: EnginePeer.Id) { + self.peerId = peerId + } + + required public init(decoder: PostboxDecoder) { + self.peerId = EnginePeer.Id(decoder.decodeInt64ForKey("p", orElse: 0)) + } + + public func encode(_ encoder: PostboxEncoder) { + encoder.encodeInt64(self.peerId.toInt64(), forKey: "p") + } +} diff --git a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaPoll.swift b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaPoll.swift index 703a6a0f46..3038d37171 100644 --- a/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaPoll.swift +++ b/submodules/TelegramCore/Sources/SyncCore/SyncCore_TelegramMediaPoll.swift @@ -140,13 +140,15 @@ public struct TelegramMediaPollResults: Equatable, PostboxCoding { public let recentVoters: [PeerId] public let solution: TelegramMediaPollResults.Solution? public let hasUnseenVotes: Bool? + public let canViewStats: Bool - public init(voters: [TelegramMediaPollOptionVoters]?, totalVoters: Int32?, recentVoters: [PeerId], solution: TelegramMediaPollResults.Solution?, hasUnseenVotes: Bool?) { + public init(voters: [TelegramMediaPollOptionVoters]?, totalVoters: Int32?, recentVoters: [PeerId], solution: TelegramMediaPollResults.Solution?, hasUnseenVotes: Bool?, canViewStats: Bool) { self.voters = voters self.totalVoters = totalVoters self.recentVoters = recentVoters self.solution = solution self.hasUnseenVotes = hasUnseenVotes + self.canViewStats = canViewStats } public init(decoder: PostboxDecoder) { @@ -161,6 +163,7 @@ public struct TelegramMediaPollResults: Equatable, PostboxCoding { self.solution = nil } self.hasUnseenVotes = decoder.decodeOptionalBoolForKey("uns") + self.canViewStats = decoder.decodeBoolForKey("cvs", orElse: false) } public func encode(_ encoder: PostboxEncoder) { @@ -191,6 +194,7 @@ public struct TelegramMediaPollResults: Equatable, PostboxCoding { } else { encoder.encodeNil(forKey: "uns") } + encoder.encodeBool(self.canViewStats, forKey: "cvs") } } @@ -273,8 +277,10 @@ public final class TelegramMediaPoll: Media, Equatable { public let hideResultsUntilClose: Bool public let isCreator: Bool public let attachedMedia: Media? + public let restrictToSubscribers: Bool + public let countries: [String] - public init(pollId: MediaId, publicity: TelegramMediaPollPublicity, kind: TelegramMediaPollKind, text: String, textEntities: [MessageTextEntity], options: [TelegramMediaPollOption], correctAnswers: [Data]?, results: TelegramMediaPollResults, isClosed: Bool, deadlineTimeout: Int32?, deadlineDate: Int32?, pollHash: Int64, openAnswers: Bool = false, revotingDisabled: Bool = false, shuffleAnswers: Bool = false, hideResultsUntilClose: Bool = false, isCreator: Bool = false, attachedMedia: Media? = nil) { + public init(pollId: MediaId, publicity: TelegramMediaPollPublicity, kind: TelegramMediaPollKind, text: String, textEntities: [MessageTextEntity], options: [TelegramMediaPollOption], correctAnswers: [Data]?, results: TelegramMediaPollResults, isClosed: Bool, deadlineTimeout: Int32?, deadlineDate: Int32?, pollHash: Int64, openAnswers: Bool = false, revotingDisabled: Bool = false, shuffleAnswers: Bool = false, hideResultsUntilClose: Bool = false, isCreator: Bool = false, attachedMedia: Media? = nil, restrictToSubscribers: Bool = false, countries: [String] = []) { self.pollId = pollId self.publicity = publicity self.kind = kind @@ -293,6 +299,8 @@ public final class TelegramMediaPoll: Media, Equatable { self.hideResultsUntilClose = hideResultsUntilClose self.isCreator = isCreator self.attachedMedia = attachedMedia + self.restrictToSubscribers = restrictToSubscribers + self.countries = countries } public init(decoder: PostboxDecoder) { @@ -307,7 +315,7 @@ public final class TelegramMediaPoll: Media, Equatable { self.textEntities = decoder.decodeObjectArrayWithDecoderForKey("te") self.options = decoder.decodeObjectArrayWithDecoderForKey("os") self.correctAnswers = decoder.decodeOptionalDataArrayForKey("ca") - self.results = decoder.decodeObjectForKey("rs", decoder: { TelegramMediaPollResults(decoder: $0) }) as? TelegramMediaPollResults ?? TelegramMediaPollResults(voters: nil, totalVoters: nil, recentVoters: [], solution: nil, hasUnseenVotes: nil) + self.results = decoder.decodeObjectForKey("rs", decoder: { TelegramMediaPollResults(decoder: $0) }) as? TelegramMediaPollResults ?? TelegramMediaPollResults(voters: nil, totalVoters: nil, recentVoters: [], solution: nil, hasUnseenVotes: nil, canViewStats: false) self.isClosed = decoder.decodeInt32ForKey("ic", orElse: 0) != 0 self.deadlineTimeout = decoder.decodeOptionalInt32ForKey("dt") self.deadlineDate = decoder.decodeOptionalInt32ForKey("dd") @@ -318,6 +326,8 @@ public final class TelegramMediaPoll: Media, Equatable { self.hideResultsUntilClose = decoder.decodeInt32ForKey("hr", orElse: 0) != 0 self.isCreator = decoder.decodeInt32ForKey("cr", orElse: 0) != 0 self.attachedMedia = decoder.decodeObjectForKey("am") as? Media + self.restrictToSubscribers = decoder.decodeInt32ForKey("sub", orElse: 0) != 0 + self.countries = decoder.decodeStringArrayForKey("cnt") } public func encode(_ encoder: PostboxEncoder) { @@ -357,6 +367,8 @@ public final class TelegramMediaPoll: Media, Equatable { } else { encoder.encodeNil(forKey: "am") } + encoder.encodeInt32(self.restrictToSubscribers ? 1 : 0, forKey: "sub") + encoder.encodeStringArray(self.countries, forKey: "cnt") } public func isEqual(to other: Media) -> Bool { @@ -427,6 +439,12 @@ public final class TelegramMediaPoll: Media, Equatable { } else if (lhs.attachedMedia == nil) != (rhs.attachedMedia == nil) { return false } + if lhs.restrictToSubscribers != rhs.restrictToSubscribers { + return false + } + if lhs.countries != rhs.countries { + return false + } return true } @@ -446,21 +464,21 @@ public final class TelegramMediaPoll: Media, Equatable { } updatedResults = TelegramMediaPollResults(voters: updatedVoters.map({ voters in return TelegramMediaPollOptionVoters(selected: selectedOpaqueIdentifiers.contains(voters.opaqueIdentifier), opaqueIdentifier: voters.opaqueIdentifier, count: voters.count, isCorrect: correctOpaqueIdentifiers.contains(voters.opaqueIdentifier), recentVoters: voters.recentVoters) - }), totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes) + }), totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes, canViewStats: results.canViewStats) } else if let updatedVoters = results.voters { - updatedResults = TelegramMediaPollResults(voters: updatedVoters, totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes) + updatedResults = TelegramMediaPollResults(voters: updatedVoters, totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes, canViewStats: results.canViewStats) } else { - updatedResults = TelegramMediaPollResults(voters: self.results.voters, totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes) + updatedResults = TelegramMediaPollResults(voters: self.results.voters, totalVoters: results.totalVoters, recentVoters: results.recentVoters, solution: results.solution ?? self.results.solution, hasUnseenVotes: results.hasUnseenVotes ?? self.results.hasUnseenVotes, canViewStats: results.canViewStats) } } else { updatedResults = results } - return TelegramMediaPoll(pollId: self.pollId, publicity: self.publicity, kind: self.kind, text: self.text, textEntities: self.textEntities, options: self.options, correctAnswers: self.correctAnswers, results: updatedResults, isClosed: self.isClosed, deadlineTimeout: self.deadlineTimeout, deadlineDate: self.deadlineDate, pollHash: self.pollHash, openAnswers: self.openAnswers, revotingDisabled: self.revotingDisabled, shuffleAnswers: self.shuffleAnswers, hideResultsUntilClose: self.hideResultsUntilClose, isCreator: self.isCreator, attachedMedia: self.attachedMedia) + return TelegramMediaPoll(pollId: self.pollId, publicity: self.publicity, kind: self.kind, text: self.text, textEntities: self.textEntities, options: self.options, correctAnswers: self.correctAnswers, results: updatedResults, isClosed: self.isClosed, deadlineTimeout: self.deadlineTimeout, deadlineDate: self.deadlineDate, pollHash: self.pollHash, openAnswers: self.openAnswers, revotingDisabled: self.revotingDisabled, shuffleAnswers: self.shuffleAnswers, hideResultsUntilClose: self.hideResultsUntilClose, isCreator: self.isCreator, attachedMedia: self.attachedMedia, restrictToSubscribers: self.restrictToSubscribers, countries: self.countries) } public func withoutUnreadResults() -> TelegramMediaPoll { - let updatedResults = TelegramMediaPollResults(voters: self.results.voters, totalVoters: self.results.totalVoters, recentVoters: self.results.recentVoters, solution: self.results.solution, hasUnseenVotes: false) - return TelegramMediaPoll(pollId: self.pollId, publicity: self.publicity, kind: self.kind, text: self.text, textEntities: self.textEntities, options: self.options, correctAnswers: self.correctAnswers, results: updatedResults, isClosed: self.isClosed, deadlineTimeout: self.deadlineTimeout, deadlineDate: self.deadlineDate, pollHash: self.pollHash, openAnswers: self.openAnswers, revotingDisabled: self.revotingDisabled, shuffleAnswers: self.shuffleAnswers, hideResultsUntilClose: self.hideResultsUntilClose, isCreator: self.isCreator, attachedMedia: self.attachedMedia) + let updatedResults = TelegramMediaPollResults(voters: self.results.voters, totalVoters: self.results.totalVoters, recentVoters: self.results.recentVoters, solution: self.results.solution, hasUnseenVotes: false, canViewStats: self.results.canViewStats) + return TelegramMediaPoll(pollId: self.pollId, publicity: self.publicity, kind: self.kind, text: self.text, textEntities: self.textEntities, options: self.options, correctAnswers: self.correctAnswers, results: updatedResults, isClosed: self.isClosed, deadlineTimeout: self.deadlineTimeout, deadlineDate: self.deadlineDate, pollHash: self.pollHash, openAnswers: self.openAnswers, revotingDisabled: self.revotingDisabled, shuffleAnswers: self.shuffleAnswers, hideResultsUntilClose: self.hideResultsUntilClose, isCreator: self.isCreator, attachedMedia: self.attachedMedia, restrictToSubscribers: self.restrictToSubscribers, countries: self.countries) } } diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift index fc9335f722..355be9c09f 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Polls.swift @@ -58,7 +58,7 @@ func _internal_requestMessageSelectPollOption(account: Account, messageId: Messa if let poll = poll { switch poll { case let .poll(pollData): - let (flags, question, answers, closePeriod, closeDate, pollHash) = (pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash) + let (flags, question, answers, closePeriod, closeDate, pollHash, countries) = (pollData.flags, pollData.question, pollData.answers, pollData.closePeriod, pollData.closeDate, pollData.hash, pollData.countriesIso2) let publicity: TelegramMediaPollPublicity if (flags & (1 << 1)) != 0 { publicity = .public @@ -75,6 +75,7 @@ func _internal_requestMessageSelectPollOption(account: Account, messageId: Messa let revotingDisabled = (flags & (1 << 7)) != 0 let shuffleAnswers = (flags & (1 << 8)) != 0 let hideResultsUntilClose = (flags & (1 << 9)) != 0 + let restrictToSubscribers = (flags & (1 << 11)) != 0 let questionText: String let questionEntities: [MessageTextEntity] switch question { @@ -83,7 +84,7 @@ func _internal_requestMessageSelectPollOption(account: Account, messageId: Messa questionText = text questionEntities = messageTextEntitiesFromApiEntities(entities) } - resultPoll = TelegramMediaPoll(pollId: pollId, publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: TelegramMediaPollResults(apiResults: results), isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, attachedMedia: resultPoll?.attachedMedia) + resultPoll = TelegramMediaPoll(pollId: pollId, publicity: publicity, kind: kind, text: questionText, textEntities: questionEntities, options: answers.map(TelegramMediaPollOption.init(apiOption:)), correctAnswers: nil, results: TelegramMediaPollResults(apiResults: results), isClosed: (flags & (1 << 0)) != 0, deadlineTimeout: closePeriod, deadlineDate: closeDate, pollHash: pollHash, openAnswers: openAnswers, revotingDisabled: revotingDisabled, shuffleAnswers: shuffleAnswers, hideResultsUntilClose: hideResultsUntilClose, attachedMedia: resultPoll?.attachedMedia, restrictToSubscribers: restrictToSubscribers, countries: countries ?? []) } } @@ -217,10 +218,17 @@ func _internal_requestClosePoll(postbox: Postbox, network: Network, stateManager pollFlags |= 1 << 1 } var pollMediaFlags: Int32 = 0 - var correctAnswers: [Buffer]? + var correctAnswersIndices: [Int32]? if let correctAnswersValue = poll.correctAnswers { pollMediaFlags |= 1 << 0 - correctAnswers = correctAnswersValue.map { Buffer(data: $0) } + + var indices: [Int32] = [] + for i in 0 ..< poll.options.count { + if correctAnswersValue.contains(where: { poll.options[i].opaqueIdentifier == $0 }) { + indices.append(Int32(i)) + } + } + correctAnswersIndices = indices } pollFlags |= 1 << 0 @@ -228,10 +236,27 @@ func _internal_requestClosePoll(postbox: Postbox, network: Network, stateManager if poll.deadlineTimeout != nil { pollFlags |= 1 << 4 } - if poll.openAnswers { pollFlags |= 1 << 6 } - if poll.revotingDisabled { pollFlags |= 1 << 7 } - if poll.shuffleAnswers { pollFlags |= 1 << 8 } - if poll.hideResultsUntilClose { pollFlags |= 1 << 9 } + if poll.deadlineDate != nil { + pollFlags |= 1 << 5 + } + if poll.openAnswers { + pollFlags |= 1 << 6 + } + if poll.revotingDisabled { + pollFlags |= 1 << 7 + } + if poll.shuffleAnswers { + pollFlags |= 1 << 8 + } + if poll.hideResultsUntilClose { + pollFlags |= 1 << 9 + } + if poll.restrictToSubscribers { + pollFlags |= 1 << 11 + } + if !poll.countries.isEmpty { + pollFlags |= 1 << 12 + } var mappedSolution: String? var mappedSolutionEntities: [Api.MessageEntity]? @@ -240,12 +265,8 @@ func _internal_requestClosePoll(postbox: Postbox, network: Network, stateManager mappedSolutionEntities = apiTextAttributeEntities(TextEntitiesMessageAttribute(entities: solution.entities), associatedPeers: SimpleDictionary()) pollMediaFlags |= 1 << 1 } - - //TODO:fix - let _ = correctAnswers - let correctAnswerss: [Int32] = [] - return network.request(Api.functions.messages.editMessage(flags: flags, peer: inputPeer, id: messageId.id, message: nil, media: .inputMediaPoll(.init(flags: pollMediaFlags, poll: .poll(.init(id: poll.pollId.id, flags: pollFlags, question: .textWithEntities(.init(text: poll.text, entities: apiEntitiesFromMessageTextEntities(poll.textEntities, associatedPeers: SimpleDictionary()))), answers: poll.options.map({ $0.apiOption }), closePeriod: poll.deadlineTimeout, closeDate: nil, hash: 0)), correctAnswers: correctAnswerss, attachedMedia: nil, solution: mappedSolution, solutionEntities: mappedSolutionEntities, solutionMedia: nil)), replyMarkup: nil, entities: nil, scheduleDate: nil, scheduleRepeatPeriod: nil, quickReplyShortcutId: nil)) + return network.request(Api.functions.messages.editMessage(flags: flags, peer: inputPeer, id: messageId.id, message: nil, media: .inputMediaPoll(.init(flags: pollMediaFlags, poll: .poll(.init(id: poll.pollId.id, flags: pollFlags, question: .textWithEntities(.init(text: poll.text, entities: apiEntitiesFromMessageTextEntities(poll.textEntities, associatedPeers: SimpleDictionary()))), answers: poll.options.map({ $0.apiOption }), closePeriod: poll.deadlineTimeout, closeDate: nil, countriesIso2: poll.countries, hash: 0)), correctAnswers: correctAnswersIndices, attachedMedia: nil, solution: mappedSolution, solutionEntities: mappedSolutionEntities, solutionMedia: nil)), replyMarkup: nil, entities: nil, scheduleDate: nil, scheduleRepeatPeriod: nil, quickReplyShortcutId: nil)) |> map(Optional.init) |> `catch` { _ -> Signal in return .single(nil) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Translate.swift b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Translate.swift index 42cd3a48d1..5e528de85c 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Messages/Translate.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Messages/Translate.swift @@ -85,7 +85,7 @@ func _internal_composeMessageWithAI(network: Network, text: String, entities: [M let apiText: Api.TextWithEntities = .textWithEntities(.init(text: text, entities: apiEntitiesFromMessageTextEntities(entities, associatedPeers: SimpleDictionary()))) - return network.request(Api.functions.messages.composeMessageWithAI(flags: flags, text: apiText, translateToLang: translateToLang, changeTone: changeTone)) + return network.request(Api.functions.messages.composeMessageWithAI(flags: flags, text: apiText, translateToLang: translateToLang, tone: changeTone.flatMap { .inputAiComposeToneDefault(.init(tone: $0)) })) |> mapError { error -> TranslationError in if error.errorDescription.hasPrefix("FLOOD_WAIT") { return .limitExceeded @@ -511,7 +511,7 @@ func _internal_composeAIMessage(account: Account, text: TextWithEntities, mode: let inputText: Api.TextWithEntities = .textWithEntities(Api.TextWithEntities.Cons_textWithEntities(text: text.text, entities: apiEntitiesFromMessageTextEntities(text.entities, associatedPeers: SimpleDictionary()))) - return account.network.request(Api.functions.messages.composeMessageWithAI(flags: flags, text: inputText, translateToLang: translateToLang, changeTone: changeTone)) + return account.network.request(Api.functions.messages.composeMessageWithAI(flags: flags, text: inputText, translateToLang: translateToLang, tone: changeTone.flatMap { .inputAiComposeToneDefault(.init(tone: $0)) })) |> `catch` { error -> Signal in if error.errorDescription == "AICOMPOSE_FLOOD_PREMIUM" { return .fail(.nonPremiumFlood) diff --git a/submodules/TelegramCore/Sources/TelegramEngine/Peers/SavedMusic.swift b/submodules/TelegramCore/Sources/TelegramEngine/Peers/SavedMusic.swift index c1d6b785d7..0bededb960 100644 --- a/submodules/TelegramCore/Sources/TelegramEngine/Peers/SavedMusic.swift +++ b/submodules/TelegramCore/Sources/TelegramEngine/Peers/SavedMusic.swift @@ -8,7 +8,7 @@ public enum AddSavedMusicError { case generic } -func revalidatedMusic(account: Account, file: FileMediaReference, signal: @escaping (CloudDocumentMediaResource) -> Signal) -> Signal { +public func revalidatedMusic(account: Account, file: FileMediaReference, signal: @escaping (CloudDocumentMediaResource) -> Signal) -> Signal { guard let resource = file.media.resource as? CloudDocumentMediaResource else { return .fail(MTRpcError(errorCode: 500, errorDescription: "Internal")) } diff --git a/submodules/TelegramCore/Sources/Utils/MessageUtils.swift b/submodules/TelegramCore/Sources/Utils/MessageUtils.swift index 393234c0a0..c072041592 100644 --- a/submodules/TelegramCore/Sources/Utils/MessageUtils.swift +++ b/submodules/TelegramCore/Sources/Utils/MessageUtils.swift @@ -500,7 +500,17 @@ public extension Message { } return nil } + + var guestChatAttribute: GuestChatMessageAttribute? { + for attribute in self.attributes { + if let attribute = attribute as? GuestChatMessageAttribute { + return attribute + } + } + return nil + } } + public extension Message { var reactionsAttribute: ReactionsMessageAttribute? { for attribute in self.attributes { diff --git a/submodules/TelegramUI/BUILD b/submodules/TelegramUI/BUILD index 96e730748f..764a33bcce 100644 --- a/submodules/TelegramUI/BUILD +++ b/submodules/TelegramUI/BUILD @@ -522,6 +522,7 @@ swift_library( "//submodules/TelegramUI/Components/ChatParticipantRightsScreen", "//submodules/TelegramUI/Components/PeerInfo/PeerCopyProtectionInfoScreen", "//submodules/TelegramUI/Components/Chat/ChatRankInfoScreen", + "//submodules/TelegramUI/Components/PollStatsScreen", "//submodules/TelegramUI/Components/RankChatPreviewItem", "//submodules/TelegramUI/Components/TextProcessingScreen", "//submodules/TelegramUI/Components/CreateBotScreen", diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift index 719b98bef7..c9c88568c6 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageBubbleItemNode/Sources/ChatMessageBubbleItemNode.swift @@ -1580,6 +1580,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI let fontSize = floor(item.presentationData.fontSize.baseDisplaySize * 14.0 / 17.0) let nameFont = Font.semibold(fontSize) + let regularFont = Font.regular(fontSize) let inlineBotPrefixFont = Font.regular(fontSize - 1.0) let boostBadgeFont = Font.regular(fontSize - 1.0) @@ -1659,6 +1660,10 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI ignoreForward = true effectiveAuthor = author displayAuthorInfo = !mergedTop.merged && incoming + } else if let _ = item.content.firstMessage.guestChatAttribute { + effectiveAuthor = firstMessage.author + displayAuthorInfo = !mergedTop.merged && incoming + hasAvatar = true } else { effectiveAuthor = firstMessage.author @@ -2009,6 +2014,7 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI break } + var guestChatViaFromNameString: String? var inlineBotNameString: String? var replyMessage: Message? var replyForward: QuotedReplyMessageAttribute? @@ -2019,7 +2025,11 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI var authorNameColor: UIColor? for attribute in firstMessage.attributes { - if let attribute = attribute as? InlineBotMessageAttribute { + if let attribute = attribute as? GuestChatMessageAttribute { + if let peer = firstMessage.peers[attribute.peerId] { + guestChatViaFromNameString = EnginePeer(peer).compactDisplayTitle + } + } else if let attribute = attribute as? InlineBotMessageAttribute { if let peerId = attribute.peerId, let bot = firstMessage.peers[peerId] as? TelegramUser { inlineBotNameString = bot.addressName } else { @@ -2398,6 +2408,9 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI if authorNameString != nil { displayHeader = true } + if guestChatViaFromNameString != nil { + displayHeader = true + } if inlineBotNameString != nil { displayHeader = true } @@ -2647,6 +2660,13 @@ public class ChatMessageBubbleItemNode: ChatMessageItemView, ChatMessagePreviewI mutableString.append(botString) attributedString = mutableString viaSuffix = botString + } else if let authorNameString = authorNameString, let authorNameColor = authorNameColor, let guestChatViaFromNameString = guestChatViaFromNameString { + let mutableString = NSMutableAttributedString(string: "\(authorNameString) ", attributes: [NSAttributedString.Key.font: nameFont, NSAttributedString.Key.foregroundColor: authorNameColor]) + let bodyAttributes = MarkdownAttributeSet(font: regularFont, textColor: authorNameColor) + let botString = addAttributesToStringWithRanges(item.presentationData.strings.Conversation_MessageGuestChatForUser(guestChatViaFromNameString)._tuple, body: bodyAttributes, argumentAttributes: [:]) + mutableString.append(botString) + attributedString = mutableString + viaSuffix = botString } else if let authorNameString = authorNameString, let authorNameColor = authorNameColor { attributedString = NSAttributedString(string: authorNameString, font: nameFont, textColor: authorNameColor) } else if let inlineBotNameString = inlineBotNameString { diff --git a/submodules/TelegramUI/Components/Chat/ChatMessageItemImpl/Sources/ChatMessageItemImpl.swift b/submodules/TelegramUI/Components/Chat/ChatMessageItemImpl/Sources/ChatMessageItemImpl.swift index 5907b5360f..9bb1a15fdd 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessageItemImpl/Sources/ChatMessageItemImpl.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessageItemImpl/Sources/ChatMessageItemImpl.swift @@ -327,6 +327,10 @@ public final class ChatMessageItemImpl: ChatMessageItem, CustomStringConvertible } displayAuthorInfo = incoming && peerId.isGroupOrChannel && effectiveAuthor != nil + if let _ = content.firstMessage.guestChatAttribute { + displayAuthorInfo = true + } + if let chatPeer = content.firstMessage.peers[content.firstMessage.id.peerId], chatPeer.isForumOrMonoForum { if case .replyThread = chatLocation { if chatPeer.isMonoForum && chatLocation.threadId != context.account.peerId.toInt64() { diff --git a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/BUILD b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/BUILD index 491db8f060..3e5dfa3db3 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/BUILD +++ b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/BUILD @@ -36,6 +36,8 @@ swift_library( "//submodules/TelegramUI/Components/ChatControllerInteraction", "//submodules/RadialStatusNode", "//submodules/TelegramUI/Components/ComposePollScreen", + "//submodules/UndoUI", + "//submodules/TelegramStringFormatting", ], visibility = [ "//visibility:public", diff --git a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift index 50a72cb79d..61ffe670c7 100644 --- a/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift +++ b/submodules/TelegramUI/Components/Chat/ChatMessagePollBubbleContentNode/Sources/ChatMessagePollBubbleContentNode.swift @@ -29,6 +29,8 @@ import ComponentFlow import TextFieldComponent import PlainButtonComponent import LottieComponent +import UndoUI +import TelegramStringFormatting private final class ChatMessagePollOptionRadioNodeParameters: NSObject { let timestamp: Double @@ -2412,21 +2414,21 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { return { item, layoutConstants, _, _, _, _ in let contentProperties = ChatMessageBubbleContentProperties(hidesSimpleAuthorHeader: false, headerSpacing: 0.0, hidesBackground: .never, forceFullCorners: false, forceAlignment: .none) - + return (contentProperties, nil, CGFloat.greatestFiniteMagnitude, { constrainedSize, position in let message = item.message - + let incoming = item.message.effectivelyIncoming(item.context.account.peerId) var isBotChat: Bool = false if let peer = item.message.peers[item.message.id.peerId] as? TelegramUser, peer.botInfo != nil { isBotChat = true } - + let additionalTextRightInset: CGFloat = 24.0 - + let horizontalInset = layoutConstants.text.bubbleInsets.left + layoutConstants.text.bubbleInsets.right let textConstrainedSize = CGSize(width: constrainedSize.width - horizontalInset - additionalTextRightInset, height: constrainedSize.height) - + var edited = false if item.attributes.updatingMedia != nil { edited = true @@ -2451,7 +2453,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { starsCount = attribute.stars.value } } - + let dateFormat: MessageTimestampStatusFormat if item.presentationData.isPreview { dateFormat = .full @@ -2459,7 +2461,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { dateFormat = .regular } let dateText = stringForMessageTimestampStatus(accountPeerId: item.context.account.peerId, message: item.message, dateTimeFormat: item.presentationData.dateTimeFormat, nameDisplayOrder: item.presentationData.nameDisplayOrder, strings: item.presentationData.strings, format: dateFormat, associatedData: item.associatedData) - + let statusType: ChatMessageDateAndStatusType? if case .customChatContents = item.associatedData.subject { statusType = nil @@ -2481,15 +2483,15 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { statusType = nil } } - + var statusSuggestedWidthAndContinue: (CGFloat, (CGFloat) -> (CGSize, (ListViewItemUpdateAnimation) -> Void))? - + if let statusType = statusType { var isReplyThread = false if case .replyThread = item.chatLocation { isReplyThread = true } - + statusSuggestedWidthAndContinue = statusLayout(ChatMessageDateAndStatusNode.Arguments( context: item.context, presentationData: item.presentationData, @@ -2516,7 +2518,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { animationRenderer: item.controllerInteraction.presentationContext.animationRenderer )) } - + var poll: TelegramMediaPoll? for media in item.message.media { if let media = media as? TelegramMediaPoll { @@ -2524,13 +2526,13 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { break } } - + let messageTheme = incoming ? item.presentationData.theme.theme.chat.message.incoming : item.presentationData.theme.theme.chat.message.outgoing - + var pollTitleText = poll?.text ?? "" var pollTitleEntities = poll?.textEntities ?? [] var pollOptions: [TranslationMessageAttribute.Additional] = [] - + var isTranslating = false if let poll, let translateToLanguage = item.associatedData.translateToLanguage, !poll.text.isEmpty && incoming { isTranslating = true @@ -2544,7 +2546,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { } } } - + let attributedText = stringWithAppliedEntities( pollTitleText, entities: pollTitleEntities, @@ -2559,12 +2561,12 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { blockQuoteFont: item.presentationData.messageBoldFont, message: message ) - + let textInsets = UIEdgeInsets(top: 2.0, left: 0.0, bottom: 5.0, right: 0.0) - + let (textLayout, textApply) = makeTextLayout(TextNodeLayoutArguments(attributedString: attributedText, backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: textInsets)) let typeText: String - + var avatarPeers: [Peer] = [] if let poll = poll { for peerId in poll.results.recentVoters { @@ -2573,7 +2575,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { } } } - + if let poll = poll, isPollEffectivelyClosed(message: message, poll: poll) { typeText = item.presentationData.strings.MessagePoll_LabelClosed } else if let poll = poll { @@ -2597,9 +2599,9 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { typeText = item.presentationData.strings.MessagePoll_LabelAnonymous } let (typeLayout, typeApply) = makeTypeLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: typeText, font: labelsFont, textColor: messageTheme.secondaryTextColor), backgroundColor: nil, maximumNumberOfLines: 0, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: UIEdgeInsets())) - + let votersString: String? - + if isBotChat { votersString = nil } else if let poll = poll, let totalVoters = poll.results.totalVoters { @@ -2631,7 +2633,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { } } } - + let viewResultsString: String if let poll, let totalVoters = poll.results.totalVoters { if case .public = poll.publicity { @@ -2655,18 +2657,18 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { let chevronImage = incoming ? PresentationResourcesChat.chatBubblePollChevronRightIncomingIcon(item.presentationData.theme.theme) : PresentationResourcesChat.chatBubblePollChevronRightOutgoingIcon(item.presentationData.theme.theme) viewResultsAttributedString.addAttribute(.attachment, value: chevronImage!, range: NSRange(range, in: viewResultsAttributedString.string)) } - + let (buttonSubmitInactiveTextLayout, buttonSubmitInactiveTextApply) = makeSubmitInactiveTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.presentationData.strings.MessagePoll_SubmitVote, font: Font.regular(17.0), textColor: messageTheme.accentControlDisabledColor), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: textInsets)) let (buttonSubmitActiveTextLayout, buttonSubmitActiveTextApply) = makeSubmitActiveTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.presentationData.strings.MessagePoll_SubmitVote, font: Font.regular(17.0), textColor: messageTheme.polls.bar), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: textInsets)) let (buttonSaveTextLayout, buttonSaveTextApply) = makeSaveTextLayout(TextNodeLayoutArguments(attributedString: NSAttributedString(string: item.presentationData.strings.Common_Save, font: Font.regular(17.0), textColor: messageTheme.polls.bar), backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: textInsets)) let (buttonViewResultsTextLayout, buttonViewResultsTextApply) = makeViewResultsTextLayout(TextNodeLayoutArguments(attributedString: viewResultsAttributedString, backgroundColor: nil, maximumNumberOfLines: 1, truncationType: .end, constrainedSize: textConstrainedSize, alignment: .natural, cutout: nil, insets: textInsets)) - + var textFrame = CGRect(origin: CGPoint(x: -textInsets.left, y: -textInsets.top), size: textLayout.size) var textFrameWithoutInsets = CGRect(origin: CGPoint(x: textFrame.origin.x + textInsets.left, y: textFrame.origin.y + textInsets.top), size: CGSize(width: textFrame.width - textInsets.left - textInsets.right, height: textFrame.height - textInsets.top - textInsets.bottom)) - + textFrame = textFrame.offsetBy(dx: layoutConstants.text.bubbleInsets.left, dy: layoutConstants.text.bubbleInsets.top) textFrameWithoutInsets = textFrameWithoutInsets.offsetBy(dx: layoutConstants.text.bubbleInsets.left, dy: layoutConstants.text.bubbleInsets.top) - + var boundingSize: CGSize = textFrameWithoutInsets.size boundingSize.width += additionalTextRightInset boundingSize.width = max(boundingSize.width, typeLayout.size.width) @@ -2674,27 +2676,32 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { boundingSize.width = max(boundingSize.width, buttonSubmitInactiveTextLayout.size.width + 4.0/* + (statusSize?.width ?? 0.0)*/) boundingSize.width = max(boundingSize.width, buttonSaveTextLayout.size.width + 4.0/* + (statusSize?.width ?? 0.0)*/) boundingSize.width = max(boundingSize.width, buttonViewResultsTextLayout.size.width + 4.0/* + (statusSize?.width ?? 0.0)*/) - + if let statusSuggestedWidthAndContinue = statusSuggestedWidthAndContinue { boundingSize.width = max(boundingSize.width, statusSuggestedWidthAndContinue.0) } - + boundingSize.width += layoutConstants.text.bubbleInsets.left + layoutConstants.text.bubbleInsets.right boundingSize.height += layoutConstants.text.bubbleInsets.top + layoutConstants.text.bubbleInsets.bottom - + let isClosed: Bool if let poll = poll { isClosed = isPollEffectivelyClosed(message: message, poll: poll) } else { isClosed = false } - + var pollOptionsFinalizeLayouts: [(hasResult: Bool, layout: (CGFloat) -> (CGSize, (Bool, Bool, Bool) -> ChatMessagePollOptionNode))] = [] var addOptionFinalizeLayout: ((CGFloat) -> (CGSize, (Bool, Bool) -> ChatMessagePollAddOptionNode))? var orderedPollOptions: [(Int, TelegramMediaPollOption)] = [] if let poll = poll { + var isRestricted = false + if !poll.countries.isEmpty, let accountCountry = item.associatedData.accountCountry, !poll.countries.contains(accountCountry) { + isRestricted = true + } + orderedPollOptions = resolvedOptionOrder(for: item) - + var optionVoterCount: [Int: Int32] = [:] var maxOptionVoterCount: Int32 = 0 var totalVoterCount: Int32 = 0 @@ -2714,12 +2721,11 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { } } totalVoterCount = totalVoters - if didVote || isClosed || isPreviewingResults { + if didVote || isClosed || isPreviewingResults || isRestricted { for i in 0 ..< poll.options.count { inner: for optionVoters in voters { if optionVoters.opaqueIdentifier == poll.options[i].opaqueIdentifier { optionVoterCount[i] = optionVoters.count - //TODO:correct maxOptionVoterCount = max(maxOptionVoterCount, optionVoters.count ?? 0) break inner } @@ -2727,16 +2733,16 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { } } } - + var optionVoterCounts: [Int] if totalVoterCount != 0 { optionVoterCounts = countNicePercent(votes: (0 ..< poll.options.count).map({ Int(optionVoterCount[$0] ?? 0) }), total: Int(totalVoterCount)) } else { optionVoterCounts = Array(repeating: 0, count: poll.options.count) } - + let hasAnyOptionMedia = orderedPollOptions.contains(where: { $0.1.media != nil }) - + for (i, option) in orderedPollOptions { let makeLayout: (_ context: AccountContext, _ presentationData: ChatPresentationData, _ presentationContext: ChatPresentationContext, _ message: Message, _ poll: TelegramMediaPoll, _ option: TelegramMediaPollOption, _ translation: TranslationMessageAttribute.Additional?, _ optionResult: ChatMessagePollOptionResult?, _ forceSelected: Bool?, _ hasAnyMedia: Bool, _ constrainedWidth: CGFloat) -> (minimumWidth: CGFloat, layout: ((CGFloat) -> (CGSize, (Bool, Bool, Bool) -> ChatMessagePollOptionNode))) if let previous = previousOptionNodeLayouts[option.opaqueIdentifier] { @@ -2755,13 +2761,13 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { if let count = optionVoterCount[i] { if maxOptionVoterCount != 0 && totalVoterCount != 0 { optionResult = ChatMessagePollOptionResult(normalized: CGFloat(count) / CGFloat(maxOptionVoterCount), percent: optionVoterCounts[i], count: count, recentVoterPeerIds: recentVoterPeerIds) - } else if isClosed { + } else if isClosed || isRestricted { optionResult = ChatMessagePollOptionResult(normalized: 0, percent: 0, count: 0, recentVoterPeerIds: recentVoterPeerIds) } - } else if isClosed { + } else if isClosed || isRestricted { optionResult = ChatMessagePollOptionResult(normalized: 0, percent: 0, count: 0, recentVoterPeerIds: recentVoterPeerIds) } - + var translation: TranslationMessageAttribute.Additional? if !pollOptions.isEmpty && i < pollOptions.count { translation = pollOptions[i] @@ -2771,12 +2777,12 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { if !votedFor.isEmpty && optionResult == nil { forceSelected = votedFor.contains(option.opaqueIdentifier) } - + let result = makeLayout(item.context, item.presentationData, item.controllerInteraction.presentationContext, item.message, poll, option, translation, optionResult, forceSelected, hasAnyOptionMedia, constrainedSize.width - layoutConstants.bubble.borderInset * 2.0) boundingSize.width = max(boundingSize.width, result.minimumWidth + layoutConstants.bubble.borderInset * 2.0) pollOptionsFinalizeLayouts.append((optionResult != nil, result.1)) } - + var maxPollOptions: Int = 20 if let data = item.context.currentAppConfiguration.with({ $0 }).data, let value = data["poll_answers_max"] as? Double { maxPollOptions = Int(value) @@ -2789,25 +2795,16 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { addOptionFinalizeLayout = addOptionResult.layout } } - - boundingSize.width = max(boundingSize.width, min(280.0, constrainedSize.width)) - - var canVote = false - if (item.message.id.namespace == Namespaces.Message.Cloud || Namespaces.Message.allNonRegular.contains(item.message.id.namespace)), let poll = poll, poll.pollId.namespace == Namespaces.Media.CloudPoll, !isClosed { - if !hasVoted { - canVote = true - } - } - let _ = canVote - + boundingSize.width = max(boundingSize.width, min(280.0, constrainedSize.width)) + return (boundingSize.width, { boundingWidth in var resultSize = CGSize(width: max(boundingSize.width, boundingWidth), height: boundingSize.height) - + let titleTypeSpacing: CGFloat = -4.0 let typeOptionsSpacing: CGFloat = 3.0 resultSize.height += titleTypeSpacing + typeLayout.size.height + typeOptionsSpacing - + var optionNodesSizesAndApply: [(CGSize, (Bool, Bool, Bool) -> ChatMessagePollOptionNode)] = [] for finalizeLayout in pollOptionsFinalizeLayouts { let result = finalizeLayout.layout(boundingWidth - layoutConstants.bubble.borderInset * 2.0) @@ -2826,7 +2823,7 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { resultSize.height += result.0.height addOptionSizeAndApply = result } - + let optionsVotersSpacing: CGFloat = 11.0 let optionsButtonSpacing: CGFloat = 9.0 let votersBottomSpacing: CGFloat = 11.0 @@ -2839,403 +2836,446 @@ public class ChatMessagePollBubbleContentNode: ChatMessageBubbleContentNode { if let poll, case .poll = poll.kind, !poll.isClosed, let _ = poll.deadlineTimeout { resultSize.height += 6.0 } - + var statusSizeAndApply: (CGSize, (ListViewItemUpdateAnimation) -> Void)? if let statusSuggestedWidthAndContinue = statusSuggestedWidthAndContinue { statusSizeAndApply = statusSuggestedWidthAndContinue.1(boundingWidth) } - + if let statusSizeAndApply = statusSizeAndApply { resultSize.height += statusSizeAndApply.0.height - 6.0 } - + let buttonSubmitInactiveTextFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonSubmitInactiveTextLayout.size.width) / 2.0), y: optionsButtonSpacing), size: buttonSubmitInactiveTextLayout.size) let buttonSubmitActiveTextFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonSubmitActiveTextLayout.size.width) / 2.0), y: optionsButtonSpacing), size: buttonSubmitActiveTextLayout.size) let buttonSaveTextFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonSaveTextLayout.size.width) / 2.0), y: optionsButtonSpacing), size: buttonSaveTextLayout.size) let buttonViewResultsTextFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonViewResultsTextLayout.size.width) / 2.0), y: optionsButtonSpacing), size: buttonViewResultsTextLayout.size) - + return (resultSize, { [weak self] animation, synchronousLoad, _ in - if let strongSelf = self { - strongSelf.item = item - strongSelf.poll = poll - - let cachedLayout = strongSelf.textNode.textNode.cachedLayout - if case .System = animation { - if let cachedLayout = cachedLayout { - if !cachedLayout.areLinesEqual(to: textLayout) { - if let textContents = strongSelf.textNode.textNode.contents { - let fadeNode = ASDisplayNode() - fadeNode.displaysAsynchronously = false - fadeNode.contents = textContents - fadeNode.frame = strongSelf.textNode.textNode.frame - fadeNode.isLayerBacked = true - strongSelf.addSubnode(fadeNode) - fadeNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak fadeNode] _ in - fadeNode?.removeFromSupernode() - }) - strongSelf.textNode.textNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15) + if let strongSelf = self { + strongSelf.item = item + strongSelf.poll = poll + + let cachedLayout = strongSelf.textNode.textNode.cachedLayout + if case .System = animation { + if let cachedLayout = cachedLayout { + if !cachedLayout.areLinesEqual(to: textLayout) { + if let textContents = strongSelf.textNode.textNode.contents { + let fadeNode = ASDisplayNode() + fadeNode.displaysAsynchronously = false + fadeNode.contents = textContents + fadeNode.frame = strongSelf.textNode.textNode.frame + fadeNode.isLayerBacked = true + strongSelf.addSubnode(fadeNode) + fadeNode.layer.animateAlpha(from: 1.0, to: 0.0, duration: 0.2, removeOnCompletion: false, completion: { [weak fadeNode] _ in + fadeNode?.removeFromSupernode() + }) + strongSelf.textNode.textNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.15) + } } } } - } - - let _ = textApply(TextNodeWithEntities.Arguments( - context: item.context, - cache: item.context.animationCache, - renderer: item.context.animationRenderer, - placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, - attemptSynchronous: synchronousLoad) - ) - let _ = typeApply() - - var verticalOffset = textFrame.maxY + titleTypeSpacing + typeLayout.size.height + typeOptionsSpacing - var updatedOptionNodes: [ChatMessagePollOptionNode] = [] - for i in 0 ..< optionNodesSizesAndApply.count { - let (size, apply) = optionNodesSizesAndApply[i] - var isRequesting = false - if i < orderedPollOptions.count { - if let inProgressOpaqueIds = item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] { - isRequesting = inProgressOpaqueIds.contains(orderedPollOptions[i].1.opaqueIdentifier) + + let _ = textApply(TextNodeWithEntities.Arguments( + context: item.context, + cache: item.context.animationCache, + renderer: item.context.animationRenderer, + placeholderColor: incoming ? item.presentationData.theme.theme.chat.message.incoming.mediaPlaceholderColor : item.presentationData.theme.theme.chat.message.outgoing.mediaPlaceholderColor, + attemptSynchronous: synchronousLoad) + ) + let _ = typeApply() + + var verticalOffset = textFrame.maxY + titleTypeSpacing + typeLayout.size.height + typeOptionsSpacing + var updatedOptionNodes: [ChatMessagePollOptionNode] = [] + for i in 0 ..< optionNodesSizesAndApply.count { + let (size, apply) = optionNodesSizesAndApply[i] + var isRequesting = false + if i < orderedPollOptions.count { + if let inProgressOpaqueIds = item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] { + isRequesting = inProgressOpaqueIds.contains(orderedPollOptions[i].1.opaqueIdentifier) + } + } + let optionNode = apply(animation.isAnimated, isRequesting, synchronousLoad) + let optionNodeFrame = CGRect(origin: CGPoint(x: layoutConstants.bubble.borderInset, y: verticalOffset), size: size) + if optionNode.supernode !== strongSelf { + strongSelf.addSubnode(optionNode) + let option = optionNode.option + + optionNode.pressed = { [weak self] in + guard let self, + let item = self.item, + let option else { + return + } + item.controllerInteraction.requestSelectMessagePollOptions(item.message.id, [option.opaqueIdentifier]) + } + optionNode.resultPressed = { [weak self] in + guard let self, + let item = self.item, + let option else { + return + } + if let poll { + if case .public = poll.publicity { + item.controllerInteraction.openMessagePollResults(item.message.id, option.opaqueIdentifier) + } else { + if "".isEmpty { + let locale = localeWithStrings(item.presentationData.strings) + let countryNames = poll.countries.map { id in + if let countryName = locale.localizedString(forRegionCode: id) { + return countryName + } else { + return id + } + } + var countries: String = "" + if countryNames.count == 1, let country = countryNames.first { + countries = "**\(country)**" + } else { + for i in 0 ..< countryNames.count { + countries.append("**\(countryNames[i])**") + if i == countryNames.count - 2 { + countries.append(item.presentationData.strings.Chat_Poll_Restriction_Country_CountriesLastDelimiter) + } else if i < countryNames.count - 2 { + countries.append(item.presentationData.strings.Chat_Poll_Restriction_Country_CountriesDelimiter) + } + } + } + //TODO:localize + let controller = UndoOverlayController( + presentationData: item.context.sharedContext.currentPresentationData.with { $0 }, + content: .banned(text: "Only users from \(countries) can vote."), + elevatedLayout: true, + position: .bottom, + action: { _ in return true } + ) + item.controllerInteraction.presentController(controller, nil) + } + } + } + } + optionNode.selectionUpdated = { [weak self] in + guard let self else { + return + } + self.updateSelection() + } + optionNode.longTapped = { [weak self] in + guard let self, + let item = self.item, + let option else { + return + } + item.controllerInteraction.pollOptionLongTap(option.opaqueIdentifier, ChatControllerInteraction.LongTapParams(message: item.message, contentNode: optionNode.contextSourceNode, messageNode: strongSelf, progress: nil)) + } + optionNode.frame = optionNodeFrame + } else { + animation.animator.updateFrame(layer: optionNode.layer, frame: optionNodeFrame, completion: nil) } - } - let optionNode = apply(animation.isAnimated, isRequesting, synchronousLoad) - let optionNodeFrame = CGRect(origin: CGPoint(x: layoutConstants.bubble.borderInset, y: verticalOffset), size: size) - if optionNode.supernode !== strongSelf { - strongSelf.addSubnode(optionNode) - let option = optionNode.option - optionNode.pressed = { [weak self] in - guard let self, let item = self.item, let option else { - return - } - item.controllerInteraction.requestSelectMessagePollOptions(item.message.id, [option.opaqueIdentifier]) + if optionNode.currentResult != nil { + verticalOffset += size.height - 7.0 + } else { + verticalOffset += size.height } - optionNode.resultPressed = { [weak self] in - guard let self, let item = self.item, let option else { - return - } - if let poll, case .public = poll.publicity { - item.controllerInteraction.openMessagePollResults(item.message.id, option.opaqueIdentifier) - } + updatedOptionNodes.append(optionNode) + optionNode.isUserInteractionEnabled = !strongSelf.newOptionIsFocused && item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] == nil + optionNode.alpha = strongSelf.newOptionIsFocused ? 0.5 : 1.0 + + if i > 0 { + optionNode.previousOptionNode = updatedOptionNodes[i - 1] + } else { + optionNode.previousOptionNode = nil } - optionNode.selectionUpdated = { [weak self] in + } + for optionNode in strongSelf.optionNodes { + if !updatedOptionNodes.contains(where: { $0 === optionNode }) { + optionNode.removeFromSupernode() + } + } + strongSelf.optionNodes = updatedOptionNodes + strongSelf.updatePollOptionsInteraction(animated: animation.isAnimated) + + if let (size, apply) = addOptionSizeAndApply { + let isRequesting = item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] != nil + let addOptionNode = apply(animation.isAnimated, isRequesting) + let addOptionNodeFrame = CGRect(origin: CGPoint(x: layoutConstants.bubble.borderInset, y: verticalOffset), size: size) + if addOptionNode.supernode !== strongSelf { + strongSelf.addSubnode(addOptionNode) + } else { + animation.animator.updateFrame(layer: addOptionNode.layer, frame: addOptionNodeFrame, completion: nil) + } + addOptionNode.frame = addOptionNodeFrame + addOptionNode.isUserInteractionEnabled = !isRequesting + addOptionNode.textUpdated = { [weak self] text in + self?.updateNewOptionText(text) + } + addOptionNode.heightUpdated = { [weak self] in + self?.requestNewOptionLayoutUpdate() + } + addOptionNode.attachPressed = { [weak self] in + self?.openNewOptionAttachment() + } + addOptionNode.mediaPressed = { [weak self] in + self?.openNewOptionAttachment() + } + addOptionNode.modeSelectorPressed = { [weak self] in + self?.toggleNewOptionInputMode() + } + addOptionNode.requestSave = { [weak self] in + self?.buttonPressed() + } + addOptionNode.focusUpdated = { [weak self] focused in guard let self else { return } - self.updateSelection() + self.updatePollAddOptionFocused(focused) } - optionNode.longTapped = { [weak self] in - guard let self, let item = self.item, let option else { - return - } - item.controllerInteraction.pollOptionLongTap(option.opaqueIdentifier, ChatControllerInteraction.LongTapParams(message: item.message, contentNode: optionNode.contextSourceNode, messageNode: strongSelf, progress: nil)) - } - optionNode.frame = optionNodeFrame - } else { - animation.animator.updateFrame(layer: optionNode.layer, frame: optionNodeFrame, completion: nil) - } - - if optionNode.currentResult != nil { - verticalOffset += size.height - 7.0 - } else { + strongSelf.addOptionNode = addOptionNode verticalOffset += size.height + } else if let addOptionNode = strongSelf.addOptionNode { + strongSelf.updatePollAddOptionFocused(false) + strongSelf.addOptionNode = nil + addOptionNode.removeFromSupernode() } - updatedOptionNodes.append(optionNode) - optionNode.isUserInteractionEnabled = !strongSelf.newOptionIsFocused && item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] == nil - optionNode.alpha = strongSelf.newOptionIsFocused ? 0.5 : 1.0 - - if i > 0 { - optionNode.previousOptionNode = updatedOptionNodes[i - 1] + + if let poll = poll, let pendingNewOptionSubmissionText, let pendingNewOptionOptionCount = strongSelf.pendingNewOptionOptionCount, poll.options.count > pendingNewOptionOptionCount, poll.options.contains(where: { $0.text == pendingNewOptionSubmissionText }) { + strongSelf.clearNewOptionInput() + } + + if textLayout.hasRTL { + strongSelf.textNode.textNode.frame = CGRect(origin: CGPoint(x: resultSize.width - textFrame.size.width - textInsets.left - layoutConstants.text.bubbleInsets.right - additionalTextRightInset, y: textFrame.origin.y), size: textFrame.size) } else { - optionNode.previousOptionNode = nil + strongSelf.textNode.textNode.frame = textFrame } - } - for optionNode in strongSelf.optionNodes { - if !updatedOptionNodes.contains(where: { $0 === optionNode }) { - optionNode.removeFromSupernode() - } - } - strongSelf.optionNodes = updatedOptionNodes - strongSelf.updatePollOptionsInteraction(animated: animation.isAnimated) - - if let (size, apply) = addOptionSizeAndApply { - let isRequesting = item.controllerInteraction.pollActionState.pollMessageIdsInProgress[item.message.id] != nil - let addOptionNode = apply(animation.isAnimated, isRequesting) - let addOptionNodeFrame = CGRect(origin: CGPoint(x: layoutConstants.bubble.borderInset, y: verticalOffset), size: size) - if addOptionNode.supernode !== strongSelf { - strongSelf.addSubnode(addOptionNode) - } else { - animation.animator.updateFrame(layer: addOptionNode.layer, frame: addOptionNodeFrame, completion: nil) - } - addOptionNode.frame = addOptionNodeFrame - addOptionNode.isUserInteractionEnabled = !isRequesting - addOptionNode.textUpdated = { [weak self] text in - self?.updateNewOptionText(text) - } - addOptionNode.heightUpdated = { [weak self] in - self?.requestNewOptionLayoutUpdate() - } - addOptionNode.attachPressed = { [weak self] in - self?.openNewOptionAttachment() - } - addOptionNode.mediaPressed = { [weak self] in - self?.openNewOptionAttachment() - } - addOptionNode.modeSelectorPressed = { [weak self] in - self?.toggleNewOptionInputMode() - } - addOptionNode.requestSave = { [weak self] in - self?.buttonPressed() - } - addOptionNode.focusUpdated = { [weak self] focused in - guard let self else { - return - } - self.updatePollAddOptionFocused(focused) - } - strongSelf.addOptionNode = addOptionNode - verticalOffset += size.height - } else if let addOptionNode = strongSelf.addOptionNode { - strongSelf.updatePollAddOptionFocused(false) - strongSelf.addOptionNode = nil - addOptionNode.removeFromSupernode() - } - - if let poll = poll, let pendingNewOptionSubmissionText, let pendingNewOptionOptionCount = strongSelf.pendingNewOptionOptionCount, poll.options.count > pendingNewOptionOptionCount, poll.options.contains(where: { $0.text == pendingNewOptionSubmissionText }) { - strongSelf.clearNewOptionInput() - } - - if textLayout.hasRTL { - strongSelf.textNode.textNode.frame = CGRect(origin: CGPoint(x: resultSize.width - textFrame.size.width - textInsets.left - layoutConstants.text.bubbleInsets.right - additionalTextRightInset, y: textFrame.origin.y), size: textFrame.size) - } else { - strongSelf.textNode.textNode.frame = textFrame - } - let typeFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: textFrame.maxY + titleTypeSpacing), size: typeLayout.size) - animation.animator.updateFrame(layer: strongSelf.typeNode.layer, frame: typeFrame, completion: nil) - - let deadlineTimeout = poll?.deadlineTimeout - var displayDeadlineTimer = true - var hasSelected = false - - if let poll { - if let voters = poll.results.voters { - for voter in voters { - if voter.selected { - if case .quiz = poll.kind { - displayDeadlineTimer = false - } else { - displayDeadlineTimer = !poll.isClosed + let typeFrame = CGRect(origin: CGPoint(x: textFrame.minX, y: textFrame.maxY + titleTypeSpacing), size: typeLayout.size) + animation.animator.updateFrame(layer: strongSelf.typeNode.layer, frame: typeFrame, completion: nil) + + let deadlineTimeout = poll?.deadlineTimeout + var displayDeadlineTimer = true + var hasSelected = false + + if let poll { + if let voters = poll.results.voters { + for voter in voters { + if voter.selected { + if case .quiz = poll.kind { + displayDeadlineTimer = false + } else { + displayDeadlineTimer = !poll.isClosed + } + hasSelected = true + break } - hasSelected = true - break } } } - } - - var endDate: Int32? - if let deadlineTimeout, message.id.namespace == Namespaces.Message.Cloud { - let startDate: Int32 - if let forwardInfo = message.forwardInfo { - startDate = forwardInfo.date - } else { - startDate = message.timestamp + + var endDate: Int32? + if let deadlineTimeout, + message.id.namespace == Namespaces.Message.Cloud { + let startDate: Int32 + if let forwardInfo = message.forwardInfo { + startDate = forwardInfo.date + } else { + startDate = message.timestamp + } + endDate = startDate + deadlineTimeout } - endDate = startDate + deadlineTimeout - } - - if let poll, case .quiz = poll.kind, let deadlineTimeout, !isClosed { - let timerNode: PollBubbleTimerNode - if let current = strongSelf.timerNode { - timerNode = current - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) - } else { - timerTransition = .immediate - } - if displayDeadlineTimer { - timerTransition.updateAlpha(node: timerNode, alpha: 1.0) - } else { - timerTransition.updateAlpha(node: timerNode, alpha: 0.0) - } - } else { - timerNode = PollBubbleTimerNode() - strongSelf.timerNode = timerNode - strongSelf.addSubnode(timerNode) - timerNode.reachedTimeout = { - guard let strongSelf = self, let _ = strongSelf.item else { - return + + if let poll, case .quiz = poll.kind, let deadlineTimeout, !isClosed { + let timerNode: PollBubbleTimerNode + if let current = strongSelf.timerNode { + timerNode = current + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + if displayDeadlineTimer { + timerTransition.updateAlpha(node: timerNode, alpha: 1.0) + } else { + timerTransition.updateAlpha(node: timerNode, alpha: 0.0) + } + } else { + timerNode = PollBubbleTimerNode() + strongSelf.timerNode = timerNode + strongSelf.addSubnode(timerNode) + timerNode.reachedTimeout = { + guard let strongSelf = self, + let _ = strongSelf.item else { + return + } + //item.controllerInteraction.requestMessageUpdate(item.message.id) + } + + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + if displayDeadlineTimer { + timerNode.alpha = 0.0 + timerTransition.updateAlpha(node: timerNode, alpha: 1.0) + } else { + timerNode.alpha = 0.0 } - //item.controllerInteraction.requestMessageUpdate(item.message.id) } - + timerNode.update(regularColor: messageTheme.secondaryTextColor, proximityColor: messageTheme.scamColor, timeout: deadlineTimeout, deadlineTimestamp: endDate) + timerNode.frame = CGRect(origin: CGPoint(x: resultSize.width - layoutConstants.text.bubbleInsets.right, y: typeFrame.minY), size: CGSize()) + } else if let timerNode = strongSelf.timerNode { + strongSelf.timerNode = nil + let timerTransition: ContainedViewLayoutTransition if animation.isAnimated { timerTransition = .animated(duration: 0.25, curve: .easeInOut) } else { timerTransition = .immediate } - if displayDeadlineTimer { - timerNode.alpha = 0.0 - timerTransition.updateAlpha(node: timerNode, alpha: 1.0) - } else { - timerNode.alpha = 0.0 - } + timerTransition.updateAlpha(node: timerNode, alpha: 0.0, completion: { [weak timerNode] _ in + timerNode?.removeFromSupernode() + }) + timerTransition.updateTransformScale(node: timerNode, scale: 0.1) } - timerNode.update(regularColor: messageTheme.secondaryTextColor, proximityColor: messageTheme.scamColor, timeout: deadlineTimeout, deadlineTimestamp: endDate) - timerNode.frame = CGRect(origin: CGPoint(x: resultSize.width - layoutConstants.text.bubbleInsets.right, y: typeFrame.minY), size: CGSize()) - } else if let timerNode = strongSelf.timerNode { - strongSelf.timerNode = nil - - let timerTransition: ContainedViewLayoutTransition + + var statusOffset: CGFloat = 0.0 + if let poll, case .poll = poll.kind, let endDate, !isClosed { + let timerNode: DeadlineTimerNode + if let current = strongSelf.deadlineTimerNode { + timerNode = current + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + if displayDeadlineTimer { + timerTransition.updateAlpha(node: timerNode, alpha: 1.0) + } else { + timerTransition.updateAlpha(node: timerNode, alpha: 0.0) + } + } else { + timerNode = DeadlineTimerNode() + strongSelf.deadlineTimerNode = timerNode + strongSelf.addSubnode(timerNode) + + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + if displayDeadlineTimer { + timerNode.alpha = 0.0 + timerTransition.updateAlpha(node: timerNode, alpha: 1.0) + } else { + timerNode.alpha = 0.0 + } + } + timerNode.update(size: resultSize, color: messageTheme.secondaryTextColor, deadlineTimeout: endDate, resultsHidden: poll.hideResultsUntilClose, strings: item.presentationData.strings) + timerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: verticalOffset + 31.0), size: CGSize(width: resultSize.width, height: 20.0)) + statusOffset += 6.0 + } else if let timerNode = strongSelf.deadlineTimerNode { + strongSelf.deadlineTimerNode = nil + + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + timerTransition.updateAlpha(node: timerNode, alpha: 0.0, completion: { [weak timerNode] _ in + timerNode?.removeFromSupernode() + }) + timerTransition.updateTransformScale(node: timerNode, scale: 0.1) + } + + let solutionButtonSize = CGSize(width: 32.0, height: 32.0) + let solutionButtonFrame = CGRect(origin: CGPoint(x: resultSize.width - layoutConstants.text.bubbleInsets.right - solutionButtonSize.width + 5.0, y: typeFrame.minY - 16.0), size: solutionButtonSize) + strongSelf.solutionButtonNode.frame = solutionButtonFrame + + if (strongSelf.timerNode == nil || !displayDeadlineTimer), let poll = poll, case .quiz = poll.kind, let _ = poll.results.solution, (isClosed || hasSelected) { + if strongSelf.solutionButtonNode.alpha.isZero { + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + timerTransition.updateAlpha(node: strongSelf.solutionButtonNode, alpha: 1.0) + } + strongSelf.solutionButtonNode.update(size: solutionButtonSize, theme: item.presentationData.theme.theme, incoming: incoming) + } else if !strongSelf.solutionButtonNode.alpha.isZero { + let timerTransition: ContainedViewLayoutTransition + if animation.isAnimated { + timerTransition = .animated(duration: 0.25, curve: .easeInOut) + } else { + timerTransition = .immediate + } + timerTransition.updateAlpha(node: strongSelf.solutionButtonNode, alpha: 0.0) + } + + let avatarsFrame = CGRect(origin: CGPoint(x: typeFrame.maxX + 6.0, y: typeFrame.minY + floor((typeFrame.height - MergedAvatarsNode.defaultMergedImageSize) / 2.0)), size: CGSize(width: MergedAvatarsNode.defaultMergedImageSize + MergedAvatarsNode.defaultMergedImageSpacing * 2.0, height: MergedAvatarsNode.defaultMergedImageSize)) + strongSelf.avatarsNode.frame = avatarsFrame + strongSelf.avatarsNode.updateLayout(size: avatarsFrame.size) + strongSelf.avatarsNode.update(context: item.context, peers: avatarPeers, synchronousLoad: synchronousLoad, imageSize: MergedAvatarsNode.defaultMergedImageSize, imageSpacing: MergedAvatarsNode.defaultMergedImageSpacing, borderWidth: MergedAvatarsNode.defaultBorderWidth) + strongSelf.avatarsNode.isHidden = isBotChat + let alphaTransition: ContainedViewLayoutTransition if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) + alphaTransition = .animated(duration: 0.25, curve: .easeInOut) + alphaTransition.updateAlpha(node: strongSelf.avatarsNode, alpha: avatarPeers.isEmpty ? 0.0 : 1.0) } else { - timerTransition = .immediate + alphaTransition = .immediate } - timerTransition.updateAlpha(node: timerNode, alpha: 0.0, completion: { [weak timerNode] _ in - timerNode?.removeFromSupernode() - }) - timerTransition.updateTransformScale(node: timerNode, scale: 0.1) - } - - var statusOffset: CGFloat = 0.0 - if let poll, case .poll = poll.kind, let endDate, !isClosed { - let timerNode: DeadlineTimerNode - if let current = strongSelf.deadlineTimerNode { - timerNode = current - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) - } else { - timerTransition = .immediate - } - if displayDeadlineTimer { - timerTransition.updateAlpha(node: timerNode, alpha: 1.0) - } else { - timerTransition.updateAlpha(node: timerNode, alpha: 0.0) - } - } else { - timerNode = DeadlineTimerNode() - strongSelf.deadlineTimerNode = timerNode - strongSelf.addSubnode(timerNode) - - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) - } else { - timerTransition = .immediate - } - if displayDeadlineTimer { - timerNode.alpha = 0.0 - timerTransition.updateAlpha(node: timerNode, alpha: 1.0) - } else { - timerNode.alpha = 0.0 + + let _ = votersApply() + let votersFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - votersLayout.size.width) / 2.0), y: verticalOffset + optionsVotersSpacing), size: votersLayout.size) + animation.animator.updateFrame(layer: strongSelf.votersNode.layer, frame: votersFrame, completion: nil) + + if animation.isAnimated, let previousPoll = previousPoll, let poll = poll { + if previousPoll.results.totalVoters == nil && poll.results.totalVoters != nil { + strongSelf.votersNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25) } } - timerNode.update(size: resultSize, color: messageTheme.secondaryTextColor, deadlineTimeout: endDate, resultsHidden: poll.hideResultsUntilClose, strings: item.presentationData.strings) - timerNode.frame = CGRect(origin: CGPoint(x: 0.0, y: verticalOffset + 31.0), size: CGSize(width: resultSize.width, height: 20.0)) - statusOffset += 6.0 - } else if let timerNode = strongSelf.deadlineTimerNode { - strongSelf.deadlineTimerNode = nil - - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) - } else { - timerTransition = .immediate - } - timerTransition.updateAlpha(node: timerNode, alpha: 0.0, completion: { [weak timerNode] _ in - timerNode?.removeFromSupernode() - }) - timerTransition.updateTransformScale(node: timerNode, scale: 0.1) - } - - let solutionButtonSize = CGSize(width: 32.0, height: 32.0) - let solutionButtonFrame = CGRect(origin: CGPoint(x: resultSize.width - layoutConstants.text.bubbleInsets.right - solutionButtonSize.width + 5.0, y: typeFrame.minY - 16.0), size: solutionButtonSize) - strongSelf.solutionButtonNode.frame = solutionButtonFrame - - if (strongSelf.timerNode == nil || !displayDeadlineTimer), let poll = poll, case .quiz = poll.kind, let _ = poll.results.solution, (isClosed || hasSelected) { - if strongSelf.solutionButtonNode.alpha.isZero { - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) + + if let statusSizeAndApply = statusSizeAndApply { + let statusFrame = CGRect(origin: CGPoint(x: resultSize.width - statusSizeAndApply.0.width - layoutConstants.text.bubbleInsets.right, y: votersFrame.maxY + statusOffset), size: statusSizeAndApply.0) + + if strongSelf.statusNode.supernode == nil { + statusSizeAndApply.1(.None) + strongSelf.statusNode.frame = statusFrame + strongSelf.addSubnode(strongSelf.statusNode) } else { - timerTransition = .immediate + statusSizeAndApply.1(animation) + animation.animator.updateFrame(layer: strongSelf.statusNode.layer, frame: statusFrame, completion: nil) } - timerTransition.updateAlpha(node: strongSelf.solutionButtonNode, alpha: 1.0) + } else if strongSelf.statusNode.supernode != nil { + strongSelf.statusNode.removeFromSupernode() } - strongSelf.solutionButtonNode.update(size: solutionButtonSize, theme: item.presentationData.theme.theme, incoming: incoming) - } else if !strongSelf.solutionButtonNode.alpha.isZero { - let timerTransition: ContainedViewLayoutTransition - if animation.isAnimated { - timerTransition = .animated(duration: 0.25, curve: .easeInOut) - } else { - timerTransition = .immediate - } - timerTransition.updateAlpha(node: strongSelf.solutionButtonNode, alpha: 0.0) + + let _ = buttonSubmitInactiveTextApply() + strongSelf.buttonSubmitInactiveTextNode.frame = buttonSubmitInactiveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) + + let _ = buttonSubmitActiveTextApply() + strongSelf.buttonSubmitActiveTextNode.frame = buttonSubmitActiveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) + + let _ = buttonSaveTextApply() + strongSelf.buttonSaveTextNode.frame = buttonSaveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) + + let _ = buttonViewResultsTextApply() + strongSelf.buttonViewResultsTextNode.frame = buttonViewResultsTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) + + strongSelf.updateSelection() + strongSelf.updatePollTooltipMessageState(animated: false) + + let buttonWidth: CGFloat = floor(max(strongSelf.buttonSaveTextNode.frame.width, max(strongSelf.buttonViewResultsTextNode.frame.width, strongSelf.buttonSubmitActiveTextNode.frame.width)) * 1.1) + strongSelf.buttonNode.frame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonWidth) / 2.0), y: verticalOffset), size: CGSize(width: buttonWidth, height: 44.0)) + + strongSelf.updateIsTranslating(isTranslating) } - - let avatarsFrame = CGRect(origin: CGPoint(x: typeFrame.maxX + 6.0, y: typeFrame.minY + floor((typeFrame.height - MergedAvatarsNode.defaultMergedImageSize) / 2.0)), size: CGSize(width: MergedAvatarsNode.defaultMergedImageSize + MergedAvatarsNode.defaultMergedImageSpacing * 2.0, height: MergedAvatarsNode.defaultMergedImageSize)) - strongSelf.avatarsNode.frame = avatarsFrame - strongSelf.avatarsNode.updateLayout(size: avatarsFrame.size) - strongSelf.avatarsNode.update(context: item.context, peers: avatarPeers, synchronousLoad: synchronousLoad, imageSize: MergedAvatarsNode.defaultMergedImageSize, imageSpacing: MergedAvatarsNode.defaultMergedImageSpacing, borderWidth: MergedAvatarsNode.defaultBorderWidth) - strongSelf.avatarsNode.isHidden = isBotChat - let alphaTransition: ContainedViewLayoutTransition - if animation.isAnimated { - alphaTransition = .animated(duration: 0.25, curve: .easeInOut) - alphaTransition.updateAlpha(node: strongSelf.avatarsNode, alpha: avatarPeers.isEmpty ? 0.0 : 1.0) - } else { - alphaTransition = .immediate - } - - let _ = votersApply() - let votersFrame = CGRect(origin: CGPoint(x: floor((resultSize.width - votersLayout.size.width) / 2.0), y: verticalOffset + optionsVotersSpacing), size: votersLayout.size) - animation.animator.updateFrame(layer: strongSelf.votersNode.layer, frame: votersFrame, completion: nil) - - if animation.isAnimated, let previousPoll = previousPoll, let poll = poll { - if previousPoll.results.totalVoters == nil && poll.results.totalVoters != nil { - strongSelf.votersNode.layer.animateAlpha(from: 0.0, to: 1.0, duration: 0.25) - } - } - - if let statusSizeAndApply = statusSizeAndApply { - let statusFrame = CGRect(origin: CGPoint(x: resultSize.width - statusSizeAndApply.0.width - layoutConstants.text.bubbleInsets.right, y: votersFrame.maxY + statusOffset), size: statusSizeAndApply.0) - - if strongSelf.statusNode.supernode == nil { - statusSizeAndApply.1(.None) - strongSelf.statusNode.frame = statusFrame - strongSelf.addSubnode(strongSelf.statusNode) - } else { - statusSizeAndApply.1(animation) - animation.animator.updateFrame(layer: strongSelf.statusNode.layer, frame: statusFrame, completion: nil) - } - } else if strongSelf.statusNode.supernode != nil { - strongSelf.statusNode.removeFromSupernode() - } - - let _ = buttonSubmitInactiveTextApply() - strongSelf.buttonSubmitInactiveTextNode.frame = buttonSubmitInactiveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) - - let _ = buttonSubmitActiveTextApply() - strongSelf.buttonSubmitActiveTextNode.frame = buttonSubmitActiveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) - - let _ = buttonSaveTextApply() - strongSelf.buttonSaveTextNode.frame = buttonSaveTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) - - let _ = buttonViewResultsTextApply() - strongSelf.buttonViewResultsTextNode.frame = buttonViewResultsTextFrame.offsetBy(dx: 0.0, dy: verticalOffset) - - strongSelf.updateSelection() - strongSelf.updatePollTooltipMessageState(animated: false) - - let buttonWidth: CGFloat = floor(max(strongSelf.buttonSaveTextNode.frame.width, max(strongSelf.buttonViewResultsTextNode.frame.width, strongSelf.buttonSubmitActiveTextNode.frame.width)) * 1.1) - strongSelf.buttonNode.frame = CGRect(origin: CGPoint(x: floor((resultSize.width - buttonWidth) / 2.0), y: verticalOffset), size: CGSize(width: buttonWidth, height: 44.0)) - - strongSelf.updateIsTranslating(isTranslating) - } - }) + }) }) }) } diff --git a/submodules/TelegramUI/Components/ComposePollScreen/BUILD b/submodules/TelegramUI/Components/ComposePollScreen/BUILD index 358b7890a4..cecd26b01f 100644 --- a/submodules/TelegramUI/Components/ComposePollScreen/BUILD +++ b/submodules/TelegramUI/Components/ComposePollScreen/BUILD @@ -60,6 +60,8 @@ swift_library( "//submodules/CounterControllerTitleView", "//submodules/TelegramUI/Components/EdgeEffect", "//submodules/ICloudResources", + "//submodules/CountrySelectionUI", + "//submodules/TelegramUI/Components/ShareWithPeersScreen", ], visibility = [ "//visibility:public", diff --git a/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift b/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift index 709e42b639..c6ef9a0bd2 100644 --- a/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift +++ b/submodules/TelegramUI/Components/ComposePollScreen/Sources/ComposePollScreen.swift @@ -35,6 +35,8 @@ import ContextUI import StickerPeekUI import EdgeEffect import LocationUI +import CountrySelectionUI +import ShareWithPeersScreen public final class ComposedPoll { public struct Text { @@ -54,6 +56,8 @@ public final class ComposedPoll { public let revotingDisabled: Bool public let shuffleAnswers: Bool public let hideResultsUntilClose: Bool + public let restrictToSubscribers: Bool + public let limitToCountries: [String] public let text: Text public let description: Text @@ -72,6 +76,8 @@ public final class ComposedPoll { revotingDisabled: Bool, shuffleAnswers: Bool, hideResultsUntilClose: Bool, + restrictToSubscribers: Bool, + limitToCountries: [String], text: Text, description: Text, media: AnyMediaReference?, @@ -88,6 +94,8 @@ public final class ComposedPoll { self.revotingDisabled = revotingDisabled self.shuffleAnswers = shuffleAnswers self.hideResultsUntilClose = hideResultsUntilClose + self.restrictToSubscribers = restrictToSubscribers + self.limitToCountries = limitToCountries self.text = text self.description = description self.media = media @@ -229,11 +237,17 @@ final class ComposePollScreenComponent: Component { private var canAddOptions: Bool = false private var canRevote: Bool = false private var shuffleOptions: Bool = false - private var isQuiz: Bool = false + private(set) var isQuiz: Bool = false private var selectedQuizOptionIds = Set() private var limitDuration: Bool = false private var timeLimit: TimeLimit = .duration(24 * 60 * 60) private var hideResults: Bool = false + private var restrictToSubscribers: Bool = false + private var limitByCountry: Bool = false + private var limitToCountries: [String] = [] + + private var currentLocale: Locale? + private var didSetupCountries = false private var currentInputMode: ListComposePollOptionComponent.InputMode = .keyboard @@ -258,6 +272,8 @@ final class ComposePollScreenComponent: Component { private var cachedShuffleIcon: UIImage? private var cachedQuizIcon: UIImage? private var cachedDurationIcon: UIImage? + private var cachedSubscribersIcon: UIImage? + private var cachedCountryIcon: UIImage? private var cachedEmptyIcon: UIImage? private var reorderRecognizer: ReorderGestureRecognizer? @@ -460,6 +476,7 @@ final class ComposePollScreenComponent: Component { case questionNeeded case optionsNeeded case quizCorrectOptionNeeded + case countriesNeeded } var hasAnyData: Bool { @@ -490,14 +507,7 @@ final class ComposePollScreenComponent: Component { if self.pollTextInputState.text.length == 0 { return .questionNeeded } - - let mappedKind: TelegramMediaPollKind - if self.isQuiz { - mappedKind = .quiz(multipleAnswers: self.effectiveIsMultiAnswer) - } else { - mappedKind = .poll(multipleAnswers: self.effectiveIsMultiAnswer) - } - + var mappedOptions: [TelegramMediaPollOption] = [] var selectedQuizOptions: [Data] = [] for pollOption in self.pollOptions { @@ -532,8 +542,21 @@ final class ComposePollScreenComponent: Component { )) } + let mappedKind: TelegramMediaPollKind + if self.isQuiz { + mappedKind = .quiz(multipleAnswers: self.effectiveIsMultiAnswer) + } else { + mappedKind = .poll(multipleAnswers: self.effectiveIsMultiAnswer && mappedOptions.count > 1) + } + if self.isQuiz && mappedOptions.count < 2 { return .optionsNeeded + } else if !self.isQuiz && mappedOptions.count < 1 { + return .optionsNeeded + } + + if self.limitByCountry && self.limitToCountries.isEmpty { + return .countriesNeeded } var mappedCorrectAnswers: [Data]? @@ -608,6 +631,8 @@ final class ComposePollScreenComponent: Component { revotingDisabled: !self.canRevote, shuffleAnswers: self.shuffleOptions, hideResultsUntilClose: self.hideResults, + restrictToSubscribers: self.restrictToSubscribers, + limitToCountries: self.limitByCountry ? self.limitToCountries : [], text: ComposedPoll.Text(string: self.pollTextInputState.text.string, entities: textEntities), description: ComposedPoll.Text(string: self.pollDescriptionInputState.text.string, entities: descriptionEntities), media: self.pollDescriptionMedia?.media, @@ -624,7 +649,8 @@ final class ComposePollScreenComponent: Component { media: mappedSolution.2?.media ) }, - hasUnseenVotes: false + hasUnseenVotes: false, + canViewStats: false ), deadlineTimeout: deadlineTimeout, deadlineDate: deadlineDate, @@ -1217,6 +1243,32 @@ final class ComposePollScreenComponent: Component { (self.environment?.controller() as? ComposePollScreen)?.parentController()?.push(controller) } + private func openCountriesSelection() { + guard let component = self.component else { + return + } + + let stateContext = CountriesMultiselectionScreen.StateContext( + context: component.context, + subject: .countries, + initialSelectedCountries: self.limitToCountries + ) + let _ = (stateContext.ready |> filter { $0 } |> take(1) |> deliverOnMainQueue).startStandalone(next: { [weak self] _ in + let controller = CountriesMultiselectionScreen( + context: component.context, + stateContext: stateContext, + completion: { [weak self] countries in + guard let self else { + return + } + self.limitToCountries = countries + self.state?.updated() + } + ) + (self?.environment?.controller() as? ComposePollScreen)?.parentController()?.push(controller) + }) + } + func deactivateInput() { self.currentInputMode = .keyboard if hasFirstResponder(self) { @@ -1249,6 +1301,8 @@ final class ComposePollScreenComponent: Component { } if self.component == nil { + self.currentLocale = localeWithStrings(environment.strings) + self.isQuiz = component.isQuiz ?? false if !self.isQuiz { self.isMultiAnswer = true @@ -1415,6 +1469,8 @@ final class ComposePollScreenComponent: Component { self.cachedShuffleIcon = renderSettingsIcon(name: "Item List/Icons/Shuffle", backgroundColors: [UIColor(rgb: 0xAF52DE)]) self.cachedQuizIcon = renderSettingsIcon(name: "Item List/Icons/Checkbox", backgroundColors: [UIColor(rgb: 0x34C759)]) self.cachedDurationIcon = renderSettingsIcon(name: "Item List/Icons/Timer", backgroundColors: [UIColor(rgb: 0xFF453A)]) + self.cachedSubscribersIcon = renderSettingsIcon(name: "Item List/Icons/Profile", backgroundColors: [UIColor(rgb: 0x0A84FF)]) + self.cachedCountryIcon = renderSettingsIcon(name: "Item List/Icons/Flag", backgroundColors: [UIColor(rgb: 0xFF9F0A)]) self.cachedEmptyIcon = generateSingleColorImage(size: CGSize(width: 30.0, height: 30.0), color: .clear) @@ -2256,6 +2312,136 @@ final class ComposePollScreenComponent: Component { maximumNumberOfLines: 0 )) } + + if isChannel { + pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "subscribers", component: AnyComponent(ListActionItemComponent( + theme: theme, + style: .glass, + title: AnyComponent(VStack([ + AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: environment.strings.CreatePoll_RestrictToSubscribers, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize), + textColor: theme.list.itemPrimaryTextColor + )), + maximumNumberOfLines: 2 + ))), + AnyComponentWithIdentity(id: AnyHashable(1), component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: environment.strings.CreatePoll_RestrictToSubscribersInfo, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), + textColor: theme.list.itemSecondaryTextColor + )), + maximumNumberOfLines: 3, + lineSpacing: 0.1 + ))) + ], alignment: .left, spacing: 4.0)), + verticalAlignment: .middle, + contentInsets: UIEdgeInsets(top: 10.0, left: 0.0, bottom: 10.0, right: 0.0), + leftIcon: .custom(AnyComponentWithIdentity(id: 0, component: AnyComponent( + Image(image: self.cachedSubscribersIcon, size: CGSize(width: 30.0, height: 30.0)) + )), false), + accessory: .toggle(ListActionItemComponent.Toggle(style: .regular, isOn: self.restrictToSubscribers, action: { [weak self] _ in + guard let self else { + return + } + self.restrictToSubscribers = !self.restrictToSubscribers + self.state?.updated(transition: .spring(duration: 0.4)) + })), + action: nil + )))) + + pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "limitCountry", component: AnyComponent(ListActionItemComponent( + theme: theme, + style: .glass, + title: AnyComponent(VStack([ + AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: environment.strings.CreatePoll_LimitCountry, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize), + textColor: theme.list.itemPrimaryTextColor + )), + maximumNumberOfLines: 2 + ))), + AnyComponentWithIdentity(id: AnyHashable(1), component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: environment.strings.CreatePoll_LimitCountryInfo, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize * 13.0 / 17.0), + textColor: theme.list.itemSecondaryTextColor + )), + maximumNumberOfLines: 3, + lineSpacing: 0.1 + ))) + ], alignment: .left, spacing: 4.0)), + verticalAlignment: .middle, + contentInsets: UIEdgeInsets(top: 10.0, left: 0.0, bottom: 10.0, right: 0.0), + leftIcon: .custom(AnyComponentWithIdentity(id: 0, component: AnyComponent( + Image(image: self.cachedCountryIcon, size: CGSize(width: 30.0, height: 30.0)) + )), false), + accessory: .toggle(ListActionItemComponent.Toggle(style: .regular, isOn: self.limitByCountry, action: { [weak self] _ in + guard let self else { + return + } + self.limitByCountry = !self.limitByCountry + self.state?.updated(transition: .spring(duration: 0.4)) + + if self.limitByCountry { + if !self.didSetupCountries { + let countriesConfiguration = component.context.currentCountriesConfiguration.with { $0 } + AuthorizationSequenceCountrySelectionController.setupCountryCodes(countries: countriesConfiguration.countries, codesByPrefix: countriesConfiguration.countriesByPrefix) + } + self.scrollView.setContentOffset(CGPoint(x: 0.0, y: self.scrollView.contentSize.height - self.scrollView.bounds.size.height), animated: true) + } + })), + action: nil + )))) + + if self.limitByCountry { + var value: String + if self.limitToCountries.count > 1 { + value = environment.strings.CreatePoll_AllowedCountries_Countries(Int32(self.limitToCountries.count)) + } else if self.limitToCountries.count == 1, let countryCode = self.limitToCountries.first { + value = self.currentLocale?.localizedString(forRegionCode: countryCode) ?? countryCode + } else { + value = "" + } + + pollSettingsSectionItems.append(AnyComponentWithIdentity(id: "countries", component: AnyComponent(ListActionItemComponent( + theme: theme, + style: .glass, + title: AnyComponent(VStack([ + AnyComponentWithIdentity(id: AnyHashable(0), component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: environment.strings.CreatePoll_AllowedCountries, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize), + textColor: theme.list.itemPrimaryTextColor + )), + maximumNumberOfLines: 2 + ))) + ], alignment: .left, spacing: 4.0)), + verticalAlignment: .middle, + leftIcon: .custom(AnyComponentWithIdentity(id: 0, component: AnyComponent( + Image(image: self.cachedEmptyIcon, size: CGSize(width: 30.0, height: 30.0)) + )), false), + icon: ListActionItemComponent.Icon(component: AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: value, + font: Font.regular(presentationData.listsFontSize.baseDisplaySize), + textColor: environment.theme.list.itemSecondaryTextColor + )), + maximumNumberOfLines: 1 + )))), + accessory: .arrow, + action: { [weak self] view in + guard let self else { + return + } + self.deactivateInput() + self.openCountriesSelection() + } + )))) + } + } let pollSettingsSectionSize = self.pollSettingsSection.update( transition: transition, @@ -2911,7 +3097,7 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont text = presentationData.strings.CreatePoll_QuestionNeeded case .optionsNeeded: title = nil - text = presentationData.strings.CreatePoll_OptionsNeeded + text = componentView.isQuiz ? presentationData.strings.CreatePoll_OptionsNeeded : presentationData.strings.CreatePoll_OptionsNeededOne case .quizCorrectOptionNeeded: title = nil if componentView.effectiveIsMultiAnswer { @@ -2919,6 +3105,10 @@ public class ComposePollScreen: ViewControllerComponentContainer, AttachmentCont } else { text = presentationData.strings.CreatePoll_QuizCorrectOptionNeeded } + case .countriesNeeded: + //TODO:localize + title = nil + text = "Select at least one country" } let controller = UndoOverlayController( diff --git a/submodules/TelegramUI/Components/PollStatsScreen/BUILD b/submodules/TelegramUI/Components/PollStatsScreen/BUILD new file mode 100644 index 0000000000..6cd172cdc4 --- /dev/null +++ b/submodules/TelegramUI/Components/PollStatsScreen/BUILD @@ -0,0 +1,32 @@ +load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library") + +swift_library( + name = "PollStatsScreen", + module_name = "PollStatsScreen", + srcs = glob([ + "Sources/**/*.swift", + ]), + copts = [ + "-warnings-as-errors", + ], + deps = [ + "//submodules/Display", + "//submodules/TelegramPresentationData", + "//submodules/AccountContext", + "//submodules/ComponentFlow", + "//submodules/Components/ViewControllerComponent", + "//submodules/TelegramCore", + "//submodules/SSignalKit/SwiftSignalKit", + "//submodules/Components/MultilineTextComponent", + "//submodules/Components/BundleIconComponent", + "//submodules/Components/SheetComponent", + "//submodules/ItemListUI", + "//submodules/TelegramUI/Components/ListSectionComponent", + "//submodules/TelegramUI/Components/ListItemComponentAdaptor", + "//submodules/TelegramUI/Components/GlassBarButtonComponent", + "//submodules/StatisticsUI", + ], + visibility = [ + "//visibility:public", + ], +) diff --git a/submodules/TelegramUI/Components/PollStatsScreen/Sources/PollStatsScreen.swift b/submodules/TelegramUI/Components/PollStatsScreen/Sources/PollStatsScreen.swift new file mode 100644 index 0000000000..03be0edc4b --- /dev/null +++ b/submodules/TelegramUI/Components/PollStatsScreen/Sources/PollStatsScreen.swift @@ -0,0 +1,342 @@ +import Foundation +import UIKit +import Display +import SwiftSignalKit +import TelegramCore +import AccountContext +import TelegramPresentationData +import ComponentFlow +import ViewControllerComponent +import SheetComponent +import MultilineTextComponent +import BundleIconComponent +import GlassBarButtonComponent +import ListSectionComponent +import ListItemComponentAdaptor +import StatisticsUI +import ItemListUI + +private final class PollStatsSheetContent: CombinedComponent { + typealias EnvironmentType = ViewControllerComponentContainer.Environment + + let context: AccountContext + let messageId: EngineMessage.Id + let animateOut: ActionSlot> + let getController: () -> ViewController? + + init( + context: AccountContext, + messageId: EngineMessage.Id, + animateOut: ActionSlot>, + getController: @escaping () -> ViewController? + ) { + self.context = context + self.messageId = messageId + self.animateOut = animateOut + self.getController = getController + } + + static func ==(lhs: PollStatsSheetContent, rhs: PollStatsSheetContent) -> Bool { + if lhs.context !== rhs.context { + return false + } + if lhs.messageId != rhs.messageId { + return false + } + return true + } + + final class State: ComponentState { + let pollStatsContext: PollStatsContext + + private let animateOut: ActionSlot> + private let getController: () -> ViewController? + private let stateDisposable = MetaDisposable() + + var stats: PollStats? + private var loadedVotesGraphToken: String? + + init( + context: AccountContext, + messageId: EngineMessage.Id, + animateOut: ActionSlot>, + getController: @escaping () -> ViewController? + ) { + self.pollStatsContext = PollStatsContext(account: context.account, messageId: messageId) + self.animateOut = animateOut + self.getController = getController + + super.init() + + self.stateDisposable.set((self.pollStatsContext.state + |> deliverOnMainQueue).start(next: { [weak self] state in + guard let self else { + return + } + self.stats = state.stats + if let stats = state.stats, case let .OnDemand(token) = stats.votesGraph, !token.isEmpty, self.loadedVotesGraphToken != token { + self.loadedVotesGraphToken = token + self.pollStatsContext.loadVotesGraph() + } + self.updated(transition: .immediate) + })) + } + + deinit { + self.stateDisposable.dispose() + } + + func dismiss(animated: Bool) { + guard let controller = self.getController() else { + return + } + if animated { + self.animateOut.invoke(Action { [weak controller] _ in + controller?.dismiss(completion: nil) + }) + } else { + controller.dismiss(animated: false) + } + } + } + + func makeState() -> State { + return State( + context: self.context, + messageId: self.messageId, + animateOut: self.animateOut, + getController: self.getController + ) + } + + static var body: Body { + let closeButton = Child(GlassBarButtonComponent.self) + let title = Child(MultilineTextComponent.self) + let section = Child(ListSectionComponent.self) + + return { context in + let environment = context.environment[EnvironmentType.self].value + let component = context.component + let state = context.state + + let theme = environment.theme + let strings = environment.strings + let presentationData = component.context.sharedContext.currentPresentationData.with { $0 } + + let sideInset: CGFloat = 16.0 + let sectionWidth = context.availableSize.width - sideInset * 2.0 + let graph = state.stats?.votesGraph ?? .OnDemand(token: "") + + var contentSize = CGSize(width: context.availableSize.width, height: 16.0) + + let closeButton = closeButton.update( + component: GlassBarButtonComponent( + size: CGSize(width: 44.0, height: 44.0), + backgroundColor: nil, + isDark: theme.overallDarkAppearance, + state: .glass, + component: AnyComponentWithIdentity(id: "close", component: AnyComponent( + BundleIconComponent( + name: "Navigation/Close", + tintColor: theme.chat.inputPanel.panelControlColor + ) + )), + action: { _ in + state.dismiss(animated: true) + } + ), + availableSize: CGSize(width: 44.0, height: 44.0), + transition: .immediate + ) + context.add(closeButton.position(CGPoint(x: 16.0 + closeButton.size.width / 2.0, y: contentSize.height + closeButton.size.height / 2.0))) + + let title = title.update( + component: MultilineTextComponent( + text: .plain(NSAttributedString( + string: strings.PollStats_Title, + font: Font.semibold(17.0), + textColor: theme.actionSheet.primaryTextColor + )), + maximumNumberOfLines: 1 + ), + availableSize: CGSize(width: context.availableSize.width - 120.0, height: 44.0), + transition: .immediate + ) + context.add(title.position(CGPoint(x: context.availableSize.width / 2.0, y: 16.0 + 22.0))) + contentSize.height += 44.0 + contentSize.height += 19.0 + + let section = section.update( + component: ListSectionComponent( + theme: theme, + style: .glass, + header: AnyComponent(MultilineTextComponent( + text: .plain(NSAttributedString( + string: strings.PollStats_GraphHeader.uppercased(), + font: Font.regular(presentationData.listsFontSize.itemListBaseHeaderFontSize), + textColor: theme.list.freeTextColor + )), + maximumNumberOfLines: 0 + )), + footer: nil, + items: [ + AnyComponentWithIdentity(id: 0, component: AnyComponent(ListItemComponentAdaptor( + itemGenerator: StatsGraphItem( + presentationData: ItemListPresentationData(presentationData), + systemStyle: .glass, + graph: graph, + type: .lines5Min, + getDetailsData: { date, completion in + let _ = state.pollStatsContext.loadDetailedGraph(graph, x: Int64(date.timeIntervalSince1970) * 1000).start(next: { detailedGraph in + if let detailedGraph, case let .Loaded(_, data) = detailedGraph { + completion(data) + } else { + completion(nil) + } + }) + }, + sectionId: 0, + style: .blocks + ), + params: ListViewItemLayoutParams( + width: sectionWidth, + leftInset: 0.0, + rightInset: 0.0, + availableHeight: 10000.0, + isStandalone: true + ) + ))), + ], + displaySeparators: false + ), + availableSize: CGSize(width: sectionWidth, height: context.availableSize.height), + transition: context.transition + ) + context.add(section.position(CGPoint(x: context.availableSize.width / 2.0, y: contentSize.height + section.size.height / 2.0))) + contentSize.height += section.size.height + contentSize.height += 39.0 + + return contentSize + } + } +} + +private final class PollStatsSheetComponent: CombinedComponent { + typealias EnvironmentType = ViewControllerComponentContainer.Environment + + let context: AccountContext + let messageId: EngineMessage.Id + + init( + context: AccountContext, + messageId: EngineMessage.Id + ) { + self.context = context + self.messageId = messageId + } + + static func ==(lhs: PollStatsSheetComponent, rhs: PollStatsSheetComponent) -> Bool { + if lhs.context !== rhs.context { + return false + } + if lhs.messageId != rhs.messageId { + return false + } + return true + } + + static var body: Body { + let sheet = Child(SheetComponent.self) + let animateOut = StoredActionSlot(Action.self) + let sheetExternalState = SheetComponent.ExternalState() + + return { context in + let environment = context.environment[EnvironmentType.self] + let controller = environment.controller + + let dismiss: (Bool) -> Void = { animated in + guard let controller = controller() else { + return + } + if animated { + animateOut.invoke(Action { [weak controller] _ in + controller?.dismiss(completion: nil) + }) + } else { + controller.dismiss(completion: nil) + } + } + + let sheet = sheet.update( + component: SheetComponent( + content: AnyComponent(PollStatsSheetContent( + context: context.component.context, + messageId: context.component.messageId, + animateOut: animateOut, + getController: controller + )), + style: .glass, + backgroundColor: .color(environment.theme.list.modalBlocksBackgroundColor), + followContentSizeChanges: true, + clipsContent: true, + autoAnimateOut: false, + externalState: sheetExternalState, + animateOut: animateOut, + onPan: {}, + willDismiss: {} + ), + environment: { + environment + SheetComponentEnvironment( + metrics: environment.metrics, + deviceMetrics: environment.deviceMetrics, + isDisplaying: environment.value.isVisible, + isCentered: environment.metrics.widthClass == .regular, + hasInputHeight: !environment.inputHeight.isZero, + regularMetricsSize: CGSize(width: 430.0, height: 900.0), + dismiss: { animated in + dismiss(animated) + } + ) + }, + availableSize: context.availableSize, + transition: context.transition + ) + + context.add(sheet.position(CGPoint(x: context.availableSize.width / 2.0, y: context.availableSize.height / 2.0))) + + return context.availableSize + } + } +} + +public final class PollStatsScreen: ViewControllerComponentContainer { + public init( + context: AccountContext, + messageId: EngineMessage.Id + ) { + super.init( + context: context, + component: PollStatsSheetComponent( + context: context, + messageId: messageId + ), + navigationBarAppearance: .none, + statusBarStyle: .ignore, + theme: .default + ) + + self.navigationPresentation = .flatModal + self.automaticallyControlPresentationContextLayout = false + } + + required public init(coder aDecoder: NSCoder) { + fatalError("init(coder:) has not been implemented") + } + + public override func viewDidLoad() { + super.viewDidLoad() + + self.view.disablesInteractiveModalDismiss = true + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/Contents.json new file mode 100644 index 0000000000..43174ee790 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "flag.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/flag.pdf b/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/flag.pdf new file mode 100644 index 0000000000..7b9163fe79 Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Item List/Icons/Flag.imageset/flag.pdf differ diff --git a/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/Contents.json new file mode 100644 index 0000000000..dc5cf9d4a0 --- /dev/null +++ b/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/Contents.json @@ -0,0 +1,12 @@ +{ + "images" : [ + { + "filename" : "shareshare.pdf", + "idiom" : "universal" + } + ], + "info" : { + "author" : "xcode", + "version" : 1 + } +} diff --git a/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/shareshare.pdf b/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/shareshare.pdf new file mode 100644 index 0000000000..81a1664bf5 Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Navigation/Share.imageset/shareshare.pdf differ diff --git a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/200x200bb-75.jpg b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/200x200bb-75.jpg new file mode 100644 index 0000000000..0249b126a8 Binary files /dev/null and b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/200x200bb-75.jpg differ diff --git a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Contents.json b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Contents.json index d46b1751fe..0fcdd8c48e 100644 --- a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Contents.json +++ b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Contents.json @@ -6,17 +6,16 @@ }, { "idiom" : "universal", - "filename" : "Maps@2x.png", "scale" : "2x" }, { + "filename" : "200x200bb-75.jpg", "idiom" : "universal", - "filename" : "Maps@3x.png", "scale" : "3x" } ], "info" : { - "version" : 1, - "author" : "xcode" + "author" : "xcode", + "version" : 1 } -} \ No newline at end of file +} diff --git a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@2x.png b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@2x.png deleted file mode 100644 index bfccc77337..0000000000 Binary files a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@2x.png and /dev/null differ diff --git a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@3x.png b/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@3x.png deleted file mode 100644 index 29e2387b08..0000000000 Binary files a/submodules/TelegramUI/Images.xcassets/Open In/Maps.imageset/Maps@3x.png and /dev/null differ diff --git a/submodules/TelegramUI/Sources/ChatControllerContentData.swift b/submodules/TelegramUI/Sources/ChatControllerContentData.swift index 0d6d1b2b6d..047aaf43a5 100644 --- a/submodules/TelegramUI/Sources/ChatControllerContentData.swift +++ b/submodules/TelegramUI/Sources/ChatControllerContentData.swift @@ -2262,7 +2262,7 @@ extension ChatControllerImpl { } else { cachedData = .single((nil, [:])) } - + self.cachedDataDisposable?.dispose() self.cachedDataDisposable = combineLatest(queue: .mainQueue(), cachedData, diff --git a/submodules/TelegramUI/Sources/ChatControllerNode.swift b/submodules/TelegramUI/Sources/ChatControllerNode.swift index cf3f0612e7..4f399b6310 100644 --- a/submodules/TelegramUI/Sources/ChatControllerNode.swift +++ b/submodules/TelegramUI/Sources/ChatControllerNode.swift @@ -555,7 +555,7 @@ class ChatControllerNode: ASDisplayNode, ASScrollViewDelegate { } if let poll = media as? TelegramMediaPoll { var updatedMedia = message.media.filter { !($0 is TelegramMediaPoll) } - updatedMedia.append(TelegramMediaPoll(pollId: poll.pollId, publicity: poll.publicity, kind: poll.kind, text: poll.text, textEntities: poll.textEntities, options: poll.options, correctAnswers: poll.correctAnswers, results: TelegramMediaPollResults(voters: nil, totalVoters: nil, recentVoters: [], solution: nil, hasUnseenVotes: false), isClosed: false, deadlineTimeout: nil, deadlineDate: nil, pollHash: poll.pollHash)) + updatedMedia.append(TelegramMediaPoll(pollId: poll.pollId, publicity: poll.publicity, kind: poll.kind, text: poll.text, textEntities: poll.textEntities, options: poll.options, correctAnswers: poll.correctAnswers, results: TelegramMediaPollResults(voters: nil, totalVoters: nil, recentVoters: [], solution: nil, hasUnseenVotes: false, canViewStats: false), isClosed: false, deadlineTimeout: nil, deadlineDate: nil, pollHash: poll.pollHash)) messageMedia = updatedMedia } if let _ = media as? TelegramMediaDice { diff --git a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift index 1348dedfb8..a3f7cb20b3 100644 --- a/submodules/TelegramUI/Sources/ChatHistoryListNode.swift +++ b/submodules/TelegramUI/Sources/ChatHistoryListNode.swift @@ -38,6 +38,7 @@ import DustEffect import UrlHandling import TextFormat import ChatNewThreadInfoItem +import PhoneNumberFormat struct ChatTopVisibleMessageRange: Equatable { var lowerBound: MessageIndex @@ -366,7 +367,8 @@ private func extractAssociatedData( deviceContactsNumbers: Set, isInline: Bool, showSensitiveContent: Bool, - isSuspiciousPeer: Bool + isSuspiciousPeer: Bool, + accountCountry: String? ) -> ChatMessageItemAssociatedData { var automaticDownloadPeerId: EnginePeer.Id? var automaticMediaDownloadPeerType: MediaAutoDownloadPeerType = .channel @@ -421,7 +423,7 @@ private func extractAssociatedData( automaticDownloadPeerId = message.peerId } - return ChatMessageItemAssociatedData(automaticDownloadPeerType: automaticMediaDownloadPeerType, automaticDownloadPeerId: automaticDownloadPeerId, automaticDownloadNetworkType: automaticDownloadNetworkType, preferredStoryHighQuality: preferredStoryHighQuality, isRecentActions: false, subject: subject, contactsPeerIds: contactsPeerIds, channelDiscussionGroup: channelDiscussionGroup, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, availableMessageEffects: availableMessageEffects, savedMessageTags: savedMessageTags, defaultReaction: defaultReaction, areStarReactionsEnabled: areStarReactionsEnabled, isPremium: isPremium, accountPeer: accountPeer, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, topicAuthorId: topicAuthorId, hasBots: hasBots, translateToLanguage: translateToLanguage, maxReadStoryId: maxReadStoryId, recommendedChannels: recommendedChannels, audioTranscriptionTrial: audioTranscriptionTrial, chatThemes: chatThemes, deviceContactsNumbers: deviceContactsNumbers, isInline: isInline, showSensitiveContent: showSensitiveContent, isSuspiciousPeer: isSuspiciousPeer) + return ChatMessageItemAssociatedData(automaticDownloadPeerType: automaticMediaDownloadPeerType, automaticDownloadPeerId: automaticDownloadPeerId, automaticDownloadNetworkType: automaticDownloadNetworkType, preferredStoryHighQuality: preferredStoryHighQuality, isRecentActions: false, subject: subject, contactsPeerIds: contactsPeerIds, channelDiscussionGroup: channelDiscussionGroup, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, currentlyPlayingMessageId: currentlyPlayingMessageId, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, availableMessageEffects: availableMessageEffects, savedMessageTags: savedMessageTags, defaultReaction: defaultReaction, areStarReactionsEnabled: areStarReactionsEnabled, isPremium: isPremium, accountPeer: accountPeer, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, topicAuthorId: topicAuthorId, hasBots: hasBots, translateToLanguage: translateToLanguage, maxReadStoryId: maxReadStoryId, recommendedChannels: recommendedChannels, audioTranscriptionTrial: audioTranscriptionTrial, chatThemes: chatThemes, deviceContactsNumbers: deviceContactsNumbers, isInline: isInline, showSensitiveContent: showSensitiveContent, isSuspiciousPeer: isSuspiciousPeer, accountCountry: accountCountry) } private extension ChatHistoryLocationInput { @@ -1711,6 +1713,28 @@ public final class ChatHistoryListNodeImpl: ListViewImpl, ChatHistoryNode, ChatH return peer } |> distinctUntilChanged + + let accountCountry: Signal = .single(nil) + |> then( + combineLatest( + accountPeer + |> map { peer -> String? in + if case let .user(user) = peer { + return user.phone + } else { + return nil + } + } + |> distinctUntilChanged, + (context as! AccountContextImpl).countriesConfiguration + ) + |> map { phone, countriesConfiguration in + guard let phone, let (country, _) = lookupCountryIdByNumber(phone, configuration: countriesConfiguration) else { + return nil + } + return country.id + } + ) let topicAuthorId: Signal if let peerId = chatLocation.peerId, let threadId = chatLocation.threadId { @@ -1853,6 +1877,7 @@ public final class ChatHistoryListNodeImpl: ListViewImpl, ChatHistoryNode, ChatH savedMessageTags |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_savedMessageTags"), defaultReaction |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_defaultReaction"), accountPeer |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_accountPeer"), + accountCountry |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_accountCountry"), audioTranscriptionSuggestion |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_audioTranscriptionSuggestion"), promises |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_promises"), topicAuthorId |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_topicAuthorId"), @@ -1863,7 +1888,7 @@ public final class ChatHistoryListNodeImpl: ListViewImpl, ChatHistoryNode, ChatH chatThemes |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_chatThemes"), deviceContactsNumbers |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_deviceContactsNumbers"), contentSettings |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_contentSettings") - ) |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_firstChatHistoryTransition")).startStrict(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, preferredStoryHighQuality, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, availableMessageEffects, savedMessageTags, defaultReaction, accountPeer, suggestAudioTranscription, promises, topicAuthorId, translationState, maxReadStoryId, recommendedChannels, audioTranscriptionTrial, chatThemes, deviceContactsNumbers, contentSettings in + ) |> debug_measureTimeToFirstEvent(label: "chatHistoryNode_firstChatHistoryTransition")).startStrict(next: { [weak self] update, chatPresentationData, selectedMessages, updatingMedia, networkType, preferredStoryHighQuality, animatedEmojiStickers, additionalAnimatedEmojiStickers, customChannelDiscussionReadState, customThreadOutgoingReadState, availableReactions, availableMessageEffects, savedMessageTags, defaultReaction, accountPeer, accountCountry, suggestAudioTranscription, promises, topicAuthorId, translationState, maxReadStoryId, recommendedChannels, audioTranscriptionTrial, chatThemes, deviceContactsNumbers, contentSettings in let (historyAppearsCleared, pendingUnpinnedAllMessages, pendingRemovedMessages, currentlyPlayingMessageIdAndType, scrollToMessageId, chatHasBots, allAdMessages) = promises if measure_isFirstTime { @@ -2107,7 +2132,7 @@ public final class ChatHistoryListNodeImpl: ListViewImpl, ChatHistoryNode, ChatH isSuspiciousPeer = true } - let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, preferredStoryHighQuality: preferredStoryHighQuality, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageIdAndType?.0, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, availableMessageEffects: availableMessageEffects, savedMessageTags: savedMessageTags, defaultReaction: defaultReaction.0, areStarReactionsEnabled: defaultReaction.1, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId, hasBots: chatHasBots, translateToLanguage: translateToLanguage?.toLang, maxReadStoryId: maxReadStoryId, recommendedChannels: recommendedChannels, audioTranscriptionTrial: audioTranscriptionTrial, chatThemes: chatThemes, deviceContactsNumbers: deviceContactsNumbers, isInline: !rotated, showSensitiveContent: contentSettings.ignoreContentRestrictionReasons.contains("sensitive"), isSuspiciousPeer: isSuspiciousPeer) + let associatedData = extractAssociatedData(chatLocation: chatLocation, view: view, automaticDownloadNetworkType: networkType, preferredStoryHighQuality: preferredStoryHighQuality, animatedEmojiStickers: animatedEmojiStickers, additionalAnimatedEmojiStickers: additionalAnimatedEmojiStickers, subject: subject, currentlyPlayingMessageId: currentlyPlayingMessageIdAndType?.0, isCopyProtectionEnabled: isCopyProtectionEnabled, availableReactions: availableReactions, availableMessageEffects: availableMessageEffects, savedMessageTags: savedMessageTags, defaultReaction: defaultReaction.0, areStarReactionsEnabled: defaultReaction.1, isPremium: isPremium, alwaysDisplayTranscribeButton: alwaysDisplayTranscribeButton, accountPeer: accountPeer, topicAuthorId: topicAuthorId, hasBots: chatHasBots, translateToLanguage: translateToLanguage?.toLang, maxReadStoryId: maxReadStoryId, recommendedChannels: recommendedChannels, audioTranscriptionTrial: audioTranscriptionTrial, chatThemes: chatThemes, deviceContactsNumbers: deviceContactsNumbers, isInline: !rotated, showSensitiveContent: contentSettings.ignoreContentRestrictionReasons.contains("sensitive"), isSuspiciousPeer: isSuspiciousPeer, accountCountry: accountCountry) var includeEmbeddedSavedChatInfo = false if case let .replyThread(message) = chatLocation, message.peerId == context.account.peerId, !rotated { diff --git a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift index 3cd445d143..14aa237b33 100644 --- a/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift +++ b/submodules/TelegramUI/Sources/ChatInterfaceStateContextMenus.swift @@ -1867,6 +1867,7 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } var clearCacheAsDelete = false + var hasViewStats = false if let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info, !isMigrated { var views: Int = 0 var forwards: Int = 0 @@ -1887,11 +1888,28 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState controllerInteraction.openMessageStats(messages[0].id) }) }))) + hasViewStats = true } clearCacheAsDelete = true } + if !hasViewStats, messages[0].forwardInfo == nil { + for media in message.media { + if let poll = media as? TelegramMediaPoll, message.id.namespace == Namespaces.Message.Cloud, poll.pollId.namespace == Namespaces.Media.CloudPoll, poll.results.canViewStats { + actions.append(.action(ContextMenuActionItem(text: chatPresentationInterfaceState.strings.Conversation_ViewPollStats, icon: { theme in + return generateTintedImage(image: UIImage(bundleImageName: "Chat/Context Menu/Statistics"), color: theme.actionSheet.primaryTextColor) + }, action: { c, _ in + c?.dismiss(completion: { + let controller = context.sharedContext.makePollStatsScreen(context: context, messageId: messages[0].id) + controllerInteraction.navigationController()?.pushViewController(controller) + }) + }))) + break + } + } + } + if message.id.namespace == Namespaces.Message.Cloud, let channel = message.peers[message.id.peerId] as? TelegramChannel, case .broadcast = channel.info, canEditFactCheck(appConfig: appConfig) { var canAddFactCheck = true if message.media.contains(where: { $0 is TelegramMediaAction || $0 is TelegramMediaGiveaway }) { @@ -2266,6 +2284,53 @@ func contextMenuForChatPresentationInterfaceState(chatPresentationInterfaceState } } + for media in message.media { + if let poll = media as? TelegramMediaPoll, message.id.namespace == Namespaces.Message.Cloud, poll.pollId.namespace == Namespaces.Media.CloudPoll { + var restrictionText: String = "" + let peerName: String = chatPresentationInterfaceState.renderedPeer?.peer.flatMap(EnginePeer.init)?.compactDisplayTitle ?? "" + + if !poll.countries.isEmpty { + let locale = localeWithStrings(chatPresentationInterfaceState.strings) + let countryNames = poll.countries.map { id in + if let countryName = locale.localizedString(forRegionCode: id) { + return countryName + } else { + return id + } + } + var countries: String = "" + if countryNames.count == 1, let country = countryNames.first { + countries = "**\(country)**" + } else { + for i in 0 ..< countryNames.count { + countries.append("**\(countryNames[i])**") + if i == countryNames.count - 2 { + countries.append(chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country_CountriesLastDelimiter) + } else if i < countryNames.count - 2 { + countries.append(chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country_CountriesDelimiter) + } + } + } + if poll.restrictToSubscribers { + restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_SubscribersCountry(peerName, countries).string + } else { + restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Country(countries).string + } + } else if poll.restrictToSubscribers { + restrictionText = chatPresentationInterfaceState.strings.Chat_Poll_Restriction_Subscribers(peerName).string + } + + if !restrictionText.isEmpty { + actions.append(.separator) + let noAction: ((ContextMenuActionItem.Action) -> Void)? = nil + actions.append( + .action(ContextMenuActionItem(text: restrictionText, textLayout: .multiline, textFont: .small, parseMarkdown: true, icon: { _ in return nil }, action: noAction)) + ) + } + break + } + } + return ContextController.Items(content: .list(actions), tip: nil) } } diff --git a/submodules/TelegramUI/Sources/SharedAccountContext.swift b/submodules/TelegramUI/Sources/SharedAccountContext.swift index e87cb748ed..556eaa3b52 100644 --- a/submodules/TelegramUI/Sources/SharedAccountContext.swift +++ b/submodules/TelegramUI/Sources/SharedAccountContext.swift @@ -99,6 +99,7 @@ import GiftCraftScreen import ChatParticipantRightsScreen import PeerCopyProtectionInfoScreen import ChatRankInfoScreen +import PollStatsScreen import RankChatPreviewItem import TextProcessingScreen import CreateBotScreen @@ -3987,6 +3988,9 @@ public final class SharedAccountContextImpl: SharedAccountContext { return messageStatsController(context: context, updatedPresentationData: updatedPresentationData, subject: .message(id: messageId)) } + public func makePollStatsScreen(context: AccountContext, messageId: EngineMessage.Id) -> ViewController { + return PollStatsScreen(context: context, messageId: messageId) + } public func makeStoryStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal)?, peerId: EnginePeer.Id, storyId: Int32, storyItem: EngineStoryItem, fromStory: Bool) -> ViewController { return messageStatsController(context: context, updatedPresentationData: updatedPresentationData, subject: .story(peerId: peerId, id: storyId, item: storyItem, fromStory: fromStory)) }