mirror of
https://github.com/TelegramMessenger/Telegram-iOS.git
synced 2026-07-06 03:33:41 +02:00
Temp
This commit is contained in:
parent
a4e9b0468e
commit
0095bfad39
41 changed files with 12093 additions and 9819 deletions
|
|
@ -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:
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -376,7 +376,7 @@ 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: nil, 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
|
||||
|
|
|
|||
|
|
@ -127,6 +127,7 @@ final class AccountTaskManager {
|
|||
tasks.add(managedStarGiftsUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
|
||||
tasks.add(managedSavedMusicIdsUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network, accountPeerId: self.stateManager.accountPeerId).start())
|
||||
tasks.add(managedEmojiGameUpdates(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
|
||||
tasks.add(managedSynchronizeCloudAITextStyles(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
|
||||
|
||||
self.managedTopReactionsDisposable.set(managedTopReactions(postbox: self.stateManager.postbox, network: self.stateManager.network).start())
|
||||
|
||||
|
|
|
|||
|
|
@ -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! {
|
||||
|
|
|
|||
|
|
@ -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 {
|
||||
|
|
|
|||
|
|
@ -149,6 +149,7 @@ public struct Namespaces {
|
|||
public static let cachedChatThemes: Int8 = 50
|
||||
public static let cachedLiveStorySendAsPeers: Int8 = 51
|
||||
public static let cachedGiftUpgradesAttributes: Int8 = 52
|
||||
public static let cachedCloudAITextStyles: Int8 = 53
|
||||
}
|
||||
|
||||
public struct UnorderedItemList {
|
||||
|
|
|
|||
|
|
@ -245,7 +245,7 @@ func _internal_requestClosePoll(postbox: Postbox, network: Network, stateManager
|
|||
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: nil, hash: 0)), correctAnswers: correctAnswerss, 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)
|
||||
|
|
|
|||
|
|
@ -655,8 +655,12 @@ public extension TelegramEngine {
|
|||
}
|
||||
}
|
||||
|
||||
public func composeMessageWithAI(text: String, entities: [MessageTextEntity], proofread: Bool = false, translateToLang: String? = nil, changeTone: String? = nil, emojify: Bool = false) -> Signal<(String, [MessageTextEntity]), TranslationError> {
|
||||
return _internal_composeMessageWithAI(network: self.account.network, text: text, entities: entities, proofread: proofread, translateToLang: translateToLang, changeTone: changeTone, emojify: emojify)
|
||||
public func composeMessageWithAI(text: String, entities: [MessageTextEntity], proofread: Bool = false, translateToLang: String? = nil, changeStyle: TelegramComposeAIMessageMode.CloudStyle.Reference? = nil, emojify: Bool = false) -> Signal<(String, [MessageTextEntity]), TranslationError> {
|
||||
return _internal_composeMessageWithAI(account: self.account, text: text, entities: entities, proofread: proofread, translateToLang: translateToLang, changeStyle: changeStyle, emojify: emojify)
|
||||
}
|
||||
|
||||
public func createAITextStyle(displayAuthor: Bool, emojiFileId: Int64?, title: String, prompt: String) -> Signal<TelegramComposeAIMessageMode.CloudStyle, CreateAITextStyleError> {
|
||||
return _internal_createAITextStyle(account: self.account, displayAuthor: displayAuthor, emojiFileId: emojiFileId, title: title, prompt: prompt)
|
||||
}
|
||||
|
||||
public func translate(texts: [(String, [MessageTextEntity])], toLang: String, tone: TranslationTone = .neutral) -> Signal<[(String, [MessageTextEntity])], TranslationError> {
|
||||
|
|
@ -1788,8 +1792,11 @@ public extension TelegramEngine {
|
|||
|> ignoreValues
|
||||
}
|
||||
|
||||
public func composeAIMessageStyles() -> Signal<[TelegramComposeAIMessageMode.Style], NoError> {
|
||||
return _internal_composeAIMessageStyles(account: self.account)
|
||||
public func composeAIMessageStyles() -> Signal<[TelegramComposeAIMessageMode.CloudStyle], NoError> {
|
||||
return _internal_cachedCloudAITextStyles(postbox: self.account.postbox)
|
||||
|> map { value in
|
||||
return value?.items ?? []
|
||||
}
|
||||
}
|
||||
|
||||
public func composeAIMessage(text: TextWithEntities, mode: TelegramComposeAIMessageMode) -> Signal<TelegramAIComposeMessageResult, TelegramAIComposeMessageError> {
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ func _internal_translate(network: Network, text: String, toLang: String, entitie
|
|||
}
|
||||
}
|
||||
|
||||
func _internal_composeMessageWithAI(network: Network, text: String, entities: [MessageTextEntity], proofread: Bool = false, translateToLang: String? = nil, changeTone: String? = nil, emojify: Bool = false) -> Signal<(String, [MessageTextEntity]), TranslationError> {
|
||||
func _internal_composeMessageWithAI(account: Account, text: String, entities: [MessageTextEntity], proofread: Bool = false, translateToLang: String? = nil, changeStyle: TelegramComposeAIMessageMode.CloudStyle.Reference? = nil, emojify: Bool = false) -> Signal<(String, [MessageTextEntity]), TranslationError> {
|
||||
var flags: Int32 = 0
|
||||
if proofread {
|
||||
flags |= (1 << 0)
|
||||
|
|
@ -76,8 +76,11 @@ func _internal_composeMessageWithAI(network: Network, text: String, entities: [M
|
|||
if translateToLang != nil {
|
||||
flags |= (1 << 1)
|
||||
}
|
||||
if changeTone != nil {
|
||||
|
||||
var changeTone: Api.InputAiComposeTone?
|
||||
if let changeStyle {
|
||||
flags |= (1 << 2)
|
||||
changeTone = changeStyle.apiInputStyle
|
||||
}
|
||||
if emojify {
|
||||
flags |= (1 << 3)
|
||||
|
|
@ -85,7 +88,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 account.network.request(Api.functions.messages.composeMessageWithAI(flags: flags, text: apiText, translateToLang: translateToLang, tone: changeTone))
|
||||
|> mapError { error -> TranslationError in
|
||||
if error.errorDescription.hasPrefix("FLOOD_WAIT") {
|
||||
return .limitExceeded
|
||||
|
|
@ -409,32 +412,286 @@ func _internal_togglePeerMessagesTranslationHidden(account: Account, peerId: Eng
|
|||
}
|
||||
|
||||
public enum TelegramComposeAIMessageMode {
|
||||
public enum StyleId: Hashable {
|
||||
case neutral
|
||||
case style(String)
|
||||
}
|
||||
|
||||
public struct Style: Equatable {
|
||||
public let type: String
|
||||
public let title: String
|
||||
public let emojiFileId: Int64?
|
||||
public final class CloudStyle: Equatable, Codable {
|
||||
public enum Id: Hashable {
|
||||
case standard(String)
|
||||
case custom(Int64)
|
||||
}
|
||||
|
||||
public enum Reference: Hashable {
|
||||
case standard(String)
|
||||
case custom(id: Int64, accessHash: Int64)
|
||||
|
||||
public var id: Id {
|
||||
switch self {
|
||||
case let .standard(type):
|
||||
return .standard(type)
|
||||
case let .custom(id, _):
|
||||
return .custom(id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class Standard: Codable, Equatable {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case type
|
||||
case title
|
||||
case emojiFileId
|
||||
}
|
||||
|
||||
public let type: String
|
||||
public let title: String
|
||||
public let emojiFileId: Int64?
|
||||
|
||||
public init(type: String, title: String, emojiFileId: Int64?) {
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.emojiFileId = emojiFileId
|
||||
}
|
||||
|
||||
public init(from decoder: any Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
self.type = try container.decode(String.self, forKey: .type)
|
||||
self.title = try container.decode(String.self, forKey: .title)
|
||||
self.emojiFileId = try container.decodeIfPresent(Int64.self, forKey: .emojiFileId)
|
||||
}
|
||||
|
||||
public func encode(to encoder: any Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
try container.encode(self.type, forKey: .type)
|
||||
try container.encode(self.title, forKey: .title)
|
||||
try container.encodeIfPresent(self.emojiFileId, forKey: .emojiFileId)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Standard, rhs: Standard) -> Bool {
|
||||
if lhs.type != rhs.type {
|
||||
return false
|
||||
}
|
||||
if lhs.title != rhs.title {
|
||||
return false
|
||||
}
|
||||
if lhs.emojiFileId != rhs.emojiFileId {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public final class Custom: Codable, Equatable {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case isCreator
|
||||
case id
|
||||
case accessHash
|
||||
case slug
|
||||
case emojiFileId
|
||||
case title
|
||||
case prompt
|
||||
case userCount
|
||||
case authorId
|
||||
}
|
||||
|
||||
public let isCreator: Bool
|
||||
public let id: Int64
|
||||
public let accessHash: Int64
|
||||
public let slug: String
|
||||
public let emojiFileId: Int64?
|
||||
public let title: String
|
||||
public let prompt: String
|
||||
public let userCount: Int?
|
||||
public let authorId: EnginePeer.Id?
|
||||
|
||||
public init(isCreator: Bool, id: Int64, accessHash: Int64, slug: String, emojiFileId: Int64?, title: String, prompt: String, userCount: Int?, authorId: EnginePeer.Id?) {
|
||||
self.isCreator = isCreator
|
||||
self.id = id
|
||||
self.accessHash = accessHash
|
||||
self.slug = slug
|
||||
self.emojiFileId = emojiFileId
|
||||
self.title = title
|
||||
self.prompt = prompt
|
||||
self.userCount = userCount
|
||||
self.authorId = authorId
|
||||
}
|
||||
|
||||
public init(from decoder: any Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
self.isCreator = try container.decode(Bool.self, forKey: .isCreator)
|
||||
self.id = try container.decode(Int64.self, forKey: .id)
|
||||
self.accessHash = try container.decode(Int64.self, forKey: .accessHash)
|
||||
self.slug = try container.decode(String.self, forKey: .slug)
|
||||
self.emojiFileId = try container.decodeIfPresent(Int64.self, forKey: .emojiFileId)
|
||||
self.title = try container.decode(String.self, forKey: .title)
|
||||
self.prompt = try container.decode(String.self, forKey: .prompt)
|
||||
self.userCount = try container.decodeIfPresent(Int32.self, forKey: .userCount).flatMap(Int.init)
|
||||
self.authorId = try container.decodeIfPresent(EnginePeer.Id.self, forKey: .authorId)
|
||||
}
|
||||
|
||||
public func encode(to encoder: any Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
try container.encode(self.isCreator, forKey: .isCreator)
|
||||
try container.encode(self.id, forKey: .id)
|
||||
try container.encode(self.accessHash, forKey: .accessHash)
|
||||
try container.encode(self.slug, forKey: .slug)
|
||||
try container.encodeIfPresent(self.emojiFileId, forKey: .emojiFileId)
|
||||
try container.encode(self.title, forKey: .title)
|
||||
try container.encode(self.prompt, forKey: .prompt)
|
||||
try container.encodeIfPresent(self.userCount.flatMap(Int32.init(clamping:)), forKey: .userCount)
|
||||
try container.encodeIfPresent(self.authorId, forKey: .authorId)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Custom, rhs: Custom) -> Bool {
|
||||
if lhs.isCreator != rhs.isCreator {
|
||||
return false
|
||||
}
|
||||
if lhs.id != rhs.id {
|
||||
return false
|
||||
}
|
||||
if lhs.accessHash != rhs.accessHash {
|
||||
return false
|
||||
}
|
||||
if lhs.slug != rhs.slug {
|
||||
return false
|
||||
}
|
||||
if lhs.emojiFileId != rhs.emojiFileId {
|
||||
return false
|
||||
}
|
||||
if lhs.title != rhs.title {
|
||||
return false
|
||||
}
|
||||
if lhs.prompt != rhs.prompt {
|
||||
return false
|
||||
}
|
||||
if lhs.userCount != rhs.userCount {
|
||||
return false
|
||||
}
|
||||
if lhs.authorId != rhs.authorId {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
public enum Content: Equatable, Codable {
|
||||
private enum CodingKeys: String, CodingKey {
|
||||
case standard = "s"
|
||||
case custom = "c"
|
||||
}
|
||||
|
||||
case standard(Standard)
|
||||
case custom(Custom)
|
||||
|
||||
public init(from decoder: any Decoder) throws {
|
||||
let container = try decoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
if let standard = try? container.decode(Standard.self, forKey: .standard) {
|
||||
self = .standard(standard)
|
||||
} else if let custom = try? container.decode(Custom.self, forKey: .custom) {
|
||||
self = .custom(custom)
|
||||
} else {
|
||||
throw DecodingError.dataCorrupted(DecodingError.Context(codingPath: [], debugDescription: ""))
|
||||
}
|
||||
}
|
||||
|
||||
public func encode(to encoder: any Encoder) throws {
|
||||
var container = encoder.container(keyedBy: CodingKeys.self)
|
||||
|
||||
switch self {
|
||||
case let .standard(standard):
|
||||
try container.encode(standard, forKey: .standard)
|
||||
case let .custom(custom):
|
||||
try container.encode(custom, forKey: .custom)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public let content: Content
|
||||
|
||||
public var id: StyleId {
|
||||
return .style(self.type)
|
||||
switch self.content {
|
||||
case let .standard(standard):
|
||||
return .style(.standard(standard.type))
|
||||
case let .custom(custom):
|
||||
return .style(.custom(custom.id))
|
||||
}
|
||||
}
|
||||
|
||||
public init(type: String, title: String, emojiFileId: Int64?) {
|
||||
self.type = type
|
||||
self.title = title
|
||||
self.emojiFileId = emojiFileId
|
||||
public var reference: Reference {
|
||||
switch self.content {
|
||||
case let .standard(standard):
|
||||
return .standard(standard.type)
|
||||
case let .custom(custom):
|
||||
return .custom(id: custom.id, accessHash: custom.accessHash)
|
||||
}
|
||||
}
|
||||
|
||||
public init(content: Content) {
|
||||
self.content = content
|
||||
}
|
||||
|
||||
public static func ==(lhs: CloudStyle, rhs: CloudStyle) -> Bool {
|
||||
if lhs.content != rhs.content {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
case translate(toLanguage: String, emojify: Bool, style: StyleId)
|
||||
case stylize(emojify: Bool, style: StyleId)
|
||||
public enum StyleId: Hashable {
|
||||
case neutral
|
||||
case style(CloudStyle.Id)
|
||||
}
|
||||
|
||||
public enum StyleReference: Hashable {
|
||||
case neutral
|
||||
case style(CloudStyle.Reference)
|
||||
|
||||
public var id: StyleId {
|
||||
switch self {
|
||||
case .neutral:
|
||||
return .neutral
|
||||
case let .style(style):
|
||||
return .style(style.id)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
case translate(toLanguage: String, emojify: Bool, style: StyleReference)
|
||||
case stylize(emojify: Bool, style: StyleReference)
|
||||
case proofread
|
||||
}
|
||||
|
||||
extension TelegramComposeAIMessageMode.CloudStyle {
|
||||
convenience init(apiTone: Api.AiComposeTone) {
|
||||
/*
|
||||
aiComposeTone#12ea1465 flags:# creator:flags.0?true id:long access_hash:long slug:string title:string emoji_id:flags.1?long prompt:string installs_count:flags.2?int author_id:flags.3?long = AiComposeTone;
|
||||
aiComposeToneDefault#9bad6414 tone:string emoji_id:long title:string = AiComposeTone;
|
||||
*/
|
||||
switch apiTone {
|
||||
case let .aiComposeTone(aiComposeTone):
|
||||
self.init(content: .custom(Custom(
|
||||
isCreator: (aiComposeTone.flags & (1 << 0)) != 0,
|
||||
id: aiComposeTone.id,
|
||||
accessHash: aiComposeTone.accessHash,
|
||||
slug: aiComposeTone.slug,
|
||||
emojiFileId: aiComposeTone.emojiId,
|
||||
title: aiComposeTone.title,
|
||||
prompt: aiComposeTone.prompt,
|
||||
userCount: aiComposeTone.installsCount.flatMap(Int.init),
|
||||
authorId: aiComposeTone.authorId.flatMap { id -> EnginePeer.Id in
|
||||
return EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: PeerId.Id._internalFromInt64Value(id))
|
||||
}
|
||||
)))
|
||||
case let .aiComposeToneDefault(aiComposeToneDefault):
|
||||
self.init(content: .standard(Standard(
|
||||
type: aiComposeToneDefault.tone,
|
||||
title: aiComposeToneDefault.title,
|
||||
emojiFileId: aiComposeToneDefault.emojiId
|
||||
)))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public final class TelegramAIComposeMessageResult {
|
||||
public let text: TextWithEntities
|
||||
public let diffRanges: [Range<Int>]
|
||||
|
|
@ -454,23 +711,14 @@ extension TextWithEntities {
|
|||
}
|
||||
}
|
||||
|
||||
func _internal_composeAIMessageStyles(account: Account) -> Signal<[TelegramComposeAIMessageMode.Style], NoError> {
|
||||
return account.postbox.transaction { transaction -> [TelegramComposeAIMessageMode.Style] in
|
||||
var result: [TelegramComposeAIMessageMode.Style] = []
|
||||
if let data = currentAppConfiguration(transaction: transaction).data, let value = data["ai_compose_styles"] as? [[String]] {
|
||||
for item in value {
|
||||
if item.count >= 3 {
|
||||
let emojiFileId: Int64? = Int64(item[1])
|
||||
result.append(TelegramComposeAIMessageMode.Style(type: item[0], title: item[2], emojiFileId: emojiFileId))
|
||||
}
|
||||
}
|
||||
extension TelegramComposeAIMessageMode.CloudStyle.Reference {
|
||||
var apiInputStyle: Api.InputAiComposeTone {
|
||||
switch self {
|
||||
case let .standard(type):
|
||||
return .inputAiComposeToneDefault(Api.InputAiComposeTone.Cons_inputAiComposeToneDefault(tone: type))
|
||||
case let .custom(id, accessHash):
|
||||
return .inputAiComposeToneID(Api.InputAiComposeTone.Cons_inputAiComposeToneID(id: id, accessHash: accessHash))
|
||||
}
|
||||
#if DEBUG && false
|
||||
for item in Array(result) {
|
||||
result.append(TelegramComposeAIMessageMode.Style(name: item.name + "_", emoji: item.emoji))
|
||||
}
|
||||
#endif
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -482,7 +730,7 @@ public enum TelegramAIComposeMessageError {
|
|||
func _internal_composeAIMessage(account: Account, text: TextWithEntities, mode: TelegramComposeAIMessageMode) -> Signal<TelegramAIComposeMessageResult, TelegramAIComposeMessageError> {
|
||||
var flags: Int32 = 0
|
||||
var translateToLang: String?
|
||||
var changeTone: String?
|
||||
var changeTone: Api.InputAiComposeTone?
|
||||
switch mode {
|
||||
case let .translate(toLanguage, emojify, style):
|
||||
translateToLang = toLanguage
|
||||
|
|
@ -492,8 +740,8 @@ func _internal_composeAIMessage(account: Account, text: TextWithEntities, mode:
|
|||
flags |= (1 << 3)
|
||||
}
|
||||
|
||||
if case let .style(name) = style {
|
||||
changeTone = name
|
||||
if case let .style(reference) = style {
|
||||
changeTone = reference.apiInputStyle
|
||||
flags |= (1 << 2)
|
||||
}
|
||||
case let .stylize(emojify, style):
|
||||
|
|
@ -501,8 +749,8 @@ func _internal_composeAIMessage(account: Account, text: TextWithEntities, mode:
|
|||
flags |= (1 << 3)
|
||||
}
|
||||
|
||||
if case let .style(name) = style {
|
||||
changeTone = name
|
||||
if case let .style(reference) = style {
|
||||
changeTone = reference.apiInputStyle
|
||||
flags |= (1 << 2)
|
||||
}
|
||||
case .proofread:
|
||||
|
|
@ -511,7 +759,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))
|
||||
|> `catch` { error -> Signal<Api.messages.ComposedMessageWithAI, TelegramAIComposeMessageError> in
|
||||
if error.errorDescription == "AICOMPOSE_FLOOD_PREMIUM" {
|
||||
return .fail(.nonPremiumFlood)
|
||||
|
|
@ -549,3 +797,121 @@ func _internal_composeAIMessage(account: Account, text: TextWithEntities, mode:
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
public enum CreateAITextStyleError {
|
||||
case generic
|
||||
}
|
||||
|
||||
func _internal_createAITextStyle(account: Account, displayAuthor: Bool, emojiFileId: Int64?, title: String, prompt: String) -> Signal<TelegramComposeAIMessageMode.CloudStyle, CreateAITextStyleError> {
|
||||
var flags: Int32 = 0
|
||||
if displayAuthor {
|
||||
flags |= (1 << 0)
|
||||
}
|
||||
if emojiFileId != nil {
|
||||
flags |= (1 << 1)
|
||||
}
|
||||
return account.network.request(Api.functions.aicompose.createTone(
|
||||
flags: flags,
|
||||
emojiId: emojiFileId,
|
||||
title: title,
|
||||
prompt: prompt
|
||||
))
|
||||
|> mapError { _ -> CreateAITextStyleError in
|
||||
return .generic
|
||||
}
|
||||
|> mapToSignal { result -> Signal<TelegramComposeAIMessageMode.CloudStyle, CreateAITextStyleError> in
|
||||
return account.postbox.transaction { transaction -> TelegramComposeAIMessageMode.CloudStyle in
|
||||
let style = TelegramComposeAIMessageMode.CloudStyle(apiTone: result)
|
||||
|
||||
let styles = _internal_cachedCloudAITextStyles(transaction: transaction)
|
||||
var items = styles?.items ?? []
|
||||
items.append(style)
|
||||
_internal_setCachedCloudAITextStyles(transaction: transaction, styles: CachedCloudAITextStyles(items: items, hash: 0))
|
||||
return style
|
||||
}
|
||||
|> castError(CreateAITextStyleError.self)
|
||||
}
|
||||
}
|
||||
|
||||
final class CachedCloudAITextStyles: Codable {
|
||||
let items: [TelegramComposeAIMessageMode.CloudStyle]
|
||||
let hash: Int64
|
||||
|
||||
init(items: [TelegramComposeAIMessageMode.CloudStyle], hash: Int64) {
|
||||
self.items = items
|
||||
self.hash = hash
|
||||
}
|
||||
}
|
||||
|
||||
func _internal_cachedCloudAITextStyles(postbox: Postbox) -> Signal<CachedCloudAITextStyles?, NoError> {
|
||||
return postbox.transaction { transaction -> CachedCloudAITextStyles? in
|
||||
return _internal_cachedCloudAITextStyles(transaction: transaction)
|
||||
}
|
||||
}
|
||||
|
||||
func _internal_cachedCloudAITextStyles(transaction: Transaction) -> CachedCloudAITextStyles? {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
key.setInt64(0, value: 0)
|
||||
|
||||
let cached = transaction.retrieveItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedCloudAITextStyles, key: key))?.get(CachedCloudAITextStyles.self)
|
||||
if let cached {
|
||||
return cached
|
||||
} else {
|
||||
return nil
|
||||
}
|
||||
}
|
||||
|
||||
func _internal_setCachedCloudAITextStyles(transaction: Transaction, styles: CachedCloudAITextStyles) {
|
||||
let key = ValueBoxKey(length: 8)
|
||||
key.setInt64(0, value: 0)
|
||||
|
||||
if let entry = CodableEntry(styles) {
|
||||
transaction.putItemCacheEntry(id: ItemCacheEntryId(collectionId: Namespaces.CachedItemCollection.cachedCloudAITextStyles, key: key), entry: entry)
|
||||
}
|
||||
}
|
||||
|
||||
func managedSynchronizeCloudAITextStyles(postbox: Postbox, network: Network) -> Signal<Never, NoError> {
|
||||
let poll = Signal<Never, NoError> { subscriber in
|
||||
let signal: Signal<Never, NoError> = _internal_cachedCloudAITextStyles(postbox: postbox)
|
||||
|> mapToSignal { current in
|
||||
return (network.request(Api.functions.aicompose.getTones(hash: current?.hash ?? 0))
|
||||
|> map(Optional.init)
|
||||
|> `catch` { _ -> Signal<Api.aicompose.Tones?, NoError> in
|
||||
return .single(nil)
|
||||
}
|
||||
|> mapToSignal { result -> Signal<Never, NoError> in
|
||||
return postbox.transaction { transaction -> Signal<Never, NoError> in
|
||||
guard let result = result else {
|
||||
return .complete()
|
||||
}
|
||||
|
||||
switch result {
|
||||
case let .tones(tones):
|
||||
_internal_setCachedCloudAITextStyles(transaction: transaction, styles: CachedCloudAITextStyles(
|
||||
items: tones.tones.map(TelegramComposeAIMessageMode.CloudStyle.init(apiTone:)),
|
||||
hash: tones.hash
|
||||
))
|
||||
case .tonesNotModified:
|
||||
break
|
||||
}
|
||||
|
||||
return .complete()
|
||||
}
|
||||
|> switchToLatest
|
||||
})
|
||||
}
|
||||
|
||||
return signal.start(completed: {
|
||||
subscriber.putCompletion()
|
||||
})
|
||||
}
|
||||
|
||||
return (
|
||||
poll
|
||||
|> then(
|
||||
.complete()
|
||||
|> suspendAwareDelay(1.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue())
|
||||
)
|
||||
)
|
||||
|> restart
|
||||
}
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ swift_library(
|
|||
"//submodules/TelegramUI/Components/ToastComponent",
|
||||
"//submodules/TelegramUI/Components/InteractiveTextComponent",
|
||||
"//submodules/TelegramUI/Components/EmojiStatusComponent",
|
||||
"//submodules/TelegramUI/Components/ListMultilineTextFieldItemComponent",
|
||||
"//submodules/TelegramNotices",
|
||||
"//submodules/Markdown",
|
||||
"//submodules/TelegramUIPreferences",
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ final class TextProcessingLanguageSelectionComponent: Component {
|
|||
let selectedLanguageCode: String
|
||||
let currentStyle: TelegramComposeAIMessageMode.StyleId
|
||||
let displayStyles: [TextProcessingScreen.Style]?
|
||||
let completion: (String, TelegramComposeAIMessageMode.StyleId) -> Void
|
||||
let completion: (String, TelegramComposeAIMessageMode.StyleReference) -> Void
|
||||
let dismissed: () -> Void
|
||||
let inputHeight: CGFloat
|
||||
|
||||
|
|
@ -45,7 +45,7 @@ final class TextProcessingLanguageSelectionComponent: Component {
|
|||
selectedLanguageCode: String,
|
||||
currentStyle: TelegramComposeAIMessageMode.StyleId,
|
||||
displayStyles: [TextProcessingScreen.Style]?,
|
||||
completion: @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void,
|
||||
completion: @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void,
|
||||
dismissed: @escaping () -> Void,
|
||||
inputHeight: CGFloat
|
||||
) {
|
||||
|
|
@ -271,7 +271,18 @@ final class TextProcessingLanguageSelectionComponent: Component {
|
|||
}
|
||||
if case .ended = recognizer.state {
|
||||
if component.displayStyles != nil, let updatedStyle = self.updatedStyle {
|
||||
component.completion(component.selectedLanguageCode, updatedStyle)
|
||||
let mappedStyle: TelegramComposeAIMessageMode.StyleReference
|
||||
switch updatedStyle {
|
||||
case .neutral:
|
||||
mappedStyle = .neutral
|
||||
case let .style(style):
|
||||
if let styleValue = component.displayStyles?.first(where: { $0.reference.id == style }) {
|
||||
mappedStyle = .style(styleValue.reference)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
component.completion(component.selectedLanguageCode, mappedStyle)
|
||||
}
|
||||
self.animateOut()
|
||||
}
|
||||
|
|
@ -298,7 +309,19 @@ final class TextProcessingLanguageSelectionComponent: Component {
|
|||
return
|
||||
}
|
||||
if self.updatedLanguage != nil || self.updatedStyle != nil {
|
||||
component.completion(self.updatedLanguage ?? component.selectedLanguageCode, self.updatedStyle ?? component.currentStyle)
|
||||
let styleId = self.updatedStyle ?? component.currentStyle
|
||||
let mappedStyle: TelegramComposeAIMessageMode.StyleReference
|
||||
switch styleId {
|
||||
case .neutral:
|
||||
mappedStyle = .neutral
|
||||
case let .style(style):
|
||||
if let styleValue = component.displayStyles?.first(where: { $0.reference.id == style }) {
|
||||
mappedStyle = .style(styleValue.reference)
|
||||
} else {
|
||||
return
|
||||
}
|
||||
}
|
||||
component.completion(self.updatedLanguage ?? component.selectedLanguageCode, mappedStyle)
|
||||
}
|
||||
self.animateOut()
|
||||
}
|
||||
|
|
@ -469,7 +492,7 @@ final class TextProcessingLanguageSelectionComponent: Component {
|
|||
var styleData: [(id: TelegramComposeAIMessageMode.StyleId, iconFileId: Int64?, iconFile: TelegramMediaFile?, title: String)] = []
|
||||
styleData.append((.neutral, nil, nil, component.strings.TextProcessingStyle_Neutral))
|
||||
for item in displayStyles {
|
||||
styleData.append((item.id, item.emojiFileId, item.emojiFile, item.title))
|
||||
styleData.append((.style(item.reference.id), item.emojiFileId, item.emojiFile, item.title))
|
||||
}
|
||||
|
||||
let stylesItemSize = CGSize(width: 82.0, height: 60.0)
|
||||
|
|
|
|||
|
|
@ -47,7 +47,8 @@ final class TextProcessingContentComponent: Component {
|
|||
let shouldDisplayStyleNotice: Bool
|
||||
let copyCurrentResult: (() -> Void)?
|
||||
let translateChat: ((String) -> Void)?
|
||||
let displayLanguageSelectionMenu: (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void) -> Void
|
||||
let displayLanguageSelectionMenu: (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void) -> Void
|
||||
let newStyleAdded: (TelegramComposeAIMessageMode.CloudStyle) -> Void
|
||||
|
||||
init(
|
||||
externalState: ExternalState,
|
||||
|
|
@ -60,7 +61,8 @@ final class TextProcessingContentComponent: Component {
|
|||
shouldDisplayStyleNotice: Bool,
|
||||
copyCurrentResult: (() -> Void)?,
|
||||
translateChat: ((String) -> Void)?,
|
||||
displayLanguageSelectionMenu: @escaping (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void) -> Void
|
||||
displayLanguageSelectionMenu: @escaping (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void) -> Void,
|
||||
newStyleAdded: @escaping (TelegramComposeAIMessageMode.CloudStyle) -> Void
|
||||
) {
|
||||
self.externalState = externalState
|
||||
self.styles = styles
|
||||
|
|
@ -73,9 +75,13 @@ final class TextProcessingContentComponent: Component {
|
|||
self.copyCurrentResult = copyCurrentResult
|
||||
self.translateChat = translateChat
|
||||
self.displayLanguageSelectionMenu = displayLanguageSelectionMenu
|
||||
self.newStyleAdded = newStyleAdded
|
||||
}
|
||||
|
||||
static func ==(lhs: TextProcessingContentComponent, rhs: TextProcessingContentComponent) -> Bool {
|
||||
if lhs.styles != rhs.styles {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
|
|
@ -357,6 +363,8 @@ final class TextProcessingContentComponent: Component {
|
|||
mode: .translate(ignoredLanguages: component.ignoredTranslationLanguages),
|
||||
copyAction: component.copyCurrentResult,
|
||||
displayLanguageSelectionMenu: component.displayLanguageSelectionMenu,
|
||||
createStyle: {},
|
||||
editStyle: { _ in },
|
||||
present: { [weak self] c, a in
|
||||
self?.environment?.controller()?.present(c, in: .window(.root), with: a)
|
||||
},
|
||||
|
|
@ -375,6 +383,23 @@ final class TextProcessingContentComponent: Component {
|
|||
mode: .stylize,
|
||||
copyAction: component.copyCurrentResult,
|
||||
displayLanguageSelectionMenu: component.displayLanguageSelectionMenu,
|
||||
createStyle: { [weak self] in
|
||||
guard let self, let component = self.component, let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
environment.controller()?.push(TextStyleEditScreen(
|
||||
context: component.context,
|
||||
initialText: nil,
|
||||
completion: { [weak self] style in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.newStyleAdded(style)
|
||||
}
|
||||
))
|
||||
},
|
||||
editStyle: { _ in
|
||||
},
|
||||
present: { [weak self] c, a in
|
||||
self?.environment?.controller()?.present(c, in: .window(.root), with: a)
|
||||
},
|
||||
|
|
@ -393,6 +418,8 @@ final class TextProcessingContentComponent: Component {
|
|||
mode: .fix,
|
||||
copyAction: component.copyCurrentResult,
|
||||
displayLanguageSelectionMenu: component.displayLanguageSelectionMenu,
|
||||
createStyle: {},
|
||||
editStyle: { _ in },
|
||||
present: { [weak self] c, a in
|
||||
self?.environment?.controller()?.present(c, in: .window(.root), with: a)
|
||||
},
|
||||
|
|
@ -531,7 +558,7 @@ private final class TextProcessingSheetComponent: Component {
|
|||
let context: AccountContext
|
||||
let mode: TextProcessingScreen.Mode
|
||||
let ignoredTranslationLanguages: [String]
|
||||
let styles: [TextProcessingScreen.Style]
|
||||
let initialStyles: [TextProcessingScreen.Style]
|
||||
let inputText: TextWithEntities
|
||||
let initialEditState: TextProcessingScreen.EditState?
|
||||
let shouldDisplayStyleNotice: Bool
|
||||
|
|
@ -542,7 +569,7 @@ private final class TextProcessingSheetComponent: Component {
|
|||
context: AccountContext,
|
||||
mode: TextProcessingScreen.Mode,
|
||||
ignoredTranslationLanguages: [String],
|
||||
styles: [TextProcessingScreen.Style],
|
||||
initialStyles: [TextProcessingScreen.Style],
|
||||
inputText: TextWithEntities,
|
||||
initialEditState: TextProcessingScreen.EditState?,
|
||||
shouldDisplayStyleNotice: Bool,
|
||||
|
|
@ -552,7 +579,7 @@ private final class TextProcessingSheetComponent: Component {
|
|||
self.context = context
|
||||
self.mode = mode
|
||||
self.ignoredTranslationLanguages = ignoredTranslationLanguages
|
||||
self.styles = styles
|
||||
self.initialStyles = initialStyles
|
||||
self.inputText = inputText
|
||||
self.initialEditState = initialEditState
|
||||
self.shouldDisplayStyleNotice = shouldDisplayStyleNotice
|
||||
|
|
@ -570,15 +597,17 @@ private final class TextProcessingSheetComponent: Component {
|
|||
private var languageSelectionMenu: ComponentView<Empty>?
|
||||
private let animateOut = ActionSlot<Action<Void>>()
|
||||
private let contentExternalState = TextProcessingContentComponent.ExternalState()
|
||||
|
||||
private var styles: [TextProcessingScreen.Style] = []
|
||||
|
||||
private final class LanguageSelectionMenuData {
|
||||
let sourceView: UIView
|
||||
let currentLanguage: String
|
||||
let currentStyle: TelegramComposeAIMessageMode.StyleId
|
||||
let displayStyle: Bool
|
||||
let completion: (String, TelegramComposeAIMessageMode.StyleId) -> Void
|
||||
let completion: (String, TelegramComposeAIMessageMode.StyleReference) -> Void
|
||||
|
||||
init(sourceView: UIView, currentLanguage: String, currentStyle: TelegramComposeAIMessageMode.StyleId, displayStyle: Bool, completion: @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void) {
|
||||
init(sourceView: UIView, currentLanguage: String, currentStyle: TelegramComposeAIMessageMode.StyleId, displayStyle: Bool, completion: @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void) {
|
||||
self.sourceView = sourceView
|
||||
self.currentLanguage = currentLanguage
|
||||
self.currentStyle = currentStyle
|
||||
|
|
@ -717,6 +746,10 @@ private final class TextProcessingSheetComponent: Component {
|
|||
}
|
||||
|
||||
func update(component: TextProcessingSheetComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<ViewControllerComponentContainer.Environment>, transition: ComponentTransition) -> CGSize {
|
||||
if self.component == nil {
|
||||
self.styles = component.initialStyles
|
||||
}
|
||||
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
|
|
@ -816,7 +849,7 @@ private final class TextProcessingSheetComponent: Component {
|
|||
externalState: self.contentExternalState,
|
||||
context: component.context,
|
||||
mode: component.mode,
|
||||
styles: component.styles,
|
||||
styles: self.styles,
|
||||
inputText: component.inputText,
|
||||
initialEditState: component.initialEditState,
|
||||
ignoredTranslationLanguages: component.ignoredTranslationLanguages,
|
||||
|
|
@ -831,9 +864,18 @@ private final class TextProcessingSheetComponent: Component {
|
|||
}
|
||||
},
|
||||
displayLanguageSelectionMenu: { [weak self] sourceView, currentLanguage, currentStyle, displayStyle, completion in
|
||||
guard let self else { return }
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.languageSelectionMenuData = LanguageSelectionMenuData(sourceView: sourceView, currentLanguage: currentLanguage, currentStyle: currentStyle, displayStyle: displayStyle, completion: completion)
|
||||
self.state?.updated(transition: .immediate)
|
||||
},
|
||||
newStyleAdded: { [weak self] style in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.styles.append(TextProcessingScreen.Style(cloudStyle: style))
|
||||
self.state?.updated(transition: .immediate)
|
||||
}
|
||||
)),
|
||||
titleItem: AnyComponent(TitleComponent(
|
||||
|
|
@ -1017,10 +1059,12 @@ private final class TextProcessingSheetComponent: Component {
|
|||
topLanguages: [],
|
||||
selectedLanguageCode: languageSelectionMenuDataValue.currentLanguage,
|
||||
currentStyle: languageSelectionMenuDataValue.currentStyle,
|
||||
displayStyles: languageSelectionMenuDataValue.displayStyle ? component.styles : nil,
|
||||
displayStyles: languageSelectionMenuDataValue.displayStyle ? self.styles : nil,
|
||||
completion: languageSelectionMenuDataValue.completion,
|
||||
dismissed: { [weak self] in
|
||||
guard let self else { return }
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.languageSelectionMenuData = nil
|
||||
self.state?.updated(transition: .immediate)
|
||||
},
|
||||
|
|
@ -1067,22 +1111,57 @@ public class TextProcessingScreen: ViewControllerComponentContainer {
|
|||
}
|
||||
}
|
||||
|
||||
public struct Style: Equatable {
|
||||
public let type: String
|
||||
public final class Style: Equatable {
|
||||
public let reference: TelegramComposeAIMessageMode.CloudStyle.Reference
|
||||
public let title: String
|
||||
public let emojiFileId: Int64?
|
||||
public let emojiFile: TelegramMediaFile?
|
||||
|
||||
public var id: TelegramComposeAIMessageMode.StyleId {
|
||||
return .style(self.type)
|
||||
public var id: TelegramComposeAIMessageMode.StyleReference {
|
||||
return .style(self.reference)
|
||||
}
|
||||
|
||||
public init(type: String, title: String, emojiFileId: Int64?, emojiFile: TelegramMediaFile?) {
|
||||
self.type = type
|
||||
public init(reference: TelegramComposeAIMessageMode.CloudStyle.Reference, title: String, emojiFileId: Int64?, emojiFile: TelegramMediaFile?) {
|
||||
self.reference = reference
|
||||
self.title = title
|
||||
self.emojiFileId = emojiFileId
|
||||
self.emojiFile = emojiFile
|
||||
}
|
||||
|
||||
convenience init(cloudStyle: TelegramComposeAIMessageMode.CloudStyle) {
|
||||
let title: String
|
||||
let emojiFileId: Int64?
|
||||
switch cloudStyle.content {
|
||||
case let .standard(standard):
|
||||
title = standard.title
|
||||
emojiFileId = standard.emojiFileId
|
||||
case let .custom(custom):
|
||||
title = custom.title
|
||||
emojiFileId = custom.emojiFileId
|
||||
}
|
||||
self.init(
|
||||
reference: cloudStyle.reference,
|
||||
title: title,
|
||||
emojiFileId: emojiFileId,
|
||||
emojiFile: nil
|
||||
)
|
||||
}
|
||||
|
||||
public static func ==(lhs: Style, rhs: Style) -> Bool {
|
||||
if lhs.reference != rhs.reference {
|
||||
return false
|
||||
}
|
||||
if lhs.title != rhs.title {
|
||||
return false
|
||||
}
|
||||
if lhs.emojiFileId != rhs.emojiFileId {
|
||||
return false
|
||||
}
|
||||
if lhs.emojiFile != rhs.emojiFile {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
private let context: AccountContext
|
||||
|
|
@ -1099,13 +1178,30 @@ public class TextProcessingScreen: ViewControllerComponentContainer {
|
|||
|
||||
let rawStyles = await context.engine.messages.composeAIMessageStyles().get()
|
||||
var styles: [Style] = []
|
||||
let resolvedEmojiFiles: [Int64: TelegramMediaFile] = await context.engine.stickers.resolveInlineStickersLocal(fileIds: Array(Set(rawStyles.compactMap({ $0.emojiFileId })))).get()
|
||||
let resolvedEmojiFiles: [Int64: TelegramMediaFile] = await context.engine.stickers.resolveInlineStickersLocal(fileIds: Array(Set(rawStyles.compactMap({ style in
|
||||
switch style.content {
|
||||
case let .standard(standard):
|
||||
return standard.emojiFileId
|
||||
case let .custom(custom):
|
||||
return custom.emojiFileId
|
||||
}
|
||||
})))).get()
|
||||
for value in rawStyles {
|
||||
let title: String
|
||||
let emojiFileId: Int64?
|
||||
switch value.content {
|
||||
case let .standard(standard):
|
||||
title = standard.title
|
||||
emojiFileId = standard.emojiFileId
|
||||
case let .custom(custom):
|
||||
title = custom.title
|
||||
emojiFileId = custom.emojiFileId
|
||||
}
|
||||
styles.append(Style(
|
||||
type: value.type,
|
||||
title: value.title,
|
||||
emojiFileId: value.emojiFileId,
|
||||
emojiFile: value.emojiFileId.flatMap { resolvedEmojiFiles[$0] }
|
||||
reference: value.reference,
|
||||
title: title,
|
||||
emojiFileId: emojiFileId,
|
||||
emojiFile: emojiFileId.flatMap { resolvedEmojiFiles[$0] }
|
||||
))
|
||||
}
|
||||
|
||||
|
|
@ -1132,7 +1228,7 @@ public class TextProcessingScreen: ViewControllerComponentContainer {
|
|||
context: context,
|
||||
mode: mode,
|
||||
ignoredTranslationLanguages: translationSettings.ignoredLanguages ?? [],
|
||||
styles: styles,
|
||||
initialStyles: styles,
|
||||
inputText: inputText,
|
||||
initialEditState: initialEditState,
|
||||
shouldDisplayStyleNotice: shouldDisplayStyleNotice,
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import MultilineTextComponent
|
|||
import TelegramCore
|
||||
import EmojiStatusComponent
|
||||
import AccountContext
|
||||
import BundleIconComponent
|
||||
|
||||
final class TextProcessingStyleSelectionComponent: Component {
|
||||
let context: AccountContext
|
||||
|
|
@ -14,7 +15,9 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
let strings: PresentationStrings
|
||||
let styles: [TextProcessingScreen.Style]
|
||||
let selectedStyle: TelegramComposeAIMessageMode.StyleId
|
||||
let updateStyle: (TelegramComposeAIMessageMode.StyleId) -> Void
|
||||
let updateStyle: (TelegramComposeAIMessageMode.StyleReference) -> Void
|
||||
let createStyle: () -> Void
|
||||
let editStyle: (TelegramComposeAIMessageMode.CloudStyle.Id) -> Void
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
|
|
@ -22,7 +25,9 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
strings: PresentationStrings,
|
||||
styles: [TextProcessingScreen.Style],
|
||||
selectedStyle: TelegramComposeAIMessageMode.StyleId,
|
||||
updateStyle: @escaping (TelegramComposeAIMessageMode.StyleId) -> Void
|
||||
updateStyle: @escaping (TelegramComposeAIMessageMode.StyleReference) -> Void,
|
||||
createStyle: @escaping () -> Void,
|
||||
editStyle: @escaping (TelegramComposeAIMessageMode.CloudStyle.Id) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.theme = theme
|
||||
|
|
@ -30,6 +35,8 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
self.styles = styles
|
||||
self.selectedStyle = selectedStyle
|
||||
self.updateStyle = updateStyle
|
||||
self.createStyle = createStyle
|
||||
self.editStyle = editStyle
|
||||
}
|
||||
|
||||
static func ==(lhs: TextProcessingStyleSelectionComponent, rhs: TextProcessingStyleSelectionComponent) -> Bool {
|
||||
|
|
@ -61,6 +68,7 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
|
||||
private let scrollView: ScrollView
|
||||
private var itemViews: [TelegramComposeAIMessageMode.StyleId: ComponentView<Empty>] = [:]
|
||||
private let createStyleItemView = ComponentView<Empty>()
|
||||
private let selectedBackgroundView: UIImageView
|
||||
|
||||
override init(frame: CGRect) {
|
||||
|
|
@ -103,13 +111,20 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
if component.selectedStyle == id {
|
||||
component.updateStyle(.neutral)
|
||||
} else {
|
||||
component.updateStyle(id)
|
||||
if let style = component.styles.first(where: { .style($0.reference.id) == id }) {
|
||||
component.updateStyle(.style(style.reference))
|
||||
}
|
||||
}
|
||||
self.scrollView.scrollRectToVisible(itemComponentView.frame.insetBy(dx: -100.0, dy: 0.0), animated: true)
|
||||
break
|
||||
}
|
||||
}
|
||||
}
|
||||
if let itemComponentView = self.createStyleItemView.view {
|
||||
if itemComponentView.bounds.contains(self.scrollView.convert(recognizer.location(in: self.scrollView), to: itemComponentView)) {
|
||||
component.createStyle()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,12 +150,12 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
let style = component.styles[i]
|
||||
let itemView: ComponentView<Empty>
|
||||
var itemTransition = transition
|
||||
if let current = self.itemViews[style.id] {
|
||||
if let current = self.itemViews[.style(style.reference.id)] {
|
||||
itemView = current
|
||||
} else {
|
||||
itemTransition = itemTransition.withAnimation(.none)
|
||||
itemView = ComponentView()
|
||||
self.itemViews[style.id] = itemView
|
||||
self.itemViews[.style(style.reference.id)] = itemView
|
||||
}
|
||||
let measuredSize = itemView.update(
|
||||
transition: itemTransition,
|
||||
|
|
@ -154,18 +169,30 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
environment: {},
|
||||
containerSize: CGSize(width: maxItemWidth, height: availableSize.height)
|
||||
)
|
||||
itemSizes[style.id] = measuredSize
|
||||
itemSizes[.style(style.reference.id)] = measuredSize
|
||||
}
|
||||
|
||||
let createStyleItemSize: CGSize = self.createStyleItemView.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(CreateItemComponent(
|
||||
theme: component.theme,
|
||||
strings: component.strings
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: maxItemWidth, height: availableSize.height)
|
||||
)
|
||||
|
||||
// Compute uniform slot width from largest item
|
||||
var largestItemWidth: CGFloat = 0.0
|
||||
for (_, size) in itemSizes {
|
||||
largestItemWidth = max(largestItemWidth, size.width)
|
||||
}
|
||||
largestItemWidth = max(largestItemWidth, createStyleItemSize.width)
|
||||
|
||||
let contentBasedWidth = min(maxSlotWidth, max(minSlotWidth, largestItemWidth + itemPadding))
|
||||
let slotWidth: CGFloat
|
||||
if CGFloat(component.styles.count) * contentBasedWidth <= availableSize.width {
|
||||
slotWidth = floor(availableSize.width / CGFloat(component.styles.count))
|
||||
if CGFloat(component.styles.count + 1) * contentBasedWidth <= availableSize.width {
|
||||
slotWidth = floor(availableSize.width / CGFloat(component.styles.count + 1))
|
||||
} else {
|
||||
var resolved: CGFloat = contentBasedWidth
|
||||
var targetVisible: CGFloat = min(7.5, floor((availableSize.width + 16.0) / (contentBasedWidth + 10.0)) + 0.5)
|
||||
|
|
@ -179,7 +206,7 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
}
|
||||
slotWidth = resolved
|
||||
}
|
||||
let contentWidth = slotWidth * CGFloat(component.styles.count)
|
||||
let contentWidth = slotWidth * CGFloat(component.styles.count + 1)
|
||||
|
||||
self.scrollView.frame = CGRect(origin: CGPoint(), size: availableSize)
|
||||
self.scrollView.contentSize = CGSize(width: contentWidth, height: availableSize.height)
|
||||
|
|
@ -189,8 +216,8 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
var selectedItemFrame: CGRect?
|
||||
for i in 0 ..< component.styles.count {
|
||||
let style = component.styles[i]
|
||||
guard let itemView = self.itemViews[style.id],
|
||||
let naturalSize = itemSizes[style.id] else {
|
||||
guard let itemView = self.itemViews[.style(style.reference.id)],
|
||||
let naturalSize = itemSizes[.style(style.reference.id)] else {
|
||||
continue
|
||||
}
|
||||
let slotOriginX = CGFloat(i) * slotWidth
|
||||
|
|
@ -202,14 +229,27 @@ final class TextProcessingStyleSelectionComponent: Component {
|
|||
}
|
||||
transition.setFrame(view: itemComponentView, frame: itemFrame)
|
||||
}
|
||||
if style.id == component.selectedStyle {
|
||||
if .style(style.reference.id) == component.selectedStyle {
|
||||
selectedItemFrame = CGRect(origin: CGPoint(x: slotOriginX, y: -5.0), size: CGSize(width: slotWidth, height: availableSize.height + 5.0 + 3.0))
|
||||
}
|
||||
}
|
||||
|
||||
do {
|
||||
let naturalSize = createStyleItemSize
|
||||
let slotOriginX = CGFloat(component.styles.count) * slotWidth
|
||||
let itemX = slotOriginX + floor((slotWidth - naturalSize.width) * 0.5)
|
||||
let itemFrame = CGRect(origin: CGPoint(x: itemX, y: 0.0), size: naturalSize)
|
||||
if let itemComponentView = self.createStyleItemView.view {
|
||||
if itemComponentView.superview == nil {
|
||||
self.scrollView.addSubview(itemComponentView)
|
||||
}
|
||||
transition.setFrame(view: itemComponentView, frame: itemFrame)
|
||||
}
|
||||
}
|
||||
|
||||
var removedIds: [TelegramComposeAIMessageMode.StyleId] = []
|
||||
for (id, itemView) in self.itemViews {
|
||||
if !component.styles.contains(where: { $0.id == id }) {
|
||||
if !component.styles.contains(where: { .style($0.reference.id) == id }) {
|
||||
removedIds.append(id)
|
||||
itemView.view?.removeFromSuperview()
|
||||
}
|
||||
|
|
@ -406,3 +446,97 @@ private final class ItemComponent: Component {
|
|||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
private final class CreateItemComponent: Component {
|
||||
let theme: PresentationTheme
|
||||
let strings: PresentationStrings
|
||||
|
||||
init(
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
}
|
||||
|
||||
static func ==(lhs: CreateItemComponent, rhs: CreateItemComponent) -> Bool {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private let icon = ComponentView<Empty>()
|
||||
private let title = ComponentView<Empty>()
|
||||
|
||||
private var component: CreateItemComponent?
|
||||
private weak var state: EmptyComponentState?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func update(component: CreateItemComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
let iconTintColor = component.theme.list.itemPrimaryTextColor
|
||||
|
||||
let iconSize = self.icon.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(BundleIconComponent(
|
||||
name: "Chat/Context Menu/Add",
|
||||
tintColor: iconTintColor
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: 100.0, height: 100.0)
|
||||
)
|
||||
|
||||
//TODO:localize
|
||||
let titleSize = self.title.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: "Add Style", font: Font.medium(10.0), textColor: iconTintColor))
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: availableSize.width, height: 100.0)
|
||||
)
|
||||
|
||||
let contentWidth = max(iconSize.width, titleSize.width)
|
||||
|
||||
let iconFrame = CGRect(origin: CGPoint(x: floor((contentWidth - iconSize.width) * 0.5), y: -3.0), size: iconSize)
|
||||
if let iconView = self.icon.view {
|
||||
if iconView.superview == nil {
|
||||
self.addSubview(iconView)
|
||||
}
|
||||
transition.setFrame(view: iconView, frame: iconFrame)
|
||||
}
|
||||
|
||||
let titleFrame = CGRect(origin: CGPoint(x: floor((contentWidth - titleSize.width) * 0.5), y: availableSize.height - 5.0 - titleSize.height), size: titleSize)
|
||||
if let titleView = self.title.view {
|
||||
if titleView.superview == nil {
|
||||
self.addSubview(titleView)
|
||||
}
|
||||
titleView.frame = titleFrame
|
||||
}
|
||||
|
||||
return CGSize(width: contentWidth, height: availableSize.height)
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -70,7 +70,7 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
|
||||
fileprivate(set) var emojify: Bool = false
|
||||
fileprivate(set) var isSourceTextExpanded: Bool = false
|
||||
fileprivate(set) var style: TelegramComposeAIMessageMode.StyleId = .neutral
|
||||
fileprivate(set) var style: TelegramComposeAIMessageMode.StyleReference = .neutral
|
||||
var displayStyleTooltip: Bool = false
|
||||
|
||||
fileprivate(set) var isProcessing: Bool = false {
|
||||
|
|
@ -103,7 +103,9 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
let externalState: ExternalState
|
||||
let mode: Mode
|
||||
let copyAction: (() -> Void)?
|
||||
let displayLanguageSelectionMenu: (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void) -> Void
|
||||
let displayLanguageSelectionMenu: (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void) -> Void
|
||||
let createStyle: () -> Void
|
||||
let editStyle: (TelegramComposeAIMessageMode.CloudStyle.Id) -> Void
|
||||
let present: (ViewController, Any?) -> Void
|
||||
let rootViewForTextSelection: () -> UIView?
|
||||
|
||||
|
|
@ -116,7 +118,9 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
inputText: TextWithEntities,
|
||||
mode: Mode,
|
||||
copyAction: (() -> Void)?,
|
||||
displayLanguageSelectionMenu: @escaping (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleId) -> Void) -> Void,
|
||||
displayLanguageSelectionMenu: @escaping (UIView, String, TelegramComposeAIMessageMode.StyleId, Bool, @escaping (String, TelegramComposeAIMessageMode.StyleReference) -> Void) -> Void,
|
||||
createStyle: @escaping () -> Void,
|
||||
editStyle: @escaping (TelegramComposeAIMessageMode.CloudStyle.Id) -> Void,
|
||||
present: @escaping (ViewController, Any?) -> Void,
|
||||
rootViewForTextSelection: @escaping () -> UIView?
|
||||
) {
|
||||
|
|
@ -129,6 +133,8 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
self.mode = mode
|
||||
self.copyAction = copyAction
|
||||
self.displayLanguageSelectionMenu = displayLanguageSelectionMenu
|
||||
self.createStyle = createStyle
|
||||
self.editStyle = editStyle
|
||||
self.present = present
|
||||
self.rootViewForTextSelection = rootViewForTextSelection
|
||||
}
|
||||
|
|
@ -365,7 +371,7 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
theme: component.theme,
|
||||
strings: component.strings,
|
||||
styles: component.styles,
|
||||
selectedStyle: component.externalState.style,
|
||||
selectedStyle: component.externalState.style.id,
|
||||
updateStyle: { [weak self] style in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
|
|
@ -381,6 +387,18 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
createStyle: { [weak self] in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.createStyle()
|
||||
},
|
||||
editStyle: { [weak self] styleId in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.editStyle(styleId)
|
||||
}
|
||||
)),
|
||||
environment: {},
|
||||
|
|
@ -462,7 +480,7 @@ final class TextProcessingTranslateContentComponent: Component {
|
|||
guard let self, let component = self.component, let result = component.externalState.result else {
|
||||
return
|
||||
}
|
||||
component.displayLanguageSelectionMenu(sourceView, result.language, component.externalState.style, true, { [weak self] language, style in
|
||||
component.displayLanguageSelectionMenu(sourceView, result.language, component.externalState.style.id, true, { [weak self] language, style in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
|
|
|
|||
|
|
@ -0,0 +1,668 @@
|
|||
import Foundation
|
||||
import UIKit
|
||||
import SwiftSignalKit
|
||||
import Display
|
||||
import TelegramPresentationData
|
||||
import ComponentFlow
|
||||
import ComponentDisplayAdapters
|
||||
import AccountContext
|
||||
import ViewControllerComponent
|
||||
import MultilineTextComponent
|
||||
import ButtonComponent
|
||||
import BundleIconComponent
|
||||
import TelegramCore
|
||||
import PresentationDataUtils
|
||||
import ResizableSheetComponent
|
||||
import GlassBarButtonComponent
|
||||
import LottieComponent
|
||||
import ListSectionComponent
|
||||
import Markdown
|
||||
import TelegramUIPreferences
|
||||
import ListMultilineTextFieldItemComponent
|
||||
|
||||
final class TextStyleEditContentComponent: Component {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
|
||||
final class ExternalState {
|
||||
let titleInputState = ListMultilineTextFieldItemComponent.ExternalState()
|
||||
let textInputState = ListMultilineTextFieldItemComponent.ExternalState()
|
||||
}
|
||||
|
||||
let externalState: ExternalState
|
||||
let context: AccountContext
|
||||
let initialText: TextWithEntities?
|
||||
|
||||
init(
|
||||
externalState: ExternalState,
|
||||
context: AccountContext,
|
||||
initialText: TextWithEntities?
|
||||
) {
|
||||
self.externalState = externalState
|
||||
self.context = context
|
||||
self.initialText = initialText
|
||||
}
|
||||
|
||||
static func ==(lhs: TextStyleEditContentComponent, rhs: TextStyleEditContentComponent) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
private enum Mode {
|
||||
case translate
|
||||
case stylize
|
||||
case fix
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private var component: TextStyleEditContentComponent?
|
||||
private var environment: ViewControllerComponentContainer.Environment?
|
||||
private weak var state: EmptyComponentState?
|
||||
private var isUpdating: Bool = false
|
||||
|
||||
private let iconBackground = ComponentView<Empty>()
|
||||
private let icon = ComponentView<Empty>()
|
||||
private let titleSection = ComponentView<Empty>()
|
||||
private let textSection = ComponentView<Empty>()
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
preconditionFailure()
|
||||
}
|
||||
|
||||
func update(component: TextStyleEditContentComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<ViewControllerComponentContainer.Environment>, transition: ComponentTransition) -> CGSize {
|
||||
self.isUpdating = true
|
||||
defer {
|
||||
self.isUpdating = false
|
||||
}
|
||||
|
||||
let alphaTransition: ComponentTransition = transition.animation.isImmediate ? .immediate : .easeInOut(duration: 0.2)
|
||||
|
||||
let environment = environment[ViewControllerComponentContainer.Environment.self].value
|
||||
|
||||
var resetTitle: String?
|
||||
var resetText: String?
|
||||
if self.component == nil {
|
||||
resetTitle = ""
|
||||
resetText = component.initialText?.text
|
||||
}
|
||||
|
||||
self.component = component
|
||||
self.environment = environment
|
||||
self.state = state
|
||||
|
||||
let sideInset: CGFloat = 16.0
|
||||
let sectionSpacing: CGFloat = 24.0
|
||||
let iconSpacing: CGFloat = 24.0
|
||||
|
||||
var contentHeight: CGFloat = 0.0
|
||||
contentHeight += 70.0
|
||||
|
||||
let iconBackgroundSize = CGSize(width: 100.0, height: 100.0)
|
||||
let _ = self.iconBackground.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(FilledRoundedRectangleComponent(
|
||||
color: environment.theme.list.itemBlocksBackgroundColor,
|
||||
cornerRadius: .minEdge,
|
||||
smoothCorners: false
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: iconBackgroundSize
|
||||
)
|
||||
let iconBackgroundFrame = CGRect(origin: CGPoint(x: floor((availableSize.width - iconBackgroundSize.width) * 0.5), y: contentHeight), size: iconBackgroundSize)
|
||||
if let iconBackgroundView = self.iconBackground.view {
|
||||
if iconBackgroundView.superview == nil {
|
||||
self.addSubview(iconBackgroundView)
|
||||
}
|
||||
transition.setFrame(view: iconBackgroundView, frame: iconBackgroundFrame)
|
||||
}
|
||||
|
||||
let iconSize = self.icon.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: "📝", font: Font.regular(42.0), textColor: .black))
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: iconBackgroundFrame.size
|
||||
)
|
||||
let iconFrame = iconSize.centered(in: iconBackgroundFrame)
|
||||
if let iconView = self.icon.view {
|
||||
if iconView.superview == nil {
|
||||
self.addSubview(iconView)
|
||||
}
|
||||
transition.setFrame(view: iconView, frame: iconFrame)
|
||||
}
|
||||
|
||||
contentHeight += iconBackgroundSize.height + iconSpacing
|
||||
|
||||
//TODO:localize
|
||||
var titleSectionItems: [AnyComponentWithIdentity<Empty>] = []
|
||||
titleSectionItems.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(ListMultilineTextFieldItemComponent(
|
||||
externalState: component.externalState.titleInputState,
|
||||
style: .glass,
|
||||
context: component.context,
|
||||
theme: environment.theme,
|
||||
strings: environment.strings,
|
||||
initialText: "",
|
||||
resetText: resetTitle.flatMap { resetTitle in
|
||||
return ListMultilineTextFieldItemComponent.ResetText(value: resetTitle)
|
||||
},
|
||||
placeholder: "Title",
|
||||
autocapitalizationType: .none,
|
||||
autocorrectionType: .no,
|
||||
characterLimit: 256,
|
||||
emptyLineHandling: .notAllowed,
|
||||
updated: nil,
|
||||
textUpdateTransition: .spring(duration: 0.4),
|
||||
tag: nil
|
||||
))))
|
||||
let titleSectionSize = self.titleSection.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(ListSectionComponent(
|
||||
theme: environment.theme,
|
||||
style: .glass,
|
||||
header: nil,
|
||||
footer: nil,
|
||||
items: titleSectionItems
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0)
|
||||
)
|
||||
let titleSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: titleSectionSize)
|
||||
if let titleSectionView = self.titleSection.view {
|
||||
if titleSectionView.superview == nil {
|
||||
self.addSubview(titleSectionView)
|
||||
self.titleSection.parentState = state
|
||||
}
|
||||
transition.setFrame(view: titleSectionView, frame: titleSectionFrame)
|
||||
}
|
||||
contentHeight += titleSectionSize.height
|
||||
contentHeight += sectionSpacing
|
||||
|
||||
//TODO:localize
|
||||
var textSectionItems: [AnyComponentWithIdentity<Empty>] = []
|
||||
textSectionItems.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(ListMultilineTextFieldItemComponent(
|
||||
externalState: component.externalState.textInputState,
|
||||
style: .glass,
|
||||
context: component.context,
|
||||
theme: environment.theme,
|
||||
strings: environment.strings,
|
||||
initialText: "",
|
||||
resetText: resetText.flatMap { resetText in
|
||||
return ListMultilineTextFieldItemComponent.ResetText(value: resetText)
|
||||
},
|
||||
placeholder: "Text",
|
||||
autocapitalizationType: .none,
|
||||
autocorrectionType: .no,
|
||||
characterLimit: 4096,
|
||||
emptyLineHandling: .allowed,
|
||||
updated: nil,
|
||||
textUpdateTransition: .spring(duration: 0.4),
|
||||
tag: nil
|
||||
))))
|
||||
let textSectionSize = self.textSection.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(ListSectionComponent(
|
||||
theme: environment.theme,
|
||||
style: .glass,
|
||||
header: nil,
|
||||
footer: nil,
|
||||
items: textSectionItems
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: availableSize.width - sideInset * 2.0, height: 10000.0)
|
||||
)
|
||||
let textSectionFrame = CGRect(origin: CGPoint(x: sideInset, y: contentHeight), size: textSectionSize)
|
||||
if let textSectionView = self.textSection.view {
|
||||
if textSectionView.superview == nil {
|
||||
self.addSubview(textSectionView)
|
||||
self.textSection.parentState = state
|
||||
}
|
||||
transition.setFrame(view: textSectionView, frame: textSectionFrame)
|
||||
}
|
||||
contentHeight += textSectionSize.height
|
||||
|
||||
contentHeight += 106.0
|
||||
|
||||
let _ = alphaTransition
|
||||
|
||||
return CGSize(width: availableSize.width, height: contentHeight)
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<ViewControllerComponentContainer.Environment>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
private final class TextStyleEditSheetComponent: Component {
|
||||
typealias EnvironmentType = ViewControllerComponentContainer.Environment
|
||||
|
||||
let context: AccountContext
|
||||
let initialText: TextWithEntities?
|
||||
let completion: (TelegramComposeAIMessageMode.CloudStyle) -> Void
|
||||
|
||||
init(
|
||||
context: AccountContext,
|
||||
initialText: TextWithEntities?,
|
||||
completion: @escaping (TelegramComposeAIMessageMode.CloudStyle) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
self.initialText = initialText
|
||||
self.completion = completion
|
||||
}
|
||||
|
||||
static func ==(lhs: TextStyleEditSheetComponent, rhs: TextStyleEditSheetComponent) -> Bool {
|
||||
return true
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private let sheet = ComponentView<(ViewControllerComponentContainer.Environment, ResizableSheetComponentEnvironment)>()
|
||||
private let animateOut = ActionSlot<Action<Void>>()
|
||||
|
||||
private var component: TextStyleEditSheetComponent?
|
||||
private var environment: ViewControllerComponentContainer.Environment?
|
||||
private weak var state: EmptyComponentState?
|
||||
|
||||
private let contentState = TextStyleEditContentComponent.ExternalState()
|
||||
|
||||
private var createDisposable: Disposable?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
|
||||
self.contentState.titleInputState.updated = { [weak self] in
|
||||
DispatchQueue.main.async {
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.state?.updated(transition: .spring(duration: 0.4))
|
||||
}
|
||||
}
|
||||
self.contentState.textInputState.updated = self.contentState.titleInputState.updated
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
self.createDisposable?.dispose()
|
||||
}
|
||||
|
||||
private func performCreateStyle() {
|
||||
guard let component = self.component else {
|
||||
return
|
||||
}
|
||||
if self.contentState.titleInputState.text.string.isEmpty || self.contentState.textInputState.text.string.isEmpty {
|
||||
return
|
||||
}
|
||||
|
||||
self.createDisposable?.dispose()
|
||||
self.createDisposable = (component.context.engine.messages.createAITextStyle(
|
||||
displayAuthor: false,
|
||||
emojiFileId: nil,
|
||||
title: self.contentState.titleInputState.text.string,
|
||||
prompt: self.contentState.textInputState.text.string
|
||||
)
|
||||
|> deliverOnMainQueue).startStrict(next: { [weak self] result in
|
||||
guard let self, let component = self.component, let environment = self.environment else {
|
||||
return
|
||||
}
|
||||
let controller = environment.controller
|
||||
|
||||
self.animateOut.invoke(Action { _ in
|
||||
if let controller = controller() {
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
})
|
||||
|
||||
component.completion(result)
|
||||
}, error: { [weak self] error in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
let _ = self
|
||||
})
|
||||
}
|
||||
|
||||
func update(component: TextStyleEditSheetComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<ViewControllerComponentContainer.Environment>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
let environmentValue = environment[ViewControllerComponentContainer.Environment.self].value
|
||||
self.environment = environmentValue
|
||||
let controller = environmentValue.controller
|
||||
let theme = environmentValue.theme
|
||||
|
||||
let dismiss: (Bool) -> Void = { [weak self] animated in
|
||||
if animated {
|
||||
self?.animateOut.invoke(Action { _ in
|
||||
if let controller = controller() {
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
})
|
||||
} else {
|
||||
if let controller = controller() {
|
||||
controller.dismiss(completion: nil)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let performMainAction: () -> Void = { [weak self] in
|
||||
guard let self else {
|
||||
return
|
||||
}
|
||||
self.performCreateStyle()
|
||||
}
|
||||
let isMainActionEnabled = self.contentState.titleInputState.hasText && self.contentState.textInputState.hasText
|
||||
let actionButtonTitle: String = "Create"
|
||||
|
||||
let titleString: String = "New Style"
|
||||
|
||||
let sheetSize = self.sheet.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(ResizableSheetComponent<ViewControllerComponentContainer.Environment>(
|
||||
content: AnyComponent<ViewControllerComponentContainer.Environment>(TextStyleEditContentComponent(
|
||||
externalState: self.contentState,
|
||||
context: component.context,
|
||||
initialText: component.initialText
|
||||
)),
|
||||
titleItem: AnyComponent(TitleComponent(
|
||||
theme: theme,
|
||||
title: titleString
|
||||
)),
|
||||
leftItem: AnyComponent(
|
||||
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
|
||||
dismiss(true)
|
||||
}
|
||||
)
|
||||
),
|
||||
rightItem: nil,
|
||||
bottomItem: AnyComponent(
|
||||
ActionButtonsComponent(
|
||||
theme: theme,
|
||||
strings: environmentValue.strings,
|
||||
actionTitle: actionButtonTitle,
|
||||
action: isMainActionEnabled ? performMainAction : nil
|
||||
)
|
||||
),
|
||||
backgroundColor: .color(theme.list.blocksBackgroundColor),
|
||||
animateOut: self.animateOut
|
||||
)),
|
||||
environment: {
|
||||
environmentValue
|
||||
ResizableSheetComponentEnvironment(
|
||||
theme: theme,
|
||||
statusBarHeight: environmentValue.statusBarHeight,
|
||||
safeInsets: environmentValue.safeInsets,
|
||||
inputHeight: 0.0,
|
||||
metrics: environmentValue.metrics,
|
||||
deviceMetrics: environmentValue.deviceMetrics,
|
||||
isDisplaying: environmentValue.isVisible,
|
||||
isCentered: environmentValue.metrics.widthClass == .regular,
|
||||
screenSize: availableSize,
|
||||
regularMetricsSize: nil,
|
||||
dismiss: { animated in
|
||||
dismiss(animated)
|
||||
}
|
||||
)
|
||||
},
|
||||
containerSize: availableSize
|
||||
)
|
||||
self.sheet.parentState = state
|
||||
if let sheetView = self.sheet.view {
|
||||
if sheetView.superview == nil {
|
||||
self.addSubview(sheetView)
|
||||
}
|
||||
transition.setFrame(view: sheetView, frame: CGRect(origin: .zero, size: sheetSize))
|
||||
}
|
||||
|
||||
return availableSize
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<ViewControllerComponentContainer.Environment>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
public class TextStyleEditScreen: ViewControllerComponentContainer {
|
||||
private let context: AccountContext
|
||||
|
||||
public init(
|
||||
context: AccountContext,
|
||||
theme: PresentationTheme? = nil,
|
||||
initialText: TextWithEntities?,
|
||||
completion: @escaping (TelegramComposeAIMessageMode.CloudStyle) -> Void
|
||||
) {
|
||||
self.context = context
|
||||
|
||||
super.init(
|
||||
context: context,
|
||||
component: TextStyleEditSheetComponent(
|
||||
context: context,
|
||||
initialText: initialText,
|
||||
completion: completion
|
||||
),
|
||||
navigationBarAppearance: .none,
|
||||
statusBarStyle: .ignore,
|
||||
theme: theme.flatMap({ .custom($0) }) ?? .default
|
||||
)
|
||||
|
||||
self.statusBar.statusBarStyle = .Ignore
|
||||
self.navigationPresentation = .flatModal
|
||||
self.blocksBackgroundWhenInOverlay = true
|
||||
}
|
||||
|
||||
required public init(coder aDecoder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
deinit {
|
||||
}
|
||||
|
||||
public func dismissAnimated() {
|
||||
if let view = self.node.hostView.findTaggedView(tag: ResizableSheetComponent<ViewControllerComponentContainer.Environment>.View.Tag()) as? ResizableSheetComponent<ViewControllerComponentContainer.Environment>.View {
|
||||
view.dismissAnimated()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private final class TitleComponent: Component {
|
||||
let theme: PresentationTheme
|
||||
let title: String
|
||||
|
||||
init(
|
||||
theme: PresentationTheme,
|
||||
title: String
|
||||
) {
|
||||
self.theme = theme
|
||||
self.title = title
|
||||
}
|
||||
|
||||
static func ==(lhs: TitleComponent, rhs: TitleComponent) -> Bool {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
if lhs.title != rhs.title {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private let title = ComponentView<Empty>()
|
||||
|
||||
private var component: TitleComponent?
|
||||
private weak var state: EmptyComponentState?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func update(component: TitleComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
let titleSize = self.title.update(
|
||||
transition: .immediate,
|
||||
component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: component.title, font: Font.semibold(17.0), textColor: component.theme.list.itemPrimaryTextColor))
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: availableSize.width, height: 100.0)
|
||||
)
|
||||
let titleFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: titleSize)
|
||||
if let titleView = self.title.view {
|
||||
if titleView.superview == nil {
|
||||
titleView.isUserInteractionEnabled = false
|
||||
self.addSubview(titleView)
|
||||
}
|
||||
titleView.frame = titleFrame
|
||||
}
|
||||
|
||||
return titleSize
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
|
||||
private final class ActionButtonsComponent: Component {
|
||||
let theme: PresentationTheme
|
||||
let strings: PresentationStrings
|
||||
let actionTitle: String
|
||||
let action: (() -> Void)?
|
||||
|
||||
init(
|
||||
theme: PresentationTheme,
|
||||
strings: PresentationStrings,
|
||||
actionTitle: String,
|
||||
action: (() -> Void)?
|
||||
) {
|
||||
self.theme = theme
|
||||
self.strings = strings
|
||||
self.actionTitle = actionTitle
|
||||
self.action = action
|
||||
}
|
||||
|
||||
static func ==(lhs: ActionButtonsComponent, rhs: ActionButtonsComponent) -> Bool {
|
||||
if lhs.theme !== rhs.theme {
|
||||
return false
|
||||
}
|
||||
if lhs.strings !== rhs.strings {
|
||||
return false
|
||||
}
|
||||
if lhs.actionTitle != rhs.actionTitle {
|
||||
return false
|
||||
}
|
||||
if (lhs.action == nil) != (rhs.action == nil) {
|
||||
return false
|
||||
}
|
||||
return true
|
||||
}
|
||||
|
||||
final class View: UIView {
|
||||
private let actionButton = ComponentView<Empty>()
|
||||
|
||||
private var component: ActionButtonsComponent?
|
||||
private weak var state: EmptyComponentState?
|
||||
|
||||
override init(frame: CGRect) {
|
||||
super.init(frame: frame)
|
||||
}
|
||||
|
||||
required init?(coder: NSCoder) {
|
||||
fatalError("init(coder:) has not been implemented")
|
||||
}
|
||||
|
||||
func update(component: ActionButtonsComponent, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
self.component = component
|
||||
self.state = state
|
||||
|
||||
let actionButtonWidth: CGFloat = availableSize.width
|
||||
|
||||
var actionButtonContents: [AnyComponentWithIdentity<Empty>] = []
|
||||
actionButtonContents.append(AnyComponentWithIdentity(id: 0, component: AnyComponent(MultilineTextComponent(
|
||||
text: .plain(NSAttributedString(string: component.actionTitle, font: Font.semibold(17.0), textColor: component.theme.list.itemCheckColors.foregroundColor))
|
||||
))))
|
||||
|
||||
let actionButtonSize = self.actionButton.update(
|
||||
transition: transition,
|
||||
component: AnyComponent(ButtonComponent(
|
||||
background: ButtonComponent.Background(
|
||||
style: .glass,
|
||||
color: component.theme.list.itemCheckColors.fillColor,
|
||||
foreground: component.theme.list.itemCheckColors.foregroundColor,
|
||||
pressedColor: component.theme.list.itemCheckColors.fillColor.withMultipliedAlpha(0.9)
|
||||
),
|
||||
content: AnyComponentWithIdentity(
|
||||
id: AnyHashable(0),
|
||||
component: AnyComponent(HStack(
|
||||
actionButtonContents,
|
||||
spacing: 6.0
|
||||
))
|
||||
),
|
||||
isEnabled: component.action != nil,
|
||||
displaysProgress: false,
|
||||
action: { [weak self] in
|
||||
guard let self, let component = self.component else {
|
||||
return
|
||||
}
|
||||
component.action?()
|
||||
}
|
||||
)),
|
||||
environment: {},
|
||||
containerSize: CGSize(width: actionButtonWidth, height: availableSize.height)
|
||||
)
|
||||
let actionButtonFrame = CGRect(origin: CGPoint(x: 0.0, y: 0.0), size: actionButtonSize)
|
||||
if let actionButtonView = self.actionButton.view {
|
||||
if actionButtonView.superview == nil {
|
||||
self.addSubview(actionButtonView)
|
||||
}
|
||||
transition.setFrame(view: actionButtonView, frame: actionButtonFrame)
|
||||
}
|
||||
|
||||
return CGSize(width: availableSize.width, height: actionButtonSize.height)
|
||||
}
|
||||
}
|
||||
|
||||
func makeView() -> View {
|
||||
return View(frame: CGRect())
|
||||
}
|
||||
|
||||
func update(view: View, availableSize: CGSize, state: EmptyComponentState, environment: Environment<Empty>, transition: ComponentTransition) -> CGSize {
|
||||
return view.update(component: self, availableSize: availableSize, state: state, environment: environment, transition: transition)
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue