Update API

This commit is contained in:
Ilya Laktyushin 2026-04-16 01:18:22 +02:00
parent efb1110987
commit 0df319742a
69 changed files with 12319 additions and 10209 deletions

View file

@ -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 %@";

View file

@ -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<PresentationData, NoError>)?, peerId: EnginePeer.Id, boosts: Bool, boostStatus: ChannelBoostStatus?) -> ViewController
func makeMessagesStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, messageId: EngineMessage.Id) -> ViewController
func makePollStatsScreen(context: AccountContext, messageId: EngineMessage.Id) -> ViewController
func makeStoryStatsController(context: AccountContext, updatedPresentationData: (initial: PresentationData, signal: Signal<PresentationData, NoError>)?, 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

View file

@ -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<CGFloat>, 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
}

View file

@ -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

View file

@ -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

View file

@ -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<PostStats?>(nil)
let forwardsPromise = Promise<StoryStatsPublicForwardsContext.State?>(nil)
let pollDataPromise = Promise<PollStats?>(nil)
let anyStatsContext: Any
var pollStatsContext: Any?
let dataSignal: Signal<PostStats?, NoError>
var loadDetailedGraphImpl: ((StatsGraph, Int64) -> Signal<StatsGraph?, NoError>)?
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<StatsGraph?, NoError> 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
}

View file

@ -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:

View file

@ -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
}
}
}
}

View file

@ -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

View file

@ -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

View file

@ -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
}
}
}
}

View file

@ -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
}
}
}

View file

@ -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
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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()

View file

@ -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 {

View file

@ -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
}
}
}
}

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

File diff suppressed because it is too large Load diff

View file

@ -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 {

View file

@ -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 {

View file

@ -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<Api.AiComposeTone>) {
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<Api.Bool>) {
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<Api.AiComposeTone>) {
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<Api.aicompose.Tones>) {
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<Api.Bool>) {
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<Api.AiComposeTone>) {
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<Api.Authorization>) {
let buffer = Buffer()
@ -3423,6 +3532,20 @@ public extension Api.functions.channels {
})
}
}
public extension Api.functions.channels {
static func getContactPersonalChannels() -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.channels.PersonalChannels>) {
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<Api.messages.ChatFull>) {
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<Api.messages.InvitedUsers>) {
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<Api.channels.Found>) {
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<Api.messages.Messages>) {
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<Api.messages.ComposedMessageWithAI>) {
static func composeMessageWithAI(flags: Int32, text: Api.TextWithEntities, translateToLang: String?, tone: Api.InputAiComposeTone?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.messages.ComposedMessageWithAI>) {
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<Api.Bool>) {
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<Api.Bool>) {
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<Api.stats.PollStats>) {
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<Api.stats.PublicForwards>) {
let buffer = Buffer()

View file

@ -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
}
}
}
}

View file

@ -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 {

View file

@ -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
}()

View file

@ -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 {

View file

@ -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)
}
}
}

View file

@ -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

View file

@ -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)

View file

@ -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! {

View file

@ -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 {

View file

@ -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<PollStats?, NoError> {
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<PollStats?, NoError> 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<Api.stats.PollStats, MTRpcError>
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<PollStats?, MTRpcError> 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<PollStatsContextState>()
var state: Signal<PollStatsContextState, NoError> {
return self._statePromise.get()
}
private let disposable = MetaDisposable()
private let disposables = DisposableDict<String>()
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<StatsGraph?, NoError> {
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<PollStatsContextImpl>
public var state: Signal<PollStatsContextState, NoError> {
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<StatsGraph?, NoError> {
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
}
}
}

View file

@ -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")
}
}

View file

@ -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)
}
}

View file

@ -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<Api.Updates?, NoError> in
return .single(nil)

View file

@ -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<Api.messages.ComposedMessageWithAI, TelegramAIComposeMessageError> in
if error.errorDescription == "AICOMPOSE_FLOOD_PREMIUM" {
return .fail(.nonPremiumFlood)

View file

@ -8,7 +8,7 @@ public enum AddSavedMusicError {
case generic
}
func revalidatedMusic<T>(account: Account, file: FileMediaReference, signal: @escaping (CloudDocumentMediaResource) -> Signal<T, MTRpcError>) -> Signal<T, MTRpcError> {
public func revalidatedMusic<T>(account: Account, file: FileMediaReference, signal: @escaping (CloudDocumentMediaResource) -> Signal<T, MTRpcError>) -> Signal<T, MTRpcError> {
guard let resource = file.media.resource as? CloudDocumentMediaResource else {
return .fail(MTRpcError(errorCode: 500, errorDescription: "Internal"))
}

View file

@ -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 {

View file

@ -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",

View file

@ -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 {

View file

@ -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() {

View file

@ -36,6 +36,8 @@ swift_library(
"//submodules/TelegramUI/Components/ChatControllerInteraction",
"//submodules/RadialStatusNode",
"//submodules/TelegramUI/Components/ComposePollScreen",
"//submodules/UndoUI",
"//submodules/TelegramStringFormatting",
],
visibility = [
"//visibility:public",

View file

@ -60,6 +60,8 @@ swift_library(
"//submodules/CounterControllerTitleView",
"//submodules/TelegramUI/Components/EdgeEffect",
"//submodules/ICloudResources",
"//submodules/CountrySelectionUI",
"//submodules/TelegramUI/Components/ShareWithPeersScreen",
],
visibility = [
"//visibility:public",

View file

@ -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<Int>()
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(

View file

@ -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",
],
)

View file

@ -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<Action<Void>>
let getController: () -> ViewController?
init(
context: AccountContext,
messageId: EngineMessage.Id,
animateOut: ActionSlot<Action<Void>>,
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<Action<Void>>
private let getController: () -> ViewController?
private let stateDisposable = MetaDisposable()
var stats: PollStats?
private var loadedVotesGraphToken: String?
init(
context: AccountContext,
messageId: EngineMessage.Id,
animateOut: ActionSlot<Action<Void>>,
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<EnvironmentType>.self)
let animateOut = StoredActionSlot(Action<Void>.self)
let sheetExternalState = SheetComponent<EnvironmentType>.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<EnvironmentType>(
content: AnyComponent<EnvironmentType>(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
}
}

View file

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "flag.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

View file

@ -0,0 +1,12 @@
{
"images" : [
{
"filename" : "shareshare.pdf",
"idiom" : "universal"
}
],
"info" : {
"author" : "xcode",
"version" : 1
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 12 KiB

View file

@ -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
}
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 7.7 KiB

View file

@ -2262,7 +2262,7 @@ extension ChatControllerImpl {
} else {
cachedData = .single((nil, [:]))
}
self.cachedDataDisposable?.dispose()
self.cachedDataDisposable = combineLatest(queue: .mainQueue(),
cachedData,

View file

@ -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 {

View file

@ -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<String>,
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<String?, NoError> = .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<EnginePeer.Id?, NoError>
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 {

View file

@ -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)
}
}

View file

@ -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<PresentationData, NoError>)?, 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))
}