Update API

This commit is contained in:
Ilya Laktyushin 2024-09-17 18:46:22 +04:00
parent a0b2af37b0
commit 588cdeee7a
19 changed files with 1378 additions and 952 deletions

View File

@ -378,7 +378,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-977967015] = { return Api.InputInvoice.parse_inputInvoiceMessage($0) } dict[-977967015] = { return Api.InputInvoice.parse_inputInvoiceMessage($0) }
dict[-1734841331] = { return Api.InputInvoice.parse_inputInvoicePremiumGiftCode($0) } dict[-1734841331] = { return Api.InputInvoice.parse_inputInvoicePremiumGiftCode($0) }
dict[-1020867857] = { return Api.InputInvoice.parse_inputInvoiceSlug($0) } dict[-1020867857] = { return Api.InputInvoice.parse_inputInvoiceSlug($0) }
dict[-396206446] = { return Api.InputInvoice.parse_inputInvoiceStarGift($0) } dict[634962392] = { return Api.InputInvoice.parse_inputInvoiceStarGift($0) }
dict[1710230755] = { return Api.InputInvoice.parse_inputInvoiceStars($0) } dict[1710230755] = { return Api.InputInvoice.parse_inputInvoiceStars($0) }
dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) } dict[-122978821] = { return Api.InputMedia.parse_inputMediaContact($0) }
dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) } dict[-428884101] = { return Api.InputMedia.parse_inputMediaDice($0) }
@ -574,7 +574,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) } dict[-1434950843] = { return Api.MessageAction.parse_messageActionSetChatTheme($0) }
dict[1348510708] = { return Api.MessageAction.parse_messageActionSetChatWallPaper($0) } dict[1348510708] = { return Api.MessageAction.parse_messageActionSetChatWallPaper($0) }
dict[1007897979] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) } dict[1007897979] = { return Api.MessageAction.parse_messageActionSetMessagesTTL($0) }
dict[-1878231146] = { return Api.MessageAction.parse_messageActionStarGift($0) } dict[-1682706620] = { return Api.MessageAction.parse_messageActionStarGift($0) }
dict[1474192222] = { return Api.MessageAction.parse_messageActionSuggestProfilePhoto($0) } dict[1474192222] = { return Api.MessageAction.parse_messageActionSuggestProfilePhoto($0) }
dict[228168278] = { return Api.MessageAction.parse_messageActionTopicCreate($0) } dict[228168278] = { return Api.MessageAction.parse_messageActionTopicCreate($0) }
dict[-1064024032] = { return Api.MessageAction.parse_messageActionTopicEdit($0) } dict[-1064024032] = { return Api.MessageAction.parse_messageActionTopicEdit($0) }
@ -1106,6 +1106,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-862357728] = { return Api.UserFull.parse_userFull($0) } dict[-862357728] = { return Api.UserFull.parse_userFull($0) }
dict[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) } dict[-2100168954] = { return Api.UserProfilePhoto.parse_userProfilePhoto($0) }
dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) } dict[1326562017] = { return Api.UserProfilePhoto.parse_userProfilePhotoEmpty($0) }
dict[-291202450] = { return Api.UserStarGift.parse_userStarGift($0) }
dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($0) } dict[164646985] = { return Api.UserStatus.parse_userStatusEmpty($0) }
dict[1703516023] = { return Api.UserStatus.parse_userStatusLastMonth($0) } dict[1703516023] = { return Api.UserStatus.parse_userStatusLastMonth($0) }
dict[1410997530] = { return Api.UserStatus.parse_userStatusLastWeek($0) } dict[1410997530] = { return Api.UserStatus.parse_userStatusLastWeek($0) }
@ -1349,6 +1350,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-919881925] = { return Api.payments.StarsRevenueStats.parse_starsRevenueStats($0) } dict[-919881925] = { return Api.payments.StarsRevenueStats.parse_starsRevenueStats($0) }
dict[497778871] = { return Api.payments.StarsRevenueWithdrawalUrl.parse_starsRevenueWithdrawalUrl($0) } dict[497778871] = { return Api.payments.StarsRevenueWithdrawalUrl.parse_starsRevenueWithdrawalUrl($0) }
dict[-1141231252] = { return Api.payments.StarsStatus.parse_starsStatus($0) } dict[-1141231252] = { return Api.payments.StarsStatus.parse_starsStatus($0) }
dict[1801827607] = { return Api.payments.UserStarGifts.parse_userStarGifts($0) }
dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) } dict[-784000893] = { return Api.payments.ValidatedRequestedInfo.parse_validatedRequestedInfo($0) }
dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) } dict[541839704] = { return Api.phone.ExportedGroupCallInvite.parse_exportedGroupCallInvite($0) }
dict[-1636664659] = { return Api.phone.GroupCall.parse_groupCall($0) } dict[-1636664659] = { return Api.phone.GroupCall.parse_groupCall($0) }
@ -2101,6 +2103,8 @@ public extension Api {
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.UserProfilePhoto: case let _1 as Api.UserProfilePhoto:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.UserStarGift:
_1.serialize(buffer, boxed)
case let _1 as Api.UserStatus: case let _1 as Api.UserStatus:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.Username: case let _1 as Api.Username:
@ -2403,6 +2407,8 @@ public extension Api {
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.payments.StarsStatus: case let _1 as Api.payments.StarsStatus:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.payments.UserStarGifts:
_1.serialize(buffer, boxed)
case let _1 as Api.payments.ValidatedRequestedInfo: case let _1 as Api.payments.ValidatedRequestedInfo:
_1.serialize(buffer, boxed) _1.serialize(buffer, boxed)
case let _1 as Api.phone.ExportedGroupCallInvite: case let _1 as Api.phone.ExportedGroupCallInvite:

View File

@ -4,7 +4,7 @@ public extension Api {
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32) case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption) case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
case inputInvoiceSlug(slug: String) case inputInvoiceSlug(slug: String)
case inputInvoiceStarGift(flags: Int32, peer: Api.InputPeer, giftId: Int64, message: Api.TextWithEntities?) case inputInvoiceStarGift(flags: Int32, userId: Api.InputUser, giftId: Int64, message: Api.TextWithEntities?)
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose) case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
@ -35,12 +35,12 @@ public extension Api {
} }
serializeString(slug, buffer: buffer, boxed: false) serializeString(slug, buffer: buffer, boxed: false)
break break
case .inputInvoiceStarGift(let flags, let peer, let giftId, let message): case .inputInvoiceStarGift(let flags, let userId, let giftId, let message):
if boxed { if boxed {
buffer.appendInt32(-396206446) buffer.appendInt32(634962392)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true) userId.serialize(buffer, true)
serializeInt64(giftId, buffer: buffer, boxed: false) serializeInt64(giftId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)}
break break
@ -63,8 +63,8 @@ public extension Api {
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)]) return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
case .inputInvoiceSlug(let slug): case .inputInvoiceSlug(let slug):
return ("inputInvoiceSlug", [("slug", slug as Any)]) return ("inputInvoiceSlug", [("slug", slug as Any)])
case .inputInvoiceStarGift(let flags, let peer, let giftId, let message): case .inputInvoiceStarGift(let flags, let userId, let giftId, let message):
return ("inputInvoiceStarGift", [("flags", flags as Any), ("peer", peer as Any), ("giftId", giftId as Any), ("message", message as Any)]) return ("inputInvoiceStarGift", [("flags", flags as Any), ("userId", userId as Any), ("giftId", giftId as Any), ("message", message as Any)])
case .inputInvoiceStars(let purpose): case .inputInvoiceStars(let purpose):
return ("inputInvoiceStars", [("purpose", purpose as Any)]) return ("inputInvoiceStars", [("purpose", purpose as Any)])
} }
@ -129,9 +129,9 @@ public extension Api {
public static func parse_inputInvoiceStarGift(_ reader: BufferReader) -> InputInvoice? { public static func parse_inputInvoiceStarGift(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
var _2: Api.InputPeer? var _2: Api.InputUser?
if let signature = reader.readInt32() { if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPeer _2 = Api.parse(reader, signature: signature) as? Api.InputUser
} }
var _3: Int64? var _3: Int64?
_3 = reader.readInt64() _3 = reader.readInt64()
@ -144,7 +144,7 @@ public extension Api {
let _c3 = _3 != nil let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 { if _c1 && _c2 && _c3 && _c4 {
return Api.InputInvoice.inputInvoiceStarGift(flags: _1!, peer: _2!, giftId: _3!, message: _4) return Api.InputInvoice.inputInvoiceStarGift(flags: _1!, userId: _2!, giftId: _3!, message: _4)
} }
else { else {
return nil return nil

View File

@ -1009,7 +1009,7 @@ public extension Api {
case messageActionSetChatTheme(emoticon: String) case messageActionSetChatTheme(emoticon: String)
case messageActionSetChatWallPaper(flags: Int32, wallpaper: Api.WallPaper) case messageActionSetChatWallPaper(flags: Int32, wallpaper: Api.WallPaper)
case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?) case messageActionSetMessagesTTL(flags: Int32, period: Int32, autoSettingFrom: Int64?)
case messageActionStarGift(flags: Int32, starsAmount: Int64, giftId: Int64, limitedNumber: Int32?, limitedTotal: Int32?, message: Api.TextWithEntities?) case messageActionStarGift(flags: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, convertStars: Int64)
case messageActionSuggestProfilePhoto(photo: Api.Photo) case messageActionSuggestProfilePhoto(photo: Api.Photo)
case messageActionTopicCreate(flags: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?) case messageActionTopicCreate(flags: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?)
case messageActionTopicEdit(flags: Int32, title: String?, iconEmojiId: Int64?, closed: Api.Bool?, hidden: Api.Bool?) case messageActionTopicEdit(flags: Int32, title: String?, iconEmojiId: Int64?, closed: Api.Bool?, hidden: Api.Bool?)
@ -1351,16 +1351,14 @@ public extension Api {
serializeInt32(period, buffer: buffer, boxed: false) serializeInt32(period, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(autoSettingFrom!, buffer: buffer, boxed: false)} if Int(flags) & Int(1 << 0) != 0 {serializeInt64(autoSettingFrom!, buffer: buffer, boxed: false)}
break break
case .messageActionStarGift(let flags, let starsAmount, let giftId, let limitedNumber, let limitedTotal, let message): case .messageActionStarGift(let flags, let gift, let message, let convertStars):
if boxed { if boxed {
buffer.appendInt32(-1878231146) buffer.appendInt32(-1682706620)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(starsAmount, buffer: buffer, boxed: false) gift.serialize(buffer, true)
serializeInt64(giftId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(limitedNumber!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(limitedTotal!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)} if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)}
serializeInt64(convertStars, buffer: buffer, boxed: false)
break break
case .messageActionSuggestProfilePhoto(let photo): case .messageActionSuggestProfilePhoto(let photo):
if boxed { if boxed {
@ -1487,8 +1485,8 @@ public extension Api {
return ("messageActionSetChatWallPaper", [("flags", flags as Any), ("wallpaper", wallpaper as Any)]) return ("messageActionSetChatWallPaper", [("flags", flags as Any), ("wallpaper", wallpaper as Any)])
case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom): case .messageActionSetMessagesTTL(let flags, let period, let autoSettingFrom):
return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)]) return ("messageActionSetMessagesTTL", [("flags", flags as Any), ("period", period as Any), ("autoSettingFrom", autoSettingFrom as Any)])
case .messageActionStarGift(let flags, let starsAmount, let giftId, let limitedNumber, let limitedTotal, let message): case .messageActionStarGift(let flags, let gift, let message, let convertStars):
return ("messageActionStarGift", [("flags", flags as Any), ("starsAmount", starsAmount as Any), ("giftId", giftId as Any), ("limitedNumber", limitedNumber as Any), ("limitedTotal", limitedTotal as Any), ("message", message as Any)]) return ("messageActionStarGift", [("flags", flags as Any), ("gift", gift as Any), ("message", message as Any), ("convertStars", convertStars as Any)])
case .messageActionSuggestProfilePhoto(let photo): case .messageActionSuggestProfilePhoto(let photo):
return ("messageActionSuggestProfilePhoto", [("photo", photo as Any)]) return ("messageActionSuggestProfilePhoto", [("photo", photo as Any)])
case .messageActionTopicCreate(let flags, let title, let iconColor, let iconEmojiId): case .messageActionTopicCreate(let flags, let title, let iconColor, let iconEmojiId):
@ -2123,26 +2121,22 @@ public extension Api {
public static func parse_messageActionStarGift(_ reader: BufferReader) -> MessageAction? { public static func parse_messageActionStarGift(_ reader: BufferReader) -> MessageAction? {
var _1: Int32? var _1: Int32?
_1 = reader.readInt32() _1 = reader.readInt32()
var _2: Int64? var _2: Api.StarGift?
_2 = reader.readInt64() if let signature = reader.readInt32() {
var _3: Int64? _2 = Api.parse(reader, signature: signature) as? Api.StarGift
_3 = reader.readInt64() }
var _4: Int32? var _3: Api.TextWithEntities?
if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() }
var _5: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() }
var _6: Api.TextWithEntities?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() { if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.TextWithEntities _3 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} } } }
var _4: Int64?
_4 = reader.readInt64()
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil if _c1 && _c2 && _c3 && _c4 {
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil return Api.MessageAction.messageActionStarGift(flags: _1!, gift: _2!, message: _3, convertStars: _4!)
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.MessageAction.messageActionStarGift(flags: _1!, starsAmount: _2!, giftId: _3!, limitedNumber: _4, limitedTotal: _5, message: _6)
} }
else { else {
return nil return nil

View File

@ -850,6 +850,70 @@ public extension Api {
} }
} }
public extension Api {
enum UserStarGift: TypeConstructorDescription {
case userStarGift(flags: Int32, fromId: Int64?, date: Int32, gift: Api.StarGift, message: Api.TextWithEntities?, msgId: Int32?, convertStars: Int64?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .userStarGift(let flags, let fromId, let date, let gift, let message, let msgId, let convertStars):
if boxed {
buffer.appendInt32(-291202450)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt64(fromId!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
gift.serialize(buffer, true)
if Int(flags) & Int(1 << 2) != 0 {message!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(msgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {serializeInt64(convertStars!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .userStarGift(let flags, let fromId, let date, let gift, let message, let msgId, let convertStars):
return ("userStarGift", [("flags", flags as Any), ("fromId", fromId as Any), ("date", date as Any), ("gift", gift as Any), ("message", message as Any), ("msgId", msgId as Any), ("convertStars", convertStars as Any)])
}
}
public static func parse_userStarGift(_ reader: BufferReader) -> UserStarGift? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
if Int(_1!) & Int(1 << 1) != 0 {_2 = reader.readInt64() }
var _3: Int32?
_3 = reader.readInt32()
var _4: Api.StarGift?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.StarGift
}
var _5: Api.TextWithEntities?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} }
var _6: Int32?
if Int(_1!) & Int(1 << 3) != 0 {_6 = reader.readInt32() }
var _7: Int64?
if Int(_1!) & Int(1 << 4) != 0 {_7 = reader.readInt64() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.UserStarGift.userStarGift(flags: _1!, fromId: _2, date: _3!, gift: _4!, message: _5, msgId: _6, convertStars: _7)
}
else {
return nil
}
}
}
}
public extension Api { public extension Api {
enum UserStatus: TypeConstructorDescription { enum UserStatus: TypeConstructorDescription {
case userStatusEmpty case userStatusEmpty
@ -1458,207 +1522,3 @@ public extension Api {
} }
} }
public extension Api {
enum WebPage: TypeConstructorDescription {
case webPage(flags: Int32, id: Int64, url: String, displayUrl: String, hash: Int32, type: String?, siteName: String?, title: String?, description: String?, photo: Api.Photo?, embedUrl: String?, embedType: String?, embedWidth: Int32?, embedHeight: Int32?, duration: Int32?, author: String?, document: Api.Document?, cachedPage: Api.Page?, attributes: [Api.WebPageAttribute]?)
case webPageEmpty(flags: Int32, id: Int64, url: String?)
case webPageNotModified(flags: Int32, cachedPageViews: Int32?)
case webPagePending(flags: Int32, id: Int64, url: String?, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
if boxed {
buffer.appendInt32(-392411726)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
serializeString(url, buffer: buffer, boxed: false)
serializeString(displayUrl, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(type!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(siteName!, 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(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {photo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedUrl!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedType!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedWidth!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedHeight!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(duration!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 8) != 0 {serializeString(author!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 9) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 10) != 0 {cachedPage!.serialize(buffer, true)}
if Int(flags) & Int(1 << 12) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes!.count))
for item in attributes! {
item.serialize(buffer, true)
}}
break
case .webPageEmpty(let flags, let id, let url):
if boxed {
buffer.appendInt32(555358088)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
break
case .webPageNotModified(let flags, let cachedPageViews):
if boxed {
buffer.appendInt32(1930545681)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(cachedPageViews!, buffer: buffer, boxed: false)}
break
case .webPagePending(let flags, let id, let url, let date):
if boxed {
buffer.appendInt32(-1328464313)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
return ("webPage", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("displayUrl", displayUrl as Any), ("hash", hash as Any), ("type", type as Any), ("siteName", siteName as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("embedUrl", embedUrl as Any), ("embedType", embedType as Any), ("embedWidth", embedWidth as Any), ("embedHeight", embedHeight as Any), ("duration", duration as Any), ("author", author as Any), ("document", document as Any), ("cachedPage", cachedPage as Any), ("attributes", attributes as Any)])
case .webPageEmpty(let flags, let id, let url):
return ("webPageEmpty", [("flags", flags as Any), ("id", id as Any), ("url", url as Any)])
case .webPageNotModified(let flags, let cachedPageViews):
return ("webPageNotModified", [("flags", flags as Any), ("cachedPageViews", cachedPageViews as Any)])
case .webPagePending(let flags, let id, let url, let date):
return ("webPagePending", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("date", date as Any)])
}
}
public static func parse_webPage(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Int32?
_5 = reader.readInt32()
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
var _7: String?
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
var _8: String?
if Int(_1!) & Int(1 << 2) != 0 {_8 = parseString(reader) }
var _9: String?
if Int(_1!) & Int(1 << 3) != 0 {_9 = parseString(reader) }
var _10: Api.Photo?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.Photo
} }
var _11: String?
if Int(_1!) & Int(1 << 5) != 0 {_11 = parseString(reader) }
var _12: String?
if Int(_1!) & Int(1 << 5) != 0 {_12 = parseString(reader) }
var _13: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_13 = reader.readInt32() }
var _14: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_14 = reader.readInt32() }
var _15: Int32?
if Int(_1!) & Int(1 << 7) != 0 {_15 = reader.readInt32() }
var _16: String?
if Int(_1!) & Int(1 << 8) != 0 {_16 = parseString(reader) }
var _17: Api.Document?
if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
_17 = Api.parse(reader, signature: signature) as? Api.Document
} }
var _18: Api.Page?
if Int(_1!) & Int(1 << 10) != 0 {if let signature = reader.readInt32() {
_18 = Api.parse(reader, signature: signature) as? Api.Page
} }
var _19: [Api.WebPageAttribute]?
if Int(_1!) & Int(1 << 12) != 0 {if let _ = reader.readInt32() {
_19 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebPageAttribute.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 4) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 5) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 6) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
let _c15 = (Int(_1!) & Int(1 << 7) == 0) || _15 != nil
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil
let _c19 = (Int(_1!) & Int(1 << 12) == 0) || _19 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
}
else {
return nil
}
}
public static func parse_webPageEmpty(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
}
else {
return nil
}
}
public static func parse_webPageNotModified(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
}
else {
return nil
}
}
public static func parse_webPagePending(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,207 @@
public extension Api {
enum WebPage: TypeConstructorDescription {
case webPage(flags: Int32, id: Int64, url: String, displayUrl: String, hash: Int32, type: String?, siteName: String?, title: String?, description: String?, photo: Api.Photo?, embedUrl: String?, embedType: String?, embedWidth: Int32?, embedHeight: Int32?, duration: Int32?, author: String?, document: Api.Document?, cachedPage: Api.Page?, attributes: [Api.WebPageAttribute]?)
case webPageEmpty(flags: Int32, id: Int64, url: String?)
case webPageNotModified(flags: Int32, cachedPageViews: Int32?)
case webPagePending(flags: Int32, id: Int64, url: String?, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
if boxed {
buffer.appendInt32(-392411726)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
serializeString(url, buffer: buffer, boxed: false)
serializeString(displayUrl, buffer: buffer, boxed: false)
serializeInt32(hash, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(type!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(siteName!, 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(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {photo!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedUrl!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 5) != 0 {serializeString(embedType!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedWidth!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeInt32(embedHeight!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 7) != 0 {serializeInt32(duration!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 8) != 0 {serializeString(author!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 9) != 0 {document!.serialize(buffer, true)}
if Int(flags) & Int(1 << 10) != 0 {cachedPage!.serialize(buffer, true)}
if Int(flags) & Int(1 << 12) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(attributes!.count))
for item in attributes! {
item.serialize(buffer, true)
}}
break
case .webPageEmpty(let flags, let id, let url):
if boxed {
buffer.appendInt32(555358088)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
break
case .webPageNotModified(let flags, let cachedPageViews):
if boxed {
buffer.appendInt32(1930545681)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(cachedPageViews!, buffer: buffer, boxed: false)}
break
case .webPagePending(let flags, let id, let url, let date):
if boxed {
buffer.appendInt32(-1328464313)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(id, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webPage(let flags, let id, let url, let displayUrl, let hash, let type, let siteName, let title, let description, let photo, let embedUrl, let embedType, let embedWidth, let embedHeight, let duration, let author, let document, let cachedPage, let attributes):
return ("webPage", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("displayUrl", displayUrl as Any), ("hash", hash as Any), ("type", type as Any), ("siteName", siteName as Any), ("title", title as Any), ("description", description as Any), ("photo", photo as Any), ("embedUrl", embedUrl as Any), ("embedType", embedType as Any), ("embedWidth", embedWidth as Any), ("embedHeight", embedHeight as Any), ("duration", duration as Any), ("author", author as Any), ("document", document as Any), ("cachedPage", cachedPage as Any), ("attributes", attributes as Any)])
case .webPageEmpty(let flags, let id, let url):
return ("webPageEmpty", [("flags", flags as Any), ("id", id as Any), ("url", url as Any)])
case .webPageNotModified(let flags, let cachedPageViews):
return ("webPageNotModified", [("flags", flags as Any), ("cachedPageViews", cachedPageViews as Any)])
case .webPagePending(let flags, let id, let url, let date):
return ("webPagePending", [("flags", flags as Any), ("id", id as Any), ("url", url as Any), ("date", date as Any)])
}
}
public static func parse_webPage(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
_3 = parseString(reader)
var _4: String?
_4 = parseString(reader)
var _5: Int32?
_5 = reader.readInt32()
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
var _7: String?
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
var _8: String?
if Int(_1!) & Int(1 << 2) != 0 {_8 = parseString(reader) }
var _9: String?
if Int(_1!) & Int(1 << 3) != 0 {_9 = parseString(reader) }
var _10: Api.Photo?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_10 = Api.parse(reader, signature: signature) as? Api.Photo
} }
var _11: String?
if Int(_1!) & Int(1 << 5) != 0 {_11 = parseString(reader) }
var _12: String?
if Int(_1!) & Int(1 << 5) != 0 {_12 = parseString(reader) }
var _13: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_13 = reader.readInt32() }
var _14: Int32?
if Int(_1!) & Int(1 << 6) != 0 {_14 = reader.readInt32() }
var _15: Int32?
if Int(_1!) & Int(1 << 7) != 0 {_15 = reader.readInt32() }
var _16: String?
if Int(_1!) & Int(1 << 8) != 0 {_16 = parseString(reader) }
var _17: Api.Document?
if Int(_1!) & Int(1 << 9) != 0 {if let signature = reader.readInt32() {
_17 = Api.parse(reader, signature: signature) as? Api.Document
} }
var _18: Api.Page?
if Int(_1!) & Int(1 << 10) != 0 {if let signature = reader.readInt32() {
_18 = Api.parse(reader, signature: signature) as? Api.Page
} }
var _19: [Api.WebPageAttribute]?
if Int(_1!) & Int(1 << 12) != 0 {if let _ = reader.readInt32() {
_19 = Api.parseVector(reader, elementSignature: 0, elementType: Api.WebPageAttribute.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 2) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 3) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 4) == 0) || _10 != nil
let _c11 = (Int(_1!) & Int(1 << 5) == 0) || _11 != nil
let _c12 = (Int(_1!) & Int(1 << 5) == 0) || _12 != nil
let _c13 = (Int(_1!) & Int(1 << 6) == 0) || _13 != nil
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
let _c15 = (Int(_1!) & Int(1 << 7) == 0) || _15 != nil
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
let _c18 = (Int(_1!) & Int(1 << 10) == 0) || _18 != nil
let _c19 = (Int(_1!) & Int(1 << 12) == 0) || _19 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 && _c18 && _c19 {
return Api.WebPage.webPage(flags: _1!, id: _2!, url: _3!, displayUrl: _4!, hash: _5!, type: _6, siteName: _7, title: _8, description: _9, photo: _10, embedUrl: _11, embedType: _12, embedWidth: _13, embedHeight: _14, duration: _15, author: _16, document: _17, cachedPage: _18, attributes: _19)
}
else {
return nil
}
}
public static func parse_webPageEmpty(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.WebPage.webPageEmpty(flags: _1!, id: _2!, url: _3)
}
else {
return nil
}
}
public static func parse_webPageNotModified(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
if _c1 && _c2 {
return Api.WebPage.webPageNotModified(flags: _1!, cachedPageViews: _2)
}
else {
return nil
}
}
public static func parse_webPagePending(_ reader: BufferReader) -> WebPage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.WebPage.webPagePending(flags: _1!, id: _2!, url: _3, date: _4!)
}
else {
return nil
}
}
}
}
public extension Api { public extension Api {
indirect enum WebPageAttribute: TypeConstructorDescription { indirect enum WebPageAttribute: TypeConstructorDescription {
case webPageAttributeStickerSet(flags: Int32, stickers: [Api.Document]) case webPageAttributeStickerSet(flags: Int32, stickers: [Api.Document])
@ -1230,137 +1434,3 @@ public extension Api.account {
} }
} }
public extension Api.account {
enum SentEmailCode: TypeConstructorDescription {
case sentEmailCode(emailPattern: String, length: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sentEmailCode(let emailPattern, let length):
if boxed {
buffer.appendInt32(-2128640689)
}
serializeString(emailPattern, buffer: buffer, boxed: false)
serializeInt32(length, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sentEmailCode(let emailPattern, let length):
return ("sentEmailCode", [("emailPattern", emailPattern as Any), ("length", length as Any)])
}
}
public static func parse_sentEmailCode(_ reader: BufferReader) -> SentEmailCode? {
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.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum Takeout: TypeConstructorDescription {
case takeout(id: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .takeout(let id):
if boxed {
buffer.appendInt32(1304052993)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .takeout(let id):
return ("takeout", [("id", id as Any)])
}
}
public static func parse_takeout(_ reader: BufferReader) -> Takeout? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.account.Takeout.takeout(id: _1!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum Themes: TypeConstructorDescription {
case themes(hash: Int64, themes: [Api.Theme])
case themesNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .themes(let hash, let themes):
if boxed {
buffer.appendInt32(-1707242387)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(themes.count))
for item in themes {
item.serialize(buffer, true)
}
break
case .themesNotModified:
if boxed {
buffer.appendInt32(-199313886)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .themes(let hash, let themes):
return ("themes", [("hash", hash as Any), ("themes", themes as Any)])
case .themesNotModified:
return ("themesNotModified", [])
}
}
public static func parse_themes(_ reader: BufferReader) -> Themes? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.Theme]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.Themes.themes(hash: _1!, themes: _2!)
}
else {
return nil
}
}
public static func parse_themesNotModified(_ reader: BufferReader) -> Themes? {
return Api.account.Themes.themesNotModified
}
}
}

View File

@ -1,3 +1,137 @@
public extension Api.account {
enum SentEmailCode: TypeConstructorDescription {
case sentEmailCode(emailPattern: String, length: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sentEmailCode(let emailPattern, let length):
if boxed {
buffer.appendInt32(-2128640689)
}
serializeString(emailPattern, buffer: buffer, boxed: false)
serializeInt32(length, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sentEmailCode(let emailPattern, let length):
return ("sentEmailCode", [("emailPattern", emailPattern as Any), ("length", length as Any)])
}
}
public static func parse_sentEmailCode(_ reader: BufferReader) -> SentEmailCode? {
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.account.SentEmailCode.sentEmailCode(emailPattern: _1!, length: _2!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum Takeout: TypeConstructorDescription {
case takeout(id: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .takeout(let id):
if boxed {
buffer.appendInt32(1304052993)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .takeout(let id):
return ("takeout", [("id", id as Any)])
}
}
public static func parse_takeout(_ reader: BufferReader) -> Takeout? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.account.Takeout.takeout(id: _1!)
}
else {
return nil
}
}
}
}
public extension Api.account {
enum Themes: TypeConstructorDescription {
case themes(hash: Int64, themes: [Api.Theme])
case themesNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .themes(let hash, let themes):
if boxed {
buffer.appendInt32(-1707242387)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(themes.count))
for item in themes {
item.serialize(buffer, true)
}
break
case .themesNotModified:
if boxed {
buffer.appendInt32(-199313886)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .themes(let hash, let themes):
return ("themes", [("hash", hash as Any), ("themes", themes as Any)])
case .themesNotModified:
return ("themesNotModified", [])
}
}
public static func parse_themes(_ reader: BufferReader) -> Themes? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Api.Theme]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Theme.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.account.Themes.themes(hash: _1!, themes: _2!)
}
else {
return nil
}
}
public static func parse_themesNotModified(_ reader: BufferReader) -> Themes? {
return Api.account.Themes.themesNotModified
}
}
}
public extension Api.account { public extension Api.account {
enum TmpPassword: TypeConstructorDescription { enum TmpPassword: TypeConstructorDescription {
case tmpPassword(tmpPassword: Buffer, validUntil: Int32) case tmpPassword(tmpPassword: Buffer, validUntil: Int32)
@ -876,97 +1010,3 @@ public extension Api.auth {
} }
} }
public extension Api.bots {
enum BotInfo: TypeConstructorDescription {
case botInfo(name: String, about: String, description: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .botInfo(let name, let about, let description):
if boxed {
buffer.appendInt32(-391678544)
}
serializeString(name, buffer: buffer, boxed: false)
serializeString(about, buffer: buffer, boxed: false)
serializeString(description, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .botInfo(let name, let about, let description):
return ("botInfo", [("name", name as Any), ("about", about as Any), ("description", description as Any)])
}
}
public static func parse_botInfo(_ reader: BufferReader) -> BotInfo? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.bots.BotInfo.botInfo(name: _1!, about: _2!, description: _3!)
}
else {
return nil
}
}
}
}
public extension Api.bots {
enum PopularAppBots: TypeConstructorDescription {
case popularAppBots(flags: Int32, nextOffset: String?, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .popularAppBots(let flags, let nextOffset, let users):
if boxed {
buffer.appendInt32(428978491)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .popularAppBots(let flags, let nextOffset, let users):
return ("popularAppBots", [("flags", flags as Any), ("nextOffset", nextOffset as Any), ("users", users as Any)])
}
}
public static func parse_popularAppBots(_ reader: BufferReader) -> PopularAppBots? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.bots.PopularAppBots.popularAppBots(flags: _1!, nextOffset: _2, users: _3!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,97 @@
public extension Api.bots {
enum BotInfo: TypeConstructorDescription {
case botInfo(name: String, about: String, description: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .botInfo(let name, let about, let description):
if boxed {
buffer.appendInt32(-391678544)
}
serializeString(name, buffer: buffer, boxed: false)
serializeString(about, buffer: buffer, boxed: false)
serializeString(description, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .botInfo(let name, let about, let description):
return ("botInfo", [("name", name as Any), ("about", about as Any), ("description", description as Any)])
}
}
public static func parse_botInfo(_ reader: BufferReader) -> BotInfo? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.bots.BotInfo.botInfo(name: _1!, about: _2!, description: _3!)
}
else {
return nil
}
}
}
}
public extension Api.bots {
enum PopularAppBots: TypeConstructorDescription {
case popularAppBots(flags: Int32, nextOffset: String?, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .popularAppBots(let flags, let nextOffset, let users):
if boxed {
buffer.appendInt32(428978491)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .popularAppBots(let flags, let nextOffset, let users):
return ("popularAppBots", [("flags", flags as Any), ("nextOffset", nextOffset as Any), ("users", users as Any)])
}
}
public static func parse_popularAppBots(_ reader: BufferReader) -> PopularAppBots? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 0) != 0 {_2 = parseString(reader) }
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.bots.PopularAppBots.popularAppBots(flags: _1!, nextOffset: _2, users: _3!)
}
else {
return nil
}
}
}
}
public extension Api.bots { public extension Api.bots {
enum PreviewInfo: TypeConstructorDescription { enum PreviewInfo: TypeConstructorDescription {
case previewInfo(media: [Api.BotPreviewMedia], langCodes: [String]) case previewInfo(media: [Api.BotPreviewMedia], langCodes: [String])
@ -1398,61 +1492,3 @@ public extension Api.help {
} }
} }
public extension Api.help {
enum CountriesList: TypeConstructorDescription {
case countriesList(countries: [Api.help.Country], hash: Int32)
case countriesListNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .countriesList(let countries, let hash):
if boxed {
buffer.appendInt32(-2016381538)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(countries.count))
for item in countries {
item.serialize(buffer, true)
}
serializeInt32(hash, buffer: buffer, boxed: false)
break
case .countriesListNotModified:
if boxed {
buffer.appendInt32(-1815339214)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .countriesList(let countries, let hash):
return ("countriesList", [("countries", countries as Any), ("hash", hash as Any)])
case .countriesListNotModified:
return ("countriesListNotModified", [])
}
}
public static func parse_countriesList(_ reader: BufferReader) -> CountriesList? {
var _1: [Api.help.Country]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.Country.self)
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.help.CountriesList.countriesList(countries: _1!, hash: _2!)
}
else {
return nil
}
}
public static func parse_countriesListNotModified(_ reader: BufferReader) -> CountriesList? {
return Api.help.CountriesList.countriesListNotModified
}
}
}

View File

@ -1,3 +1,61 @@
public extension Api.help {
enum CountriesList: TypeConstructorDescription {
case countriesList(countries: [Api.help.Country], hash: Int32)
case countriesListNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .countriesList(let countries, let hash):
if boxed {
buffer.appendInt32(-2016381538)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(countries.count))
for item in countries {
item.serialize(buffer, true)
}
serializeInt32(hash, buffer: buffer, boxed: false)
break
case .countriesListNotModified:
if boxed {
buffer.appendInt32(-1815339214)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .countriesList(let countries, let hash):
return ("countriesList", [("countries", countries as Any), ("hash", hash as Any)])
case .countriesListNotModified:
return ("countriesListNotModified", [])
}
}
public static func parse_countriesList(_ reader: BufferReader) -> CountriesList? {
var _1: [Api.help.Country]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.help.Country.self)
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.help.CountriesList.countriesList(countries: _1!, hash: _2!)
}
else {
return nil
}
}
public static func parse_countriesListNotModified(_ reader: BufferReader) -> CountriesList? {
return Api.help.CountriesList.countriesListNotModified
}
}
}
public extension Api.help { public extension Api.help {
enum Country: TypeConstructorDescription { enum Country: TypeConstructorDescription {
case country(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode]) case country(flags: Int32, iso2: String, defaultName: String, name: String?, countryCodes: [Api.help.CountryCode])
@ -1236,117 +1294,3 @@ public extension Api.messages {
} }
} }
public extension Api.messages {
enum ArchivedStickers: TypeConstructorDescription {
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .archivedStickers(let count, let sets):
if boxed {
buffer.appendInt32(1338747336)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(sets.count))
for item in sets {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .archivedStickers(let count, let sets):
return ("archivedStickers", [("count", count as Any), ("sets", sets as Any)])
}
}
public static func parse_archivedStickers(_ reader: BufferReader) -> ArchivedStickers? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StickerSetCovered]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.ArchivedStickers.archivedStickers(count: _1!, sets: _2!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum AvailableEffects: TypeConstructorDescription {
case availableEffects(hash: Int32, effects: [Api.AvailableEffect], documents: [Api.Document])
case availableEffectsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .availableEffects(let hash, let effects, let documents):
if boxed {
buffer.appendInt32(-1109696146)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(effects.count))
for item in effects {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(documents.count))
for item in documents {
item.serialize(buffer, true)
}
break
case .availableEffectsNotModified:
if boxed {
buffer.appendInt32(-772957605)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .availableEffects(let hash, let effects, let documents):
return ("availableEffects", [("hash", hash as Any), ("effects", effects as Any), ("documents", documents as Any)])
case .availableEffectsNotModified:
return ("availableEffectsNotModified", [])
}
}
public static func parse_availableEffects(_ reader: BufferReader) -> AvailableEffects? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.AvailableEffect]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AvailableEffect.self)
}
var _3: [Api.Document]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.AvailableEffects.availableEffects(hash: _1!, effects: _2!, documents: _3!)
}
else {
return nil
}
}
public static func parse_availableEffectsNotModified(_ reader: BufferReader) -> AvailableEffects? {
return Api.messages.AvailableEffects.availableEffectsNotModified
}
}
}

View File

@ -1,3 +1,117 @@
public extension Api.messages {
enum ArchivedStickers: TypeConstructorDescription {
case archivedStickers(count: Int32, sets: [Api.StickerSetCovered])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .archivedStickers(let count, let sets):
if boxed {
buffer.appendInt32(1338747336)
}
serializeInt32(count, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(sets.count))
for item in sets {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .archivedStickers(let count, let sets):
return ("archivedStickers", [("count", count as Any), ("sets", sets as Any)])
}
}
public static func parse_archivedStickers(_ reader: BufferReader) -> ArchivedStickers? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.StickerSetCovered]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.StickerSetCovered.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.ArchivedStickers.archivedStickers(count: _1!, sets: _2!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum AvailableEffects: TypeConstructorDescription {
case availableEffects(hash: Int32, effects: [Api.AvailableEffect], documents: [Api.Document])
case availableEffectsNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .availableEffects(let hash, let effects, let documents):
if boxed {
buffer.appendInt32(-1109696146)
}
serializeInt32(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(effects.count))
for item in effects {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(documents.count))
for item in documents {
item.serialize(buffer, true)
}
break
case .availableEffectsNotModified:
if boxed {
buffer.appendInt32(-772957605)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .availableEffects(let hash, let effects, let documents):
return ("availableEffects", [("hash", hash as Any), ("effects", effects as Any), ("documents", documents as Any)])
case .availableEffectsNotModified:
return ("availableEffectsNotModified", [])
}
}
public static func parse_availableEffects(_ reader: BufferReader) -> AvailableEffects? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.AvailableEffect]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AvailableEffect.self)
}
var _3: [Api.Document]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Document.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.messages.AvailableEffects.availableEffects(hash: _1!, effects: _2!, documents: _3!)
}
else {
return nil
}
}
public static func parse_availableEffectsNotModified(_ reader: BufferReader) -> AvailableEffects? {
return Api.messages.AvailableEffects.availableEffectsNotModified
}
}
}
public extension Api.messages { public extension Api.messages {
enum AvailableReactions: TypeConstructorDescription { enum AvailableReactions: TypeConstructorDescription {
case availableReactions(hash: Int32, reactions: [Api.AvailableReaction]) case availableReactions(hash: Int32, reactions: [Api.AvailableReaction])
@ -1342,91 +1456,3 @@ public extension Api.messages {
} }
} }
public extension Api.messages {
enum HighScores: TypeConstructorDescription {
case highScores(scores: [Api.HighScore], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .highScores(let scores, let users):
if boxed {
buffer.appendInt32(-1707344487)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(scores.count))
for item in scores {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .highScores(let scores, let users):
return ("highScores", [("scores", scores as Any), ("users", users as Any)])
}
}
public static func parse_highScores(_ reader: BufferReader) -> HighScores? {
var _1: [Api.HighScore]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.HighScore.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.HighScores.highScores(scores: _1!, users: _2!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum HistoryImport: TypeConstructorDescription {
case historyImport(id: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .historyImport(let id):
if boxed {
buffer.appendInt32(375566091)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .historyImport(let id):
return ("historyImport", [("id", id as Any)])
}
}
public static func parse_historyImport(_ reader: BufferReader) -> HistoryImport? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.messages.HistoryImport.historyImport(id: _1!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,91 @@
public extension Api.messages {
enum HighScores: TypeConstructorDescription {
case highScores(scores: [Api.HighScore], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .highScores(let scores, let users):
if boxed {
buffer.appendInt32(-1707344487)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(scores.count))
for item in scores {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .highScores(let scores, let users):
return ("highScores", [("scores", scores as Any), ("users", users as Any)])
}
}
public static func parse_highScores(_ reader: BufferReader) -> HighScores? {
var _1: [Api.HighScore]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.HighScore.self)
}
var _2: [Api.User]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.messages.HighScores.highScores(scores: _1!, users: _2!)
}
else {
return nil
}
}
}
}
public extension Api.messages {
enum HistoryImport: TypeConstructorDescription {
case historyImport(id: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .historyImport(let id):
if boxed {
buffer.appendInt32(375566091)
}
serializeInt64(id, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .historyImport(let id):
return ("historyImport", [("id", id as Any)])
}
}
public static func parse_historyImport(_ reader: BufferReader) -> HistoryImport? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.messages.HistoryImport.historyImport(id: _1!)
}
else {
return nil
}
}
}
}
public extension Api.messages { public extension Api.messages {
enum HistoryImportParsed: TypeConstructorDescription { enum HistoryImportParsed: TypeConstructorDescription {
case historyImportParsed(flags: Int32, title: String?) case historyImportParsed(flags: Int32, title: String?)
@ -1452,85 +1540,3 @@ public extension Api.messages {
} }
} }
public extension Api.messages {
enum SponsoredMessages: TypeConstructorDescription {
case sponsoredMessages(flags: Int32, postsBetween: Int32?, messages: [Api.SponsoredMessage], chats: [Api.Chat], users: [Api.User])
case sponsoredMessagesEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sponsoredMessages(let flags, let postsBetween, let messages, let chats, let users):
if boxed {
buffer.appendInt32(-907141753)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(postsBetween!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .sponsoredMessagesEmpty:
if boxed {
buffer.appendInt32(406407439)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sponsoredMessages(let flags, let postsBetween, let messages, let chats, let users):
return ("sponsoredMessages", [("flags", flags as Any), ("postsBetween", postsBetween as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .sponsoredMessagesEmpty:
return ("sponsoredMessagesEmpty", [])
}
}
public static func parse_sponsoredMessages(_ reader: BufferReader) -> SponsoredMessages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
var _3: [Api.SponsoredMessage]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SponsoredMessage.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = (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.messages.SponsoredMessages.sponsoredMessages(flags: _1!, postsBetween: _2, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
public static func parse_sponsoredMessagesEmpty(_ reader: BufferReader) -> SponsoredMessages? {
return Api.messages.SponsoredMessages.sponsoredMessagesEmpty
}
}
}

View File

@ -1,3 +1,85 @@
public extension Api.messages {
enum SponsoredMessages: TypeConstructorDescription {
case sponsoredMessages(flags: Int32, postsBetween: Int32?, messages: [Api.SponsoredMessage], chats: [Api.Chat], users: [Api.User])
case sponsoredMessagesEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .sponsoredMessages(let flags, let postsBetween, let messages, let chats, let users):
if boxed {
buffer.appendInt32(-907141753)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(postsBetween!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(messages.count))
for item in messages {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .sponsoredMessagesEmpty:
if boxed {
buffer.appendInt32(406407439)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .sponsoredMessages(let flags, let postsBetween, let messages, let chats, let users):
return ("sponsoredMessages", [("flags", flags as Any), ("postsBetween", postsBetween as Any), ("messages", messages as Any), ("chats", chats as Any), ("users", users as Any)])
case .sponsoredMessagesEmpty:
return ("sponsoredMessagesEmpty", [])
}
}
public static func parse_sponsoredMessages(_ reader: BufferReader) -> SponsoredMessages? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
var _3: [Api.SponsoredMessage]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.SponsoredMessage.self)
}
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = (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.messages.SponsoredMessages.sponsoredMessages(flags: _1!, postsBetween: _2, messages: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
public static func parse_sponsoredMessagesEmpty(_ reader: BufferReader) -> SponsoredMessages? {
return Api.messages.SponsoredMessages.sponsoredMessagesEmpty
}
}
}
public extension Api.messages { public extension Api.messages {
enum StickerSet: TypeConstructorDescription { enum StickerSet: TypeConstructorDescription {
case stickerSet(set: Api.StickerSet, packs: [Api.StickerPack], keywords: [Api.StickerKeyword], documents: [Api.Document]) case stickerSet(set: Api.StickerSet, packs: [Api.StickerPack], keywords: [Api.StickerKeyword], documents: [Api.Document])
@ -1425,113 +1507,23 @@ public extension Api.payments {
} }
} }
public extension Api.payments { public extension Api.payments {
enum ValidatedRequestedInfo: TypeConstructorDescription { enum UserStarGifts: TypeConstructorDescription {
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?) case userStarGifts(flags: Int32, count: Int32, gifts: [Api.UserStarGift], nextOffset: String?, users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) { public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self { switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions): case .userStarGifts(let flags, let count, let gifts, let nextOffset, let users):
if boxed { if boxed {
buffer.appendInt32(-784000893) buffer.appendInt32(1801827607)
} }
serializeInt32(flags, buffer: buffer, boxed: false) serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(id!, buffer: buffer, boxed: false)} serializeInt32(count, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(shippingOptions!.count))
for item in shippingOptions! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
return ("validatedRequestedInfo", [("flags", flags as Any), ("id", id as Any), ("shippingOptions", shippingOptions as Any)])
}
}
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(flags: _1!, id: _2, shippingOptions: _3)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum ExportedGroupCallInvite: TypeConstructorDescription {
case exportedGroupCallInvite(link: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .exportedGroupCallInvite(let link):
if boxed {
buffer.appendInt32(541839704)
}
serializeString(link, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .exportedGroupCallInvite(let link):
return ("exportedGroupCallInvite", [("link", link as Any)])
}
}
public static func parse_exportedGroupCallInvite(_ reader: BufferReader) -> ExportedGroupCallInvite? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum GroupCall: TypeConstructorDescription {
case groupCall(call: Api.GroupCall, participants: [Api.GroupCallParticipant], participantsNextOffset: String, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
if boxed {
buffer.appendInt32(-1636664659)
}
call.serialize(buffer, true)
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count)) buffer.appendInt32(Int32(gifts.count))
for item in participants { for item in gifts {
item.serialize(buffer, true)
}
serializeString(participantsNextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true) item.serialize(buffer, true)
} }
if Int(flags) & Int(1 << 0) != 0 {serializeString(nextOffset!, buffer: buffer, boxed: false)}
buffer.appendInt32(481674261) buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count)) buffer.appendInt32(Int32(users.count))
for item in users { for item in users {
@ -1543,26 +1535,22 @@ public extension Api.phone {
public func descriptionFields() -> (String, [(String, Any)]) { public func descriptionFields() -> (String, [(String, Any)]) {
switch self { switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users): case .userStarGifts(let flags, let count, let gifts, let nextOffset, let users):
return ("groupCall", [("call", call as Any), ("participants", participants as Any), ("participantsNextOffset", participantsNextOffset as Any), ("chats", chats as Any), ("users", users as Any)]) return ("userStarGifts", [("flags", flags as Any), ("count", count as Any), ("gifts", gifts as Any), ("nextOffset", nextOffset as Any), ("users", users as Any)])
} }
} }
public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? { public static func parse_userStarGifts(_ reader: BufferReader) -> UserStarGifts? {
var _1: Api.GroupCall? var _1: Int32?
if let signature = reader.readInt32() { _1 = reader.readInt32()
_1 = Api.parse(reader, signature: signature) as? Api.GroupCall var _2: Int32?
} _2 = reader.readInt32()
var _2: [Api.GroupCallParticipant]? var _3: [Api.UserStarGift]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self) _3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.UserStarGift.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
} }
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
var _5: [Api.User]? var _5: [Api.User]?
if let _ = reader.readInt32() { if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self) _5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
@ -1570,10 +1558,10 @@ public extension Api.phone {
let _c1 = _1 != nil let _c1 = _1 != nil
let _c2 = _2 != nil let _c2 = _2 != nil
let _c3 = _3 != nil let _c3 = _3 != nil
let _c4 = _4 != nil let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
let _c5 = _5 != nil let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 { if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!) return Api.payments.UserStarGifts.userStarGifts(flags: _1!, count: _2!, gifts: _3!, nextOffset: _4, users: _5!)
} }
else { else {
return nil return nil

View File

@ -1,3 +1,161 @@
public extension Api.payments {
enum ValidatedRequestedInfo: TypeConstructorDescription {
case validatedRequestedInfo(flags: Int32, id: String?, shippingOptions: [Api.ShippingOption]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
if boxed {
buffer.appendInt32(-784000893)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(id!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(shippingOptions!.count))
for item in shippingOptions! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .validatedRequestedInfo(let flags, let id, let shippingOptions):
return ("validatedRequestedInfo", [("flags", flags as Any), ("id", id as Any), ("shippingOptions", shippingOptions as Any)])
}
}
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(flags: _1!, id: _2, shippingOptions: _3)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum ExportedGroupCallInvite: TypeConstructorDescription {
case exportedGroupCallInvite(link: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .exportedGroupCallInvite(let link):
if boxed {
buffer.appendInt32(541839704)
}
serializeString(link, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .exportedGroupCallInvite(let link):
return ("exportedGroupCallInvite", [("link", link as Any)])
}
}
public static func parse_exportedGroupCallInvite(_ reader: BufferReader) -> ExportedGroupCallInvite? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.phone.ExportedGroupCallInvite.exportedGroupCallInvite(link: _1!)
}
else {
return nil
}
}
}
}
public extension Api.phone {
enum GroupCall: TypeConstructorDescription {
case groupCall(call: Api.GroupCall, participants: [Api.GroupCallParticipant], participantsNextOffset: String, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
if boxed {
buffer.appendInt32(-1636664659)
}
call.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(participants.count))
for item in participants {
item.serialize(buffer, true)
}
serializeString(participantsNextOffset, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .groupCall(let call, let participants, let participantsNextOffset, let chats, let users):
return ("groupCall", [("call", call as Any), ("participants", participants as Any), ("participantsNextOffset", participantsNextOffset as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_groupCall(_ reader: BufferReader) -> GroupCall? {
var _1: Api.GroupCall?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.GroupCall
}
var _2: [Api.GroupCallParticipant]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.GroupCallParticipant.self)
}
var _3: String?
_3 = parseString(reader)
var _4: [Api.Chat]?
if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _5: [Api.User]?
if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.phone.GroupCall.groupCall(call: _1!, participants: _2!, participantsNextOffset: _3!, chats: _4!, users: _5!)
}
else {
return nil
}
}
}
}
public extension Api.phone { public extension Api.phone {
enum GroupCallStreamChannels: TypeConstructorDescription { enum GroupCallStreamChannels: TypeConstructorDescription {
case groupCallStreamChannels(channels: [Api.GroupCallStreamChannel]) case groupCallStreamChannels(channels: [Api.GroupCallStreamChannel])

View File

@ -8838,6 +8838,22 @@ public extension Api.functions.payments {
}) })
} }
} }
public extension Api.functions.payments {
static func convertStarGift(userId: Api.InputUser, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(69328935)
userId.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.convertStarGift", parameters: [("userId", String(describing: userId)), ("msgId", String(describing: msgId))]), 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.payments { public extension Api.functions.payments {
static func exportInvoice(invoiceMedia: Api.InputMedia) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.ExportedInvoice>) { static func exportInvoice(invoiceMedia: Api.InputMedia) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.ExportedInvoice>) {
let buffer = Buffer() let buffer = Buffer()
@ -9144,6 +9160,23 @@ public extension Api.functions.payments {
}) })
} }
} }
public extension Api.functions.payments {
static func getUserStarGifts(userId: Api.InputUser, offset: String, limit: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.UserStarGifts>) {
let buffer = Buffer()
buffer.appendInt32(1584580577)
userId.serialize(buffer, true)
serializeString(offset, buffer: buffer, boxed: false)
serializeInt32(limit, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.getUserStarGifts", parameters: [("userId", String(describing: userId)), ("offset", String(describing: offset)), ("limit", String(describing: limit))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.UserStarGifts? in
let reader = BufferReader(buffer)
var result: Api.payments.UserStarGifts?
if let signature = reader.readInt32() {
result = Api.parse(reader, signature: signature) as? Api.payments.UserStarGifts
}
return result
})
}
}
public extension Api.functions.payments { public extension Api.functions.payments {
static func launchPrepaidGiveaway(peer: Api.InputPeer, giveawayId: Int64, purpose: Api.InputStorePaymentPurpose) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) { static func launchPrepaidGiveaway(peer: Api.InputPeer, giveawayId: Int64, purpose: Api.InputStorePaymentPurpose) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Updates>) {
let buffer = Buffer() let buffer = Buffer()
@ -9177,6 +9210,22 @@ public extension Api.functions.payments {
}) })
} }
} }
public extension Api.functions.payments {
static func saveStarGift(userId: Api.InputUser, msgId: Int32) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.Bool>) {
let buffer = Buffer()
buffer.appendInt32(-1394197223)
userId.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
return (FunctionDescription(name: "payments.saveStarGift", parameters: [("userId", String(describing: userId)), ("msgId", String(describing: msgId))]), 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.payments { public extension Api.functions.payments {
static func sendPaymentForm(flags: Int32, formId: Int64, invoice: Api.InputInvoice, requestedInfoId: String?, shippingOptionId: String?, credentials: Api.InputPaymentCredentials, tipAmount: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentResult>) { static func sendPaymentForm(flags: Int32, formId: Int64, invoice: Api.InputInvoice, requestedInfoId: String?, shippingOptionId: String?, credentials: Api.InputPaymentCredentials, tipAmount: Int64?) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentResult>) {
let buffer = Buffer() let buffer = Buffer()
@ -9199,13 +9248,12 @@ public extension Api.functions.payments {
} }
} }
public extension Api.functions.payments { public extension Api.functions.payments {
static func sendStarsForm(flags: Int32, formId: Int64, invoice: Api.InputInvoice) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentResult>) { static func sendStarsForm(formId: Int64, invoice: Api.InputInvoice) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.PaymentResult>) {
let buffer = Buffer() let buffer = Buffer()
buffer.appendInt32(45839133) buffer.appendInt32(2040056084)
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(formId, buffer: buffer, boxed: false) serializeInt64(formId, buffer: buffer, boxed: false)
invoice.serialize(buffer, true) invoice.serialize(buffer, true)
return (FunctionDescription(name: "payments.sendStarsForm", parameters: [("flags", String(describing: flags)), ("formId", String(describing: formId)), ("invoice", String(describing: invoice))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentResult? in return (FunctionDescription(name: "payments.sendStarsForm", parameters: [("formId", String(describing: formId)), ("invoice", String(describing: invoice))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.PaymentResult? in
let reader = BufferReader(buffer) let reader = BufferReader(buffer)
var result: Api.payments.PaymentResult? var result: Api.payments.PaymentResult?
if let signature = reader.readInt32() { if let signature = reader.readInt32() {

View File

@ -150,7 +150,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
return TelegramMediaAction(action: .paymentRefunded(peerId: peer.peerId, currency: currency, totalAmount: totalAmount, payload: payload?.makeData(), transactionId: transactionId)) return TelegramMediaAction(action: .paymentRefunded(peerId: peer.peerId, currency: currency, totalAmount: totalAmount, payload: payload?.makeData(), transactionId: transactionId))
case let .messageActionPrizeStars(flags, stars, transactionId, boostPeer, giveawayMsgId): case let .messageActionPrizeStars(flags, stars, transactionId, boostPeer, giveawayMsgId):
return TelegramMediaAction(action: .prizeStars(amount: stars, isUnclaimed: (flags & (1 << 2)) != 0, boostPeerId: boostPeer.peerId, transactionId: transactionId, giveawayMessageId: MessageId(peerId: boostPeer.peerId, namespace: Namespaces.Message.Cloud, id: giveawayMsgId))) return TelegramMediaAction(action: .prizeStars(amount: stars, isUnclaimed: (flags & (1 << 2)) != 0, boostPeerId: boostPeer.peerId, transactionId: transactionId, giveawayMessageId: MessageId(peerId: boostPeer.peerId, namespace: Namespaces.Message.Cloud, id: giveawayMsgId)))
case let .messageActionStarGift(flags, starsAmount, giftId, limitedNumber, limitedTotal, message): case let .messageActionStarGift(flags, apiGift, message, convertStars):
let text: String? let text: String?
let entities: [MessageTextEntity]? let entities: [MessageTextEntity]?
switch message { switch message {
@ -161,7 +161,10 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
text = nil text = nil
entities = nil entities = nil
} }
return TelegramMediaAction(action: .starGift(amount: starsAmount, giftId: giftId, nameHidden: (flags & (1 << 2)) != 0, limitNumber: limitedNumber, limitTotal: limitedTotal, text: text, entities: entities)) guard let gift = StarGift(apiStarGift: apiGift) else {
return nil
}
return TelegramMediaAction(action: .starGift(gift: gift, convertStars: convertStars, text: text, entities: entities, nameHidden: (flags & (1 << 0)) != 0, savedToProfile: (flags & (1 << 2)) != 0, converted: (flags & (1 << 3)) != 0))
} }
} }

View File

@ -130,7 +130,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
case paymentRefunded(peerId: PeerId, currency: String, totalAmount: Int64, payload: Data?, transactionId: String) case paymentRefunded(peerId: PeerId, currency: String, totalAmount: Int64, payload: Data?, transactionId: String)
case giftStars(currency: String, amount: Int64, count: Int64, cryptoCurrency: String?, cryptoAmount: Int64?, transactionId: String?) case giftStars(currency: String, amount: Int64, count: Int64, cryptoCurrency: String?, cryptoAmount: Int64?, transactionId: String?)
case prizeStars(amount: Int64, isUnclaimed: Bool, boostPeerId: PeerId?, transactionId: String?, giveawayMessageId: MessageId?) case prizeStars(amount: Int64, isUnclaimed: Bool, boostPeerId: PeerId?, transactionId: String?, giveawayMessageId: MessageId?)
case starGift(amount: Int64, giftId: Int64, nameHidden: Bool, limitNumber: Int32?, limitTotal: Int32?, text: String?, entities: [MessageTextEntity]?) case starGift(gift: StarGift, convertStars: Int64, text: String?, entities: [MessageTextEntity]?, nameHidden: Bool, savedToProfile: Bool, converted: Bool)
public init(decoder: PostboxDecoder) { public init(decoder: PostboxDecoder) {
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0) let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
@ -252,7 +252,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
} }
self = .prizeStars(amount: decoder.decodeInt64ForKey("amount", orElse: 0), isUnclaimed: decoder.decodeBoolForKey("unclaimed", orElse: false), boostPeerId: boostPeerId, transactionId: decoder.decodeOptionalStringForKey("transactionId"), giveawayMessageId: giveawayMessageId) self = .prizeStars(amount: decoder.decodeInt64ForKey("amount", orElse: 0), isUnclaimed: decoder.decodeBoolForKey("unclaimed", orElse: false), boostPeerId: boostPeerId, transactionId: decoder.decodeOptionalStringForKey("transactionId"), giveawayMessageId: giveawayMessageId)
case 44: case 44:
self = .starGift(amount: decoder.decodeInt64ForKey("amount", orElse: 0), giftId: decoder.decodeInt64ForKey("giftId", orElse: 0), nameHidden: decoder.decodeBoolForKey("nameHidden", orElse: false), limitNumber: decoder.decodeOptionalInt32ForKey("limitNumber"), limitTotal: decoder.decodeOptionalInt32ForKey("limitTotal"), text: decoder.decodeOptionalStringForKey("text"), entities: decoder.decodeOptionalObjectArrayWithDecoderForKey("entities")) self = .starGift(gift: decoder.decodeObjectForKey("gift", decoder: { StarGift(decoder: $0) }) as! StarGift, convertStars: decoder.decodeInt64ForKey("convertStars", orElse: 0), text: decoder.decodeOptionalStringForKey("text"), entities: decoder.decodeOptionalObjectArrayWithDecoderForKey("entities"), nameHidden: decoder.decodeBoolForKey("nameHidden", orElse: false), savedToProfile: decoder.decodeBoolForKey("savedToProfile", orElse: false), converted: decoder.decodeBoolForKey("converted", orElse: false))
default: default:
self = .unknown self = .unknown
} }
@ -528,18 +528,10 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
} else { } else {
encoder.encodeNil(forKey: "giveawayMsgId") encoder.encodeNil(forKey: "giveawayMsgId")
} }
case let .starGift(amount, giftId, nameHidden, limitNumber, limitTotal, text, entities): case let .starGift(gift, convertStars, text, entities, nameHidden, savedToProfile, converted):
encoder.encodeInt32(44, forKey: "_rawValue") encoder.encodeInt32(44, forKey: "_rawValue")
encoder.encodeInt64(amount, forKey: "amount") encoder.encodeObject(gift, forKey: "gift")
encoder.encodeInt64(giftId, forKey: "giftId") encoder.encodeInt64(convertStars, forKey: "convertStars")
encoder.encodeBool(nameHidden, forKey: "nameHidden")
if let limitNumber, let limitTotal {
encoder.encodeInt32(limitNumber, forKey: "limitNumber")
encoder.encodeInt32(limitTotal, forKey: "limitTotal")
} else {
encoder.encodeNil(forKey: "limitNumber")
encoder.encodeNil(forKey: "limitTotal")
}
if let text, let entities { if let text, let entities {
encoder.encodeString(text, forKey: "text") encoder.encodeString(text, forKey: "text")
encoder.encodeObjectArray(entities, forKey: "entities") encoder.encodeObjectArray(entities, forKey: "entities")
@ -547,6 +539,9 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
encoder.encodeNil(forKey: "text") encoder.encodeNil(forKey: "text")
encoder.encodeNil(forKey: "entities") encoder.encodeNil(forKey: "entities")
} }
encoder.encodeBool(nameHidden, forKey: "nameHidden")
encoder.encodeBool(savedToProfile, forKey: "savedToProfile")
encoder.encodeBool(converted, forKey: "converted")
} }
} }

View File

@ -347,7 +347,7 @@ func _internal_parseInputInvoice(transaction: Transaction, source: BotPaymentInv
} }
return .inputInvoiceStars(purpose: .inputStorePaymentStarsGiveaway(flags: flags, stars: stars, boostPeer: apiBoostPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: currency, amount: amount, users: users)) return .inputInvoiceStars(purpose: .inputStorePaymentStarsGiveaway(flags: flags, stars: stars, boostPeer: apiBoostPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: currency, amount: amount, users: users))
case let .starGift(hideName, peerId, giftId, text, entities): case let .starGift(hideName, peerId, giftId, text, entities):
guard let peer = transaction.getPeer(peerId), let apiPeer = apiInputPeer(peer) else { guard let peer = transaction.getPeer(peerId), let inputUser = apiInputUser(peer) else {
return nil return nil
} }
var flags: Int32 = 0 var flags: Int32 = 0
@ -359,7 +359,7 @@ func _internal_parseInputInvoice(transaction: Transaction, source: BotPaymentInv
flags |= (1 << 1) flags |= (1 << 1)
message = .textWithEntities(text: text, entities: entities.flatMap { apiEntitiesFromMessageTextEntities($0, associatedPeers: SimpleDictionary()) } ?? []) message = .textWithEntities(text: text, entities: entities.flatMap { apiEntitiesFromMessageTextEntities($0, associatedPeers: SimpleDictionary()) } ?? [])
} }
return .inputInvoiceStarGift(flags: flags, peer: apiPeer, giftId: giftId, message: message) return .inputInvoiceStarGift(flags: flags, userId: inputUser, giftId: giftId, message: message)
} }
} }

View File

@ -27,7 +27,7 @@ public final class StarGiftsList: Codable, Equatable {
} }
} }
public struct StarGift: Equatable, Codable { public struct StarGift: Equatable, Codable, PostboxCoding {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case id case id
case file case file
@ -35,7 +35,7 @@ public struct StarGift: Equatable, Codable {
case availability case availability
} }
public struct Availability: Equatable, Codable { public struct Availability: Equatable, Codable, PostboxCoding {
enum CodingKeys: String, CodingKey { enum CodingKeys: String, CodingKey {
case remains case remains
case total case total
@ -43,6 +43,21 @@ public struct StarGift: Equatable, Codable {
public let remains: Int32 public let remains: Int32
public let total: Int32 public let total: Int32
init(remains: Int32, total: Int32) {
self.remains = remains
self.total = total
}
public init(decoder: PostboxDecoder) {
self.remains = decoder.decodeInt32ForKey(CodingKeys.remains.rawValue, orElse: 0)
self.total = decoder.decodeInt32ForKey(CodingKeys.total.rawValue, orElse: 0)
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.remains, forKey: CodingKeys.remains.rawValue)
encoder.encodeInt32(self.total, forKey: CodingKeys.total.rawValue)
}
} }
public enum DecodingError: Error { public enum DecodingError: Error {
@ -75,6 +90,13 @@ public struct StarGift: Equatable, Codable {
self.availability = try container.decodeIfPresent(Availability.self, forKey: .availability) self.availability = try container.decodeIfPresent(Availability.self, forKey: .availability)
} }
public init(decoder: PostboxDecoder) {
self.id = decoder.decodeInt64ForKey(CodingKeys.id.rawValue, orElse: 0)
self.file = decoder.decodeObjectForKey(CodingKeys.file.rawValue) as! TelegramMediaFile
self.price = decoder.decodeInt64ForKey(CodingKeys.price.rawValue, orElse: 0)
self.availability = decoder.decodeObjectForKey(CodingKeys.availability.rawValue, decoder: { StarGift.Availability(decoder: $0) }) as? StarGift.Availability
}
public func encode(to encoder: Encoder) throws { public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self) var container = encoder.container(keyedBy: CodingKeys.self)
try container.encode(self.id, forKey: .id) try container.encode(self.id, forKey: .id)
@ -87,6 +109,17 @@ public struct StarGift: Equatable, Codable {
try container.encode(self.price, forKey: .price) try container.encode(self.price, forKey: .price)
try container.encodeIfPresent(self.availability, forKey: .availability) try container.encodeIfPresent(self.availability, forKey: .availability)
} }
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt64(self.id, forKey: CodingKeys.id.rawValue)
encoder.encodeObject(self.file, forKey: CodingKeys.file.rawValue)
encoder.encodeInt64(self.price, forKey: CodingKeys.price.rawValue)
if let availability = self.availability {
encoder.encodeObject(availability, forKey: CodingKeys.availability.rawValue)
} else {
encoder.encodeNil(forKey: CodingKeys.availability.rawValue)
}
}
} }
extension StarGift { extension StarGift {
@ -153,3 +186,215 @@ func managedStarGiftsUpdates(postbox: Postbox, network: Network) -> Signal<Never
let poll = _internal_keepCachedStarGiftsUpdated(postbox: postbox, network: network) let poll = _internal_keepCachedStarGiftsUpdated(postbox: postbox, network: network)
return (poll |> then(.complete() |> suspendAwareDelay(2.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue()))) |> restart return (poll |> then(.complete() |> suspendAwareDelay(2.0 * 60.0 * 60.0, queue: Queue.concurrentDefaultQueue()))) |> restart
} }
func _internal_convertStarGift(account: Account, messageId: EngineMessage.Id) -> Signal<Never, NoError> {
return account.postbox.transaction { transaction -> Api.InputUser? in
return transaction.getPeer(messageId.peerId).flatMap(apiInputUser)
}
|> mapToSignal { inputUser -> Signal<Never, NoError> in
guard let inputUser else {
return .complete()
}
return account.network.request(Api.functions.payments.convertStarGift(userId: inputUser, msgId: messageId.id))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
return .single(nil)
}
|> ignoreValues
}
}
func _internal_saveStarGiftToProfile(account: Account, messageId: EngineMessage.Id) -> Signal<Never, NoError> {
return account.postbox.transaction { transaction -> Api.InputUser? in
return transaction.getPeer(messageId.peerId).flatMap(apiInputUser)
}
|> mapToSignal { inputUser -> Signal<Never, NoError> in
guard let inputUser else {
return .complete()
}
return account.network.request(Api.functions.payments.saveStarGift(userId: inputUser, msgId: messageId.id))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.Bool?, NoError> in
return .single(nil)
}
|> ignoreValues
}
}
private final class ProfileGiftsContextImpl {
private let queue: Queue
private let account: Account
private let peerId: PeerId
private let disposable = MetaDisposable()
private var gifts: [ProfileGiftsContext.State.StarGift] = []
private var count: Int32?
private var dataState: ProfileGiftsContext.State.DataState = .ready(canLoadMore: true, nextOffset: nil)
private let stateValue = Promise<ProfileGiftsContext.State>()
var state: Signal<ProfileGiftsContext.State, NoError> {
return self.stateValue.get()
}
init(queue: Queue, account: Account, peerId: EnginePeer.Id) {
self.queue = queue
self.account = account
self.peerId = peerId
self.loadMore()
}
deinit {
self.disposable.dispose()
}
func loadMore() {
if case let .ready(true, nextOffset) = self.dataState {
self.dataState = .loading
self.pushState()
let peerId = self.peerId
let accountPeerId = self.account.peerId
let network = self.account.network
let postbox = self.account.postbox
let signal: Signal<([ProfileGiftsContext.State.StarGift], Int32, String?), NoError> = self.account.postbox.transaction { transaction -> Api.InputUser? in
return transaction.getPeer(peerId).flatMap(apiInputUser)
}
|> mapToSignal { inputUser -> Signal<([ProfileGiftsContext.State.StarGift], Int32, String?), NoError> in
guard let inputUser else {
return .single(([], 0, nil))
}
return network.request(Api.functions.payments.getUserStarGifts(userId: inputUser, offset: nextOffset ?? "", limit: 32))
|> map(Optional.init)
|> `catch` { _ -> Signal<Api.payments.UserStarGifts?, NoError> in
return .single(nil)
}
|> mapToSignal { result -> Signal<([ProfileGiftsContext.State.StarGift], Int32, String?), NoError> in
guard let result else {
return .single(([], 0, nil))
}
return postbox.transaction { transaction -> ([ProfileGiftsContext.State.StarGift], Int32, String?) in
switch result {
case let .userStarGifts(_, count, apiGifts, nextOffset, users):
let parsedPeers = AccumulatedPeers(transaction: transaction, chats: [], users: users)
updatePeers(transaction: transaction, accountPeerId: accountPeerId, peers: parsedPeers)
let gifts = apiGifts.compactMap { ProfileGiftsContext.State.StarGift(apiUserStarGift: $0, transaction: transaction) }
return (gifts, count, nextOffset)
}
}
}
}
self.disposable.set((signal
|> deliverOn(self.queue)).start(next: { [weak self] (gifts, count, nextOffset) in
guard let strongSelf = self else {
return
}
for gift in gifts {
strongSelf.gifts.append(gift)
}
let updatedCount = max(Int32(strongSelf.gifts.count), count)
strongSelf.count = updatedCount
strongSelf.dataState = .ready(canLoadMore: count != 0 && updatedCount > strongSelf.gifts.count && nextOffset != nil, nextOffset: nextOffset)
strongSelf.pushState()
}))
}
}
private func pushState() {
self.stateValue.set(.single(ProfileGiftsContext.State(gifts: self.gifts, count: self.count, dataState: self.dataState)))
}
}
public final class ProfileGiftsContext {
public struct State: Equatable {
public struct StarGift: Equatable {
public let gift: TelegramCore.StarGift
public let fromPeer: EnginePeer?
public let date: Int32
public let text: String?
public let entities: [MessageTextEntity]?
public let messageId: EngineMessage.Id?
public let nameHidden: Bool
public let convertStars: Int64?
}
public enum DataState: Equatable {
case loading
case ready(canLoadMore: Bool, nextOffset: String?)
}
public var gifts: [ProfileGiftsContext.State.StarGift]
public var count: Int32?
public var dataState: ProfileGiftsContext.State.DataState
}
private let queue: Queue = .mainQueue()
private let impl: QueueLocalObject<ProfileGiftsContextImpl>
public var state: Signal<ProfileGiftsContext.State, NoError> {
return Signal { subscriber in
let disposable = MetaDisposable()
self.impl.with { impl in
disposable.set(impl.state.start(next: { value in
subscriber.putNext(value)
}))
}
return disposable
}
}
public init(account: Account, peerId: EnginePeer.Id) {
let queue = self.queue
self.impl = QueueLocalObject(queue: queue, generate: {
return ProfileGiftsContextImpl(queue: queue, account: account, peerId: peerId)
})
}
public func loadMore() {
self.impl.with { impl in
impl.loadMore()
}
}
}
private extension ProfileGiftsContext.State.StarGift {
init?(apiUserStarGift: Api.UserStarGift, transaction: Transaction) {
switch apiUserStarGift {
case let .userStarGift(flags, fromId, date, apiGift, message, msgId, convertStars):
guard let gift = StarGift(apiStarGift: apiGift) else {
return nil
}
self.gift = gift
if let fromPeerId = fromId.flatMap({ EnginePeer.Id(namespace: Namespaces.Peer.CloudUser, id: EnginePeer.Id.Id._internalFromInt64Value($0)) }) {
self.fromPeer = transaction.getPeer(fromPeerId).flatMap(EnginePeer.init)
} else {
self.fromPeer = nil
}
self.date = date
if let message {
switch message {
case let .textWithEntities(text, entities):
self.text = text
self.entities = messageTextEntitiesFromApiEntities(entities)
}
} else {
self.text = nil
self.entities = nil
}
if let fromPeer = self.fromPeer, let msgId {
self.messageId = EngineMessage.Id(peerId: fromPeer.id, namespace: Namespaces.Message.Cloud, id: msgId)
} else {
self.messageId = nil
}
self.nameHidden = (flags & (1 << 0)) != 0
self.convertStars = convertStars
}
}
}

View File

@ -1229,10 +1229,7 @@ func _internal_sendStarsPaymentForm(account: Account, formId: Int64, source: Bot
guard let invoice = invoice else { guard let invoice = invoice else {
return .fail(.generic) return .fail(.generic)
} }
return account.network.request(Api.functions.payments.sendStarsForm(formId: formId, invoice: invoice))
let flags: Int32 = 0
return account.network.request(Api.functions.payments.sendStarsForm(flags: flags, formId: formId, invoice: invoice))
|> map { result -> SendBotPaymentResult in |> map { result -> SendBotPaymentResult in
switch result { switch result {
case let .paymentResult(updates): case let .paymentResult(updates):

View File

@ -112,5 +112,15 @@ public extension TelegramEngine {
public func keepStarGiftsUpdated() -> Signal<Never, NoError> { public func keepStarGiftsUpdated() -> Signal<Never, NoError> {
return _internal_keepCachedStarGiftsUpdated(postbox: self.account.postbox, network: self.account.network) return _internal_keepCachedStarGiftsUpdated(postbox: self.account.postbox, network: self.account.network)
} }
public func convertStarGift(messageId: EngineMessage.Id) -> Signal<Never, NoError> {
return _internal_convertStarGift(account: self.account, messageId: messageId)
}
public func saveStarGiftToProfile(messageId: EngineMessage.Id) -> Signal<Never, NoError> {
return _internal_saveStarGiftToProfile(account: self.account, messageId: messageId)
}
} }
} }