mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-18 20:30:51 +00:00
Update API [skip ci]
This commit is contained in:
parent
8dac4b39c1
commit
75c773e694
@ -496,7 +496,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1502273946] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentPremiumSubscription($0) }
|
dict[-1502273946] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentPremiumSubscription($0) }
|
||||||
dict[494149367] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsGift($0) }
|
dict[494149367] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsGift($0) }
|
||||||
dict[1964968186] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsGiveaway($0) }
|
dict[1964968186] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsGiveaway($0) }
|
||||||
dict[-572715178] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsTopup($0) }
|
dict[-106780981] = { return Api.InputStorePaymentPurpose.parse_inputStorePaymentStarsTopup($0) }
|
||||||
dict[1012306921] = { return Api.InputTheme.parse_inputTheme($0) }
|
dict[1012306921] = { return Api.InputTheme.parse_inputTheme($0) }
|
||||||
dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) }
|
dict[-175567375] = { return Api.InputTheme.parse_inputThemeSlug($0) }
|
||||||
dict[-1881255857] = { return Api.InputThemeSettings.parse_inputThemeSettings($0) }
|
dict[-1881255857] = { return Api.InputThemeSettings.parse_inputThemeSettings($0) }
|
||||||
@ -954,7 +954,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[2109703795] = { return Api.SponsoredMessage.parse_sponsoredMessage($0) }
|
dict[2109703795] = { return Api.SponsoredMessage.parse_sponsoredMessage($0) }
|
||||||
dict[1124938064] = { return Api.SponsoredMessageReportOption.parse_sponsoredMessageReportOption($0) }
|
dict[1124938064] = { return Api.SponsoredMessageReportOption.parse_sponsoredMessageReportOption($0) }
|
||||||
dict[-963180333] = { return Api.SponsoredPeer.parse_sponsoredPeer($0) }
|
dict[-963180333] = { return Api.SponsoredPeer.parse_sponsoredPeer($0) }
|
||||||
dict[12386139] = { return Api.StarGift.parse_starGift($0) }
|
dict[-2136190013] = { return Api.StarGift.parse_starGift($0) }
|
||||||
dict[648369470] = { return Api.StarGift.parse_starGiftUnique($0) }
|
dict[648369470] = { return Api.StarGift.parse_starGiftUnique($0) }
|
||||||
dict[-650279524] = { return Api.StarGiftAttribute.parse_starGiftAttributeBackdrop($0) }
|
dict[-650279524] = { return Api.StarGiftAttribute.parse_starGiftAttributeBackdrop($0) }
|
||||||
dict[970559507] = { return Api.StarGiftAttribute.parse_starGiftAttributeModel($0) }
|
dict[970559507] = { return Api.StarGiftAttribute.parse_starGiftAttributeModel($0) }
|
||||||
@ -1432,6 +1432,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-44166467] = { return Api.messages.WebPage.parse_webPage($0) }
|
dict[-44166467] = { return Api.messages.WebPage.parse_webPage($0) }
|
||||||
dict[-1936029524] = { return Api.messages.WebPagePreview.parse_webPagePreview($0) }
|
dict[-1936029524] = { return Api.messages.WebPagePreview.parse_webPagePreview($0) }
|
||||||
dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) }
|
dict[1042605427] = { return Api.payments.BankCardData.parse_bankCardData($0) }
|
||||||
|
dict[-706379148] = { return Api.payments.CheckCanSendGiftResult.parse_checkCanSendGiftResultFail($0) }
|
||||||
|
dict[927967149] = { return Api.payments.CheckCanSendGiftResult.parse_checkCanSendGiftResultOk($0) }
|
||||||
dict[675942550] = { return Api.payments.CheckedGiftCode.parse_checkedGiftCode($0) }
|
dict[675942550] = { return Api.payments.CheckedGiftCode.parse_checkedGiftCode($0) }
|
||||||
dict[-1730811363] = { return Api.payments.ConnectedStarRefBots.parse_connectedStarRefBots($0) }
|
dict[-1730811363] = { return Api.payments.ConnectedStarRefBots.parse_connectedStarRefBots($0) }
|
||||||
dict[-1362048039] = { return Api.payments.ExportedInvoice.parse_exportedInvoice($0) }
|
dict[-1362048039] = { return Api.payments.ExportedInvoice.parse_exportedInvoice($0) }
|
||||||
@ -2558,6 +2560,8 @@ public extension Api {
|
|||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.payments.BankCardData:
|
case let _1 as Api.payments.BankCardData:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
|
case let _1 as Api.payments.CheckCanSendGiftResult:
|
||||||
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.payments.CheckedGiftCode:
|
case let _1 as Api.payments.CheckedGiftCode:
|
||||||
_1.serialize(buffer, boxed)
|
_1.serialize(buffer, boxed)
|
||||||
case let _1 as Api.payments.ConnectedStarRefBots:
|
case let _1 as Api.payments.ConnectedStarRefBots:
|
||||||
|
|||||||
@ -123,7 +123,7 @@ public extension Api {
|
|||||||
case inputStorePaymentPremiumSubscription(flags: Int32)
|
case inputStorePaymentPremiumSubscription(flags: Int32)
|
||||||
case inputStorePaymentStarsGift(userId: Api.InputUser, stars: Int64, currency: String, amount: Int64)
|
case inputStorePaymentStarsGift(userId: Api.InputUser, stars: Int64, currency: String, amount: Int64)
|
||||||
case inputStorePaymentStarsGiveaway(flags: Int32, stars: Int64, boostPeer: Api.InputPeer, additionalPeers: [Api.InputPeer]?, countriesIso2: [String]?, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
case inputStorePaymentStarsGiveaway(flags: Int32, stars: Int64, boostPeer: Api.InputPeer, additionalPeers: [Api.InputPeer]?, countriesIso2: [String]?, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
||||||
case inputStorePaymentStarsTopup(stars: Int64, currency: String, amount: Int64)
|
case inputStorePaymentStarsTopup(flags: Int32, stars: Int64, currency: String, amount: Int64, spendPurposePeer: Api.InputPeer?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -221,13 +221,15 @@ public extension Api {
|
|||||||
serializeInt64(amount, buffer: buffer, boxed: false)
|
serializeInt64(amount, buffer: buffer, boxed: false)
|
||||||
serializeInt32(users, buffer: buffer, boxed: false)
|
serializeInt32(users, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
case .inputStorePaymentStarsTopup(let stars, let currency, let amount):
|
case .inputStorePaymentStarsTopup(let flags, let stars, let currency, let amount, let spendPurposePeer):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-572715178)
|
buffer.appendInt32(-106780981)
|
||||||
}
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(stars, buffer: buffer, boxed: false)
|
serializeInt64(stars, buffer: buffer, boxed: false)
|
||||||
serializeString(currency, buffer: buffer, boxed: false)
|
serializeString(currency, buffer: buffer, boxed: false)
|
||||||
serializeInt64(amount, buffer: buffer, boxed: false)
|
serializeInt64(amount, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {spendPurposePeer!.serialize(buffer, true)}
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -248,8 +250,8 @@ public extension Api {
|
|||||||
return ("inputStorePaymentStarsGift", [("userId", userId as Any), ("stars", stars as Any), ("currency", currency as Any), ("amount", amount as Any)])
|
return ("inputStorePaymentStarsGift", [("userId", userId as Any), ("stars", stars as Any), ("currency", currency as Any), ("amount", amount as Any)])
|
||||||
case .inputStorePaymentStarsGiveaway(let flags, let stars, let boostPeer, let additionalPeers, let countriesIso2, let prizeDescription, let randomId, let untilDate, let currency, let amount, let users):
|
case .inputStorePaymentStarsGiveaway(let flags, let stars, let boostPeer, let additionalPeers, let countriesIso2, let prizeDescription, let randomId, let untilDate, let currency, let amount, let users):
|
||||||
return ("inputStorePaymentStarsGiveaway", [("flags", flags as Any), ("stars", stars as Any), ("boostPeer", boostPeer as Any), ("additionalPeers", additionalPeers as Any), ("countriesIso2", countriesIso2 as Any), ("prizeDescription", prizeDescription as Any), ("randomId", randomId as Any), ("untilDate", untilDate as Any), ("currency", currency as Any), ("amount", amount as Any), ("users", users as Any)])
|
return ("inputStorePaymentStarsGiveaway", [("flags", flags as Any), ("stars", stars as Any), ("boostPeer", boostPeer as Any), ("additionalPeers", additionalPeers as Any), ("countriesIso2", countriesIso2 as Any), ("prizeDescription", prizeDescription as Any), ("randomId", randomId as Any), ("untilDate", untilDate as Any), ("currency", currency as Any), ("amount", amount as Any), ("users", users as Any)])
|
||||||
case .inputStorePaymentStarsTopup(let stars, let currency, let amount):
|
case .inputStorePaymentStarsTopup(let flags, let stars, let currency, let amount, let spendPurposePeer):
|
||||||
return ("inputStorePaymentStarsTopup", [("stars", stars as Any), ("currency", currency as Any), ("amount", amount as Any)])
|
return ("inputStorePaymentStarsTopup", [("flags", flags as Any), ("stars", stars as Any), ("currency", currency as Any), ("amount", amount as Any), ("spendPurposePeer", spendPurposePeer as Any)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,17 +451,25 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_inputStorePaymentStarsTopup(_ reader: BufferReader) -> InputStorePaymentPurpose? {
|
public static func parse_inputStorePaymentStarsTopup(_ reader: BufferReader) -> InputStorePaymentPurpose? {
|
||||||
var _1: Int64?
|
var _1: Int32?
|
||||||
_1 = reader.readInt64()
|
_1 = reader.readInt32()
|
||||||
var _2: String?
|
var _2: Int64?
|
||||||
_2 = parseString(reader)
|
_2 = reader.readInt64()
|
||||||
var _3: Int64?
|
var _3: String?
|
||||||
_3 = reader.readInt64()
|
_3 = parseString(reader)
|
||||||
|
var _4: Int64?
|
||||||
|
_4 = reader.readInt64()
|
||||||
|
var _5: Api.InputPeer?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_5 = Api.parse(reader, signature: signature) as? Api.InputPeer
|
||||||
|
} }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
if _c1 && _c2 && _c3 {
|
let _c4 = _4 != nil
|
||||||
return Api.InputStorePaymentPurpose.inputStorePaymentStarsTopup(stars: _1!, currency: _2!, amount: _3!)
|
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
|
return Api.InputStorePaymentPurpose.inputStorePaymentStarsTopup(flags: _1!, stars: _2!, currency: _3!, amount: _4!, spendPurposePeer: _5)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -288,14 +288,14 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum StarGift: TypeConstructorDescription {
|
enum StarGift: TypeConstructorDescription {
|
||||||
case starGift(flags: Int32, id: Int64, sticker: Api.Document, stars: Int64, availabilityRemains: Int32?, availabilityTotal: Int32?, availabilityResale: Int64?, convertStars: Int64, firstSaleDate: Int32?, lastSaleDate: Int32?, upgradeStars: Int64?, resellMinStars: Int64?, title: String?, releasedBy: Api.Peer?, perUserTotal: Int32?, perUserRemains: Int32?)
|
case starGift(flags: Int32, id: Int64, sticker: Api.Document, stars: Int64, availabilityRemains: Int32?, availabilityTotal: Int32?, availabilityResale: Int64?, convertStars: Int64, firstSaleDate: Int32?, lastSaleDate: Int32?, upgradeStars: Int64?, resellMinStars: Int64?, title: String?, releasedBy: Api.Peer?, perUserTotal: Int32?, perUserRemains: Int32?, lockedUntilDate: Int32?)
|
||||||
case starGiftUnique(flags: Int32, id: Int64, giftId: Int64, title: String, slug: String, num: Int32, ownerId: Api.Peer?, ownerName: String?, ownerAddress: String?, attributes: [Api.StarGiftAttribute], availabilityIssued: Int32, availabilityTotal: Int32, giftAddress: String?, resellAmount: [Api.StarsAmount]?, releasedBy: Api.Peer?, valueAmount: Int64?, valueCurrency: String?)
|
case starGiftUnique(flags: Int32, id: Int64, giftId: Int64, title: String, slug: String, num: Int32, ownerId: Api.Peer?, ownerName: String?, ownerAddress: String?, attributes: [Api.StarGiftAttribute], availabilityIssued: Int32, availabilityTotal: Int32, giftAddress: String?, resellAmount: [Api.StarsAmount]?, releasedBy: Api.Peer?, valueAmount: Int64?, valueCurrency: String?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .starGift(let flags, let id, let sticker, let stars, let availabilityRemains, let availabilityTotal, let availabilityResale, let convertStars, let firstSaleDate, let lastSaleDate, let upgradeStars, let resellMinStars, let title, let releasedBy, let perUserTotal, let perUserRemains):
|
case .starGift(let flags, let id, let sticker, let stars, let availabilityRemains, let availabilityTotal, let availabilityResale, let convertStars, let firstSaleDate, let lastSaleDate, let upgradeStars, let resellMinStars, let title, let releasedBy, let perUserTotal, let perUserRemains, let lockedUntilDate):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(12386139)
|
buffer.appendInt32(-2136190013)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(id, buffer: buffer, boxed: false)
|
serializeInt64(id, buffer: buffer, boxed: false)
|
||||||
@ -313,6 +313,7 @@ public extension Api {
|
|||||||
if Int(flags) & Int(1 << 6) != 0 {releasedBy!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 6) != 0 {releasedBy!.serialize(buffer, true)}
|
||||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(perUserTotal!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(perUserTotal!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(perUserRemains!, buffer: buffer, boxed: false)}
|
if Int(flags) & Int(1 << 8) != 0 {serializeInt32(perUserRemains!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 9) != 0 {serializeInt32(lockedUntilDate!, buffer: buffer, boxed: false)}
|
||||||
break
|
break
|
||||||
case .starGiftUnique(let flags, let id, let giftId, let title, let slug, let num, let ownerId, let ownerName, let ownerAddress, let attributes, let availabilityIssued, let availabilityTotal, let giftAddress, let resellAmount, let releasedBy, let valueAmount, let valueCurrency):
|
case .starGiftUnique(let flags, let id, let giftId, let title, let slug, let num, let ownerId, let ownerName, let ownerAddress, let attributes, let availabilityIssued, let availabilityTotal, let giftAddress, let resellAmount, let releasedBy, let valueAmount, let valueCurrency):
|
||||||
if boxed {
|
if boxed {
|
||||||
@ -349,8 +350,8 @@ public extension Api {
|
|||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .starGift(let flags, let id, let sticker, let stars, let availabilityRemains, let availabilityTotal, let availabilityResale, let convertStars, let firstSaleDate, let lastSaleDate, let upgradeStars, let resellMinStars, let title, let releasedBy, let perUserTotal, let perUserRemains):
|
case .starGift(let flags, let id, let sticker, let stars, let availabilityRemains, let availabilityTotal, let availabilityResale, let convertStars, let firstSaleDate, let lastSaleDate, let upgradeStars, let resellMinStars, let title, let releasedBy, let perUserTotal, let perUserRemains, let lockedUntilDate):
|
||||||
return ("starGift", [("flags", flags as Any), ("id", id as Any), ("sticker", sticker as Any), ("stars", stars as Any), ("availabilityRemains", availabilityRemains as Any), ("availabilityTotal", availabilityTotal as Any), ("availabilityResale", availabilityResale as Any), ("convertStars", convertStars as Any), ("firstSaleDate", firstSaleDate as Any), ("lastSaleDate", lastSaleDate as Any), ("upgradeStars", upgradeStars as Any), ("resellMinStars", resellMinStars as Any), ("title", title as Any), ("releasedBy", releasedBy as Any), ("perUserTotal", perUserTotal as Any), ("perUserRemains", perUserRemains as Any)])
|
return ("starGift", [("flags", flags as Any), ("id", id as Any), ("sticker", sticker as Any), ("stars", stars as Any), ("availabilityRemains", availabilityRemains as Any), ("availabilityTotal", availabilityTotal as Any), ("availabilityResale", availabilityResale as Any), ("convertStars", convertStars as Any), ("firstSaleDate", firstSaleDate as Any), ("lastSaleDate", lastSaleDate as Any), ("upgradeStars", upgradeStars as Any), ("resellMinStars", resellMinStars as Any), ("title", title as Any), ("releasedBy", releasedBy as Any), ("perUserTotal", perUserTotal as Any), ("perUserRemains", perUserRemains as Any), ("lockedUntilDate", lockedUntilDate as Any)])
|
||||||
case .starGiftUnique(let flags, let id, let giftId, let title, let slug, let num, let ownerId, let ownerName, let ownerAddress, let attributes, let availabilityIssued, let availabilityTotal, let giftAddress, let resellAmount, let releasedBy, let valueAmount, let valueCurrency):
|
case .starGiftUnique(let flags, let id, let giftId, let title, let slug, let num, let ownerId, let ownerName, let ownerAddress, let attributes, let availabilityIssued, let availabilityTotal, let giftAddress, let resellAmount, let releasedBy, let valueAmount, let valueCurrency):
|
||||||
return ("starGiftUnique", [("flags", flags as Any), ("id", id as Any), ("giftId", giftId as Any), ("title", title as Any), ("slug", slug as Any), ("num", num as Any), ("ownerId", ownerId as Any), ("ownerName", ownerName as Any), ("ownerAddress", ownerAddress as Any), ("attributes", attributes as Any), ("availabilityIssued", availabilityIssued as Any), ("availabilityTotal", availabilityTotal as Any), ("giftAddress", giftAddress as Any), ("resellAmount", resellAmount as Any), ("releasedBy", releasedBy as Any), ("valueAmount", valueAmount as Any), ("valueCurrency", valueCurrency as Any)])
|
return ("starGiftUnique", [("flags", flags as Any), ("id", id as Any), ("giftId", giftId as Any), ("title", title as Any), ("slug", slug as Any), ("num", num as Any), ("ownerId", ownerId as Any), ("ownerName", ownerName as Any), ("ownerAddress", ownerAddress as Any), ("attributes", attributes as Any), ("availabilityIssued", availabilityIssued as Any), ("availabilityTotal", availabilityTotal as Any), ("giftAddress", giftAddress as Any), ("resellAmount", resellAmount as Any), ("releasedBy", releasedBy as Any), ("valueAmount", valueAmount as Any), ("valueCurrency", valueCurrency as Any)])
|
||||||
}
|
}
|
||||||
@ -393,6 +394,8 @@ public extension Api {
|
|||||||
if Int(_1!) & Int(1 << 8) != 0 {_15 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 8) != 0 {_15 = reader.readInt32() }
|
||||||
var _16: Int32?
|
var _16: Int32?
|
||||||
if Int(_1!) & Int(1 << 8) != 0 {_16 = reader.readInt32() }
|
if Int(_1!) & Int(1 << 8) != 0 {_16 = reader.readInt32() }
|
||||||
|
var _17: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 9) != 0 {_17 = reader.readInt32() }
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
@ -409,8 +412,9 @@ public extension Api {
|
|||||||
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
|
let _c14 = (Int(_1!) & Int(1 << 6) == 0) || _14 != nil
|
||||||
let _c15 = (Int(_1!) & Int(1 << 8) == 0) || _15 != nil
|
let _c15 = (Int(_1!) & Int(1 << 8) == 0) || _15 != nil
|
||||||
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
|
let _c16 = (Int(_1!) & Int(1 << 8) == 0) || _16 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 {
|
let _c17 = (Int(_1!) & Int(1 << 9) == 0) || _17 != nil
|
||||||
return Api.StarGift.starGift(flags: _1!, id: _2!, sticker: _3!, stars: _4!, availabilityRemains: _5, availabilityTotal: _6, availabilityResale: _7, convertStars: _8!, firstSaleDate: _9, lastSaleDate: _10, upgradeStars: _11, resellMinStars: _12, title: _13, releasedBy: _14, perUserTotal: _15, perUserRemains: _16)
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 && _c11 && _c12 && _c13 && _c14 && _c15 && _c16 && _c17 {
|
||||||
|
return Api.StarGift.starGift(flags: _1!, id: _2!, sticker: _3!, stars: _4!, availabilityRemains: _5, availabilityTotal: _6, availabilityResale: _7, convertStars: _8!, firstSaleDate: _9, lastSaleDate: _10, upgradeStars: _11, resellMinStars: _12, title: _13, releasedBy: _14, perUserTotal: _15, perUserRemains: _16, lockedUntilDate: _17)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -914,6 +914,56 @@ public extension Api.payments {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public extension Api.payments {
|
||||||
|
enum CheckCanSendGiftResult: TypeConstructorDescription {
|
||||||
|
case checkCanSendGiftResultFail(reason: Api.TextWithEntities)
|
||||||
|
case checkCanSendGiftResultOk
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .checkCanSendGiftResultFail(let reason):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-706379148)
|
||||||
|
}
|
||||||
|
reason.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
case .checkCanSendGiftResultOk:
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(927967149)
|
||||||
|
}
|
||||||
|
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .checkCanSendGiftResultFail(let reason):
|
||||||
|
return ("checkCanSendGiftResultFail", [("reason", reason as Any)])
|
||||||
|
case .checkCanSendGiftResultOk:
|
||||||
|
return ("checkCanSendGiftResultOk", [])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_checkCanSendGiftResultFail(_ reader: BufferReader) -> CheckCanSendGiftResult? {
|
||||||
|
var _1: Api.TextWithEntities?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultFail(reason: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_checkCanSendGiftResultOk(_ reader: BufferReader) -> CheckCanSendGiftResult? {
|
||||||
|
return Api.payments.CheckCanSendGiftResult.checkCanSendGiftResultOk
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.payments {
|
public extension Api.payments {
|
||||||
enum CheckedGiftCode: TypeConstructorDescription {
|
enum CheckedGiftCode: TypeConstructorDescription {
|
||||||
case checkedGiftCode(flags: Int32, fromId: Api.Peer?, giveawayMsgId: Int32?, toId: Int64?, date: Int32, months: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User])
|
case checkedGiftCode(flags: Int32, fromId: Api.Peer?, giveawayMsgId: Int32?, toId: Int64?, date: Int32, months: Int32, usedDate: Int32?, chats: [Api.Chat], users: [Api.User])
|
||||||
@ -1562,61 +1612,3 @@ public extension Api.payments {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api.payments {
|
|
||||||
indirect enum PaymentResult: TypeConstructorDescription {
|
|
||||||
case paymentResult(updates: Api.Updates)
|
|
||||||
case paymentVerificationNeeded(url: String)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .paymentResult(let updates):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1314881805)
|
|
||||||
}
|
|
||||||
updates.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
case .paymentVerificationNeeded(let url):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-666824391)
|
|
||||||
}
|
|
||||||
serializeString(url, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .paymentResult(let updates):
|
|
||||||
return ("paymentResult", [("updates", updates as Any)])
|
|
||||||
case .paymentVerificationNeeded(let url):
|
|
||||||
return ("paymentVerificationNeeded", [("url", url as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_paymentResult(_ reader: BufferReader) -> PaymentResult? {
|
|
||||||
var _1: Api.Updates?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.Updates
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.payments.PaymentResult.paymentResult(updates: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_paymentVerificationNeeded(_ reader: BufferReader) -> PaymentResult? {
|
|
||||||
var _1: String?
|
|
||||||
_1 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,61 @@
|
|||||||
|
public extension Api.payments {
|
||||||
|
indirect enum PaymentResult: TypeConstructorDescription {
|
||||||
|
case paymentResult(updates: Api.Updates)
|
||||||
|
case paymentVerificationNeeded(url: String)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .paymentResult(let updates):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1314881805)
|
||||||
|
}
|
||||||
|
updates.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
case .paymentVerificationNeeded(let url):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-666824391)
|
||||||
|
}
|
||||||
|
serializeString(url, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .paymentResult(let updates):
|
||||||
|
return ("paymentResult", [("updates", updates as Any)])
|
||||||
|
case .paymentVerificationNeeded(let url):
|
||||||
|
return ("paymentVerificationNeeded", [("url", url as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_paymentResult(_ reader: BufferReader) -> PaymentResult? {
|
||||||
|
var _1: Api.Updates?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_1 = Api.parse(reader, signature: signature) as? Api.Updates
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.payments.PaymentResult.paymentResult(updates: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_paymentVerificationNeeded(_ reader: BufferReader) -> PaymentResult? {
|
||||||
|
var _1: String?
|
||||||
|
_1 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.payments.PaymentResult.paymentVerificationNeeded(url: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.payments {
|
public extension Api.payments {
|
||||||
enum ResaleStarGifts: TypeConstructorDescription {
|
enum ResaleStarGifts: TypeConstructorDescription {
|
||||||
case resaleStarGifts(flags: Int32, count: Int32, gifts: [Api.StarGift], nextOffset: String?, attributes: [Api.StarGiftAttribute]?, attributesHash: Int64?, chats: [Api.Chat], counters: [Api.StarGiftAttributeCounter]?, users: [Api.User])
|
case resaleStarGifts(flags: Int32, count: Int32, gifts: [Api.StarGift], nextOffset: String?, attributes: [Api.StarGiftAttribute]?, attributesHash: Int64?, chats: [Api.Chat], counters: [Api.StarGiftAttributeCounter]?, users: [Api.User])
|
||||||
@ -1634,107 +1692,3 @@ public extension Api.premium {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api.smsjobs {
|
|
||||||
enum EligibilityToJoin: TypeConstructorDescription {
|
|
||||||
case eligibleToJoin(termsUrl: String, monthlySentSms: Int32)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .eligibleToJoin(let termsUrl, let monthlySentSms):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-594852657)
|
|
||||||
}
|
|
||||||
serializeString(termsUrl, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(monthlySentSms, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .eligibleToJoin(let termsUrl, let monthlySentSms):
|
|
||||||
return ("eligibleToJoin", [("termsUrl", termsUrl as Any), ("monthlySentSms", monthlySentSms as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_eligibleToJoin(_ reader: BufferReader) -> EligibilityToJoin? {
|
|
||||||
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.smsjobs.EligibilityToJoin.eligibleToJoin(termsUrl: _1!, monthlySentSms: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public extension Api.smsjobs {
|
|
||||||
enum Status: TypeConstructorDescription {
|
|
||||||
case status(flags: Int32, recentSent: Int32, recentSince: Int32, recentRemains: Int32, totalSent: Int32, totalSince: Int32, lastGiftSlug: String?, termsUrl: String)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .status(let flags, let recentSent, let recentSince, let recentRemains, let totalSent, let totalSince, let lastGiftSlug, let termsUrl):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(720277905)
|
|
||||||
}
|
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(recentSent, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(recentSince, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(recentRemains, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(totalSent, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(totalSince, buffer: buffer, boxed: false)
|
|
||||||
if Int(flags) & Int(1 << 1) != 0 {serializeString(lastGiftSlug!, buffer: buffer, boxed: false)}
|
|
||||||
serializeString(termsUrl, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .status(let flags, let recentSent, let recentSince, let recentRemains, let totalSent, let totalSince, let lastGiftSlug, let termsUrl):
|
|
||||||
return ("status", [("flags", flags as Any), ("recentSent", recentSent as Any), ("recentSince", recentSince as Any), ("recentRemains", recentRemains as Any), ("totalSent", totalSent as Any), ("totalSince", totalSince as Any), ("lastGiftSlug", lastGiftSlug as Any), ("termsUrl", termsUrl as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_status(_ reader: BufferReader) -> Status? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
var _3: Int32?
|
|
||||||
_3 = reader.readInt32()
|
|
||||||
var _4: Int32?
|
|
||||||
_4 = reader.readInt32()
|
|
||||||
var _5: Int32?
|
|
||||||
_5 = reader.readInt32()
|
|
||||||
var _6: Int32?
|
|
||||||
_6 = reader.readInt32()
|
|
||||||
var _7: String?
|
|
||||||
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
|
|
||||||
var _8: String?
|
|
||||||
_8 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
let _c5 = _5 != nil
|
|
||||||
let _c6 = _6 != nil
|
|
||||||
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
|
|
||||||
let _c8 = _8 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
|
||||||
return Api.smsjobs.Status.status(flags: _1!, recentSent: _2!, recentSince: _3!, recentRemains: _4!, totalSent: _5!, totalSince: _6!, lastGiftSlug: _7, termsUrl: _8!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,107 @@
|
|||||||
|
public extension Api.smsjobs {
|
||||||
|
enum EligibilityToJoin: TypeConstructorDescription {
|
||||||
|
case eligibleToJoin(termsUrl: String, monthlySentSms: Int32)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .eligibleToJoin(let termsUrl, let monthlySentSms):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-594852657)
|
||||||
|
}
|
||||||
|
serializeString(termsUrl, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(monthlySentSms, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .eligibleToJoin(let termsUrl, let monthlySentSms):
|
||||||
|
return ("eligibleToJoin", [("termsUrl", termsUrl as Any), ("monthlySentSms", monthlySentSms as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_eligibleToJoin(_ reader: BufferReader) -> EligibilityToJoin? {
|
||||||
|
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.smsjobs.EligibilityToJoin.eligibleToJoin(termsUrl: _1!, monthlySentSms: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public extension Api.smsjobs {
|
||||||
|
enum Status: TypeConstructorDescription {
|
||||||
|
case status(flags: Int32, recentSent: Int32, recentSince: Int32, recentRemains: Int32, totalSent: Int32, totalSince: Int32, lastGiftSlug: String?, termsUrl: String)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .status(let flags, let recentSent, let recentSince, let recentRemains, let totalSent, let totalSince, let lastGiftSlug, let termsUrl):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(720277905)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(recentSent, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(recentSince, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(recentRemains, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(totalSent, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(totalSince, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 1) != 0 {serializeString(lastGiftSlug!, buffer: buffer, boxed: false)}
|
||||||
|
serializeString(termsUrl, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .status(let flags, let recentSent, let recentSince, let recentRemains, let totalSent, let totalSince, let lastGiftSlug, let termsUrl):
|
||||||
|
return ("status", [("flags", flags as Any), ("recentSent", recentSent as Any), ("recentSince", recentSince as Any), ("recentRemains", recentRemains as Any), ("totalSent", totalSent as Any), ("totalSince", totalSince as Any), ("lastGiftSlug", lastGiftSlug as Any), ("termsUrl", termsUrl as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_status(_ reader: BufferReader) -> Status? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Int32?
|
||||||
|
_3 = reader.readInt32()
|
||||||
|
var _4: Int32?
|
||||||
|
_4 = reader.readInt32()
|
||||||
|
var _5: Int32?
|
||||||
|
_5 = reader.readInt32()
|
||||||
|
var _6: Int32?
|
||||||
|
_6 = reader.readInt32()
|
||||||
|
var _7: String?
|
||||||
|
if Int(_1!) & Int(1 << 1) != 0 {_7 = parseString(reader) }
|
||||||
|
var _8: String?
|
||||||
|
_8 = parseString(reader)
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
let _c5 = _5 != nil
|
||||||
|
let _c6 = _6 != nil
|
||||||
|
let _c7 = (Int(_1!) & Int(1 << 1) == 0) || _7 != nil
|
||||||
|
let _c8 = _8 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
|
||||||
|
return Api.smsjobs.Status.status(flags: _1!, recentSent: _2!, recentSince: _3!, recentRemains: _4!, totalSent: _5!, totalSince: _6!, lastGiftSlug: _7, termsUrl: _8!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.stats {
|
public extension Api.stats {
|
||||||
enum BroadcastStats: TypeConstructorDescription {
|
enum BroadcastStats: TypeConstructorDescription {
|
||||||
case broadcastStats(period: Api.StatsDateRangeDays, followers: Api.StatsAbsValueAndPrev, viewsPerPost: Api.StatsAbsValueAndPrev, sharesPerPost: Api.StatsAbsValueAndPrev, reactionsPerPost: Api.StatsAbsValueAndPrev, viewsPerStory: Api.StatsAbsValueAndPrev, sharesPerStory: Api.StatsAbsValueAndPrev, reactionsPerStory: Api.StatsAbsValueAndPrev, enabledNotifications: Api.StatsPercentValue, growthGraph: Api.StatsGraph, followersGraph: Api.StatsGraph, muteGraph: Api.StatsGraph, topHoursGraph: Api.StatsGraph, interactionsGraph: Api.StatsGraph, ivInteractionsGraph: Api.StatsGraph, viewsBySourceGraph: Api.StatsGraph, newFollowersBySourceGraph: Api.StatsGraph, languagesGraph: Api.StatsGraph, reactionsByEmotionGraph: Api.StatsGraph, storyInteractionsGraph: Api.StatsGraph, storyReactionsByEmotionGraph: Api.StatsGraph, recentPostsInteractions: [Api.PostInteractionCounters])
|
case broadcastStats(period: Api.StatsDateRangeDays, followers: Api.StatsAbsValueAndPrev, viewsPerPost: Api.StatsAbsValueAndPrev, sharesPerPost: Api.StatsAbsValueAndPrev, reactionsPerPost: Api.StatsAbsValueAndPrev, viewsPerStory: Api.StatsAbsValueAndPrev, sharesPerStory: Api.StatsAbsValueAndPrev, reactionsPerStory: Api.StatsAbsValueAndPrev, enabledNotifications: Api.StatsPercentValue, growthGraph: Api.StatsGraph, followersGraph: Api.StatsGraph, muteGraph: Api.StatsGraph, topHoursGraph: Api.StatsGraph, interactionsGraph: Api.StatsGraph, ivInteractionsGraph: Api.StatsGraph, viewsBySourceGraph: Api.StatsGraph, newFollowersBySourceGraph: Api.StatsGraph, languagesGraph: Api.StatsGraph, reactionsByEmotionGraph: Api.StatsGraph, storyInteractionsGraph: Api.StatsGraph, storyReactionsByEmotionGraph: Api.StatsGraph, recentPostsInteractions: [Api.PostInteractionCounters])
|
||||||
@ -1450,207 +1554,3 @@ public extension Api.updates {
|
|||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api.updates {
|
|
||||||
enum Difference: TypeConstructorDescription {
|
|
||||||
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
|
||||||
case differenceEmpty(date: Int32, seq: Int32)
|
|
||||||
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
|
||||||
case differenceTooLong(pts: Int32)
|
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
|
||||||
switch self {
|
|
||||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(16030880)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(newMessages.count))
|
|
||||||
for item in newMessages {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
|
||||||
for item in newEncryptedMessages {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(otherUpdates.count))
|
|
||||||
for item in otherUpdates {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
state.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
case .differenceEmpty(let date, let seq):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1567990072)
|
|
||||||
}
|
|
||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
|
||||||
serializeInt32(seq, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-1459938943)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(newMessages.count))
|
|
||||||
for item in newMessages {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
|
||||||
for item in newEncryptedMessages {
|
|
||||||
item.serialize(buffer, true)
|
|
||||||
}
|
|
||||||
buffer.appendInt32(481674261)
|
|
||||||
buffer.appendInt32(Int32(otherUpdates.count))
|
|
||||||
for item in otherUpdates {
|
|
||||||
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)
|
|
||||||
}
|
|
||||||
intermediateState.serialize(buffer, true)
|
|
||||||
break
|
|
||||||
case .differenceTooLong(let pts):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(1258196845)
|
|
||||||
}
|
|
||||||
serializeInt32(pts, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
|
||||||
switch self {
|
|
||||||
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
|
||||||
return ("difference", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("state", state as Any)])
|
|
||||||
case .differenceEmpty(let date, let seq):
|
|
||||||
return ("differenceEmpty", [("date", date as Any), ("seq", seq as Any)])
|
|
||||||
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
|
||||||
return ("differenceSlice", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("intermediateState", intermediateState as Any)])
|
|
||||||
case .differenceTooLong(let pts):
|
|
||||||
return ("differenceTooLong", [("pts", pts as Any)])
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static func parse_difference(_ reader: BufferReader) -> Difference? {
|
|
||||||
var _1: [Api.Message]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
|
||||||
}
|
|
||||||
var _2: [Api.EncryptedMessage]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
|
||||||
}
|
|
||||||
var _3: [Api.Update]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
|
||||||
}
|
|
||||||
var _4: [Api.Chat]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
|
||||||
}
|
|
||||||
var _5: [Api.User]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
|
||||||
}
|
|
||||||
var _6: Api.updates.State?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
let _c5 = _5 != nil
|
|
||||||
let _c6 = _6 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
|
||||||
return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
var _2: Int32?
|
|
||||||
_2 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
if _c1 && _c2 {
|
|
||||||
return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
|
|
||||||
var _1: [Api.Message]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
|
||||||
}
|
|
||||||
var _2: [Api.EncryptedMessage]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
|
||||||
}
|
|
||||||
var _3: [Api.Update]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
|
||||||
}
|
|
||||||
var _4: [Api.Chat]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
|
||||||
}
|
|
||||||
var _5: [Api.User]?
|
|
||||||
if let _ = reader.readInt32() {
|
|
||||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
|
||||||
}
|
|
||||||
var _6: Api.updates.State?
|
|
||||||
if let signature = reader.readInt32() {
|
|
||||||
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
|
||||||
}
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
let _c2 = _2 != nil
|
|
||||||
let _c3 = _3 != nil
|
|
||||||
let _c4 = _4 != nil
|
|
||||||
let _c5 = _5 != nil
|
|
||||||
let _c6 = _6 != nil
|
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
|
||||||
return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.updates.Difference.differenceTooLong(pts: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|||||||
@ -1,3 +1,207 @@
|
|||||||
|
public extension Api.updates {
|
||||||
|
enum Difference: TypeConstructorDescription {
|
||||||
|
case difference(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], state: Api.updates.State)
|
||||||
|
case differenceEmpty(date: Int32, seq: Int32)
|
||||||
|
case differenceSlice(newMessages: [Api.Message], newEncryptedMessages: [Api.EncryptedMessage], otherUpdates: [Api.Update], chats: [Api.Chat], users: [Api.User], intermediateState: Api.updates.State)
|
||||||
|
case differenceTooLong(pts: Int32)
|
||||||
|
|
||||||
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
|
switch self {
|
||||||
|
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(16030880)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(newMessages.count))
|
||||||
|
for item in newMessages {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||||
|
for item in newEncryptedMessages {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(otherUpdates.count))
|
||||||
|
for item in otherUpdates {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
state.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
case .differenceEmpty(let date, let seq):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1567990072)
|
||||||
|
}
|
||||||
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(seq, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1459938943)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(newMessages.count))
|
||||||
|
for item in newMessages {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(newEncryptedMessages.count))
|
||||||
|
for item in newEncryptedMessages {
|
||||||
|
item.serialize(buffer, true)
|
||||||
|
}
|
||||||
|
buffer.appendInt32(481674261)
|
||||||
|
buffer.appendInt32(Int32(otherUpdates.count))
|
||||||
|
for item in otherUpdates {
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
intermediateState.serialize(buffer, true)
|
||||||
|
break
|
||||||
|
case .differenceTooLong(let pts):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(1258196845)
|
||||||
|
}
|
||||||
|
serializeInt32(pts, buffer: buffer, boxed: false)
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
|
switch self {
|
||||||
|
case .difference(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let state):
|
||||||
|
return ("difference", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("state", state as Any)])
|
||||||
|
case .differenceEmpty(let date, let seq):
|
||||||
|
return ("differenceEmpty", [("date", date as Any), ("seq", seq as Any)])
|
||||||
|
case .differenceSlice(let newMessages, let newEncryptedMessages, let otherUpdates, let chats, let users, let intermediateState):
|
||||||
|
return ("differenceSlice", [("newMessages", newMessages as Any), ("newEncryptedMessages", newEncryptedMessages as Any), ("otherUpdates", otherUpdates as Any), ("chats", chats as Any), ("users", users as Any), ("intermediateState", intermediateState as Any)])
|
||||||
|
case .differenceTooLong(let pts):
|
||||||
|
return ("differenceTooLong", [("pts", pts as Any)])
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static func parse_difference(_ reader: BufferReader) -> Difference? {
|
||||||
|
var _1: [Api.Message]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||||
|
}
|
||||||
|
var _2: [Api.EncryptedMessage]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||||
|
}
|
||||||
|
var _3: [Api.Update]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||||
|
}
|
||||||
|
var _4: [Api.Chat]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||||
|
}
|
||||||
|
var _5: [Api.User]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||||
|
}
|
||||||
|
var _6: Api.updates.State?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
let _c5 = _5 != nil
|
||||||
|
let _c6 = _6 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||||
|
return Api.updates.Difference.difference(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, state: _6!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_differenceEmpty(_ reader: BufferReader) -> Difference? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
if _c1 && _c2 {
|
||||||
|
return Api.updates.Difference.differenceEmpty(date: _1!, seq: _2!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_differenceSlice(_ reader: BufferReader) -> Difference? {
|
||||||
|
var _1: [Api.Message]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Message.self)
|
||||||
|
}
|
||||||
|
var _2: [Api.EncryptedMessage]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.EncryptedMessage.self)
|
||||||
|
}
|
||||||
|
var _3: [Api.Update]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Update.self)
|
||||||
|
}
|
||||||
|
var _4: [Api.Chat]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
|
||||||
|
}
|
||||||
|
var _5: [Api.User]?
|
||||||
|
if let _ = reader.readInt32() {
|
||||||
|
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
|
||||||
|
}
|
||||||
|
var _6: Api.updates.State?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
_6 = Api.parse(reader, signature: signature) as? Api.updates.State
|
||||||
|
}
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = _3 != nil
|
||||||
|
let _c4 = _4 != nil
|
||||||
|
let _c5 = _5 != nil
|
||||||
|
let _c6 = _6 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
|
||||||
|
return Api.updates.Difference.differenceSlice(newMessages: _1!, newEncryptedMessages: _2!, otherUpdates: _3!, chats: _4!, users: _5!, intermediateState: _6!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public static func parse_differenceTooLong(_ reader: BufferReader) -> Difference? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
if _c1 {
|
||||||
|
return Api.updates.Difference.differenceTooLong(pts: _1!)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.updates {
|
public extension Api.updates {
|
||||||
enum State: TypeConstructorDescription {
|
enum State: TypeConstructorDescription {
|
||||||
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
|
case state(pts: Int32, qts: Int32, date: Int32, seq: Int32, unreadCount: Int32)
|
||||||
|
|||||||
@ -9362,6 +9362,21 @@ public extension Api.functions.payments {
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public extension Api.functions.payments {
|
||||||
|
static func checkCanSendGift(giftId: Int64) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.CheckCanSendGiftResult>) {
|
||||||
|
let buffer = Buffer()
|
||||||
|
buffer.appendInt32(-1060835895)
|
||||||
|
serializeInt64(giftId, buffer: buffer, boxed: false)
|
||||||
|
return (FunctionDescription(name: "payments.checkCanSendGift", parameters: [("giftId", String(describing: giftId))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.payments.CheckCanSendGiftResult? in
|
||||||
|
let reader = BufferReader(buffer)
|
||||||
|
var result: Api.payments.CheckCanSendGiftResult?
|
||||||
|
if let signature = reader.readInt32() {
|
||||||
|
result = Api.parse(reader, signature: signature) as? Api.payments.CheckCanSendGiftResult
|
||||||
|
}
|
||||||
|
return result
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
public extension Api.functions.payments {
|
public extension Api.functions.payments {
|
||||||
static func checkGiftCode(slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.CheckedGiftCode>) {
|
static func checkGiftCode(slug: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.payments.CheckedGiftCode>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
|
|||||||
@ -191,7 +191,7 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
|
|||||||
guard let gift = StarGift(apiStarGift: apiGift) else {
|
guard let gift = StarGift(apiStarGift: apiGift) else {
|
||||||
return nil
|
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, upgraded: (flags & (1 << 5)) != 0, canUpgrade: (flags & (1 << 10)) != 0, upgradeStars: upgradeStars, isRefunded: (flags & (1 << 9)) != 0, isPrepaidUpgrade: (flags & (1 << 13)) != 0, upgradeMessageId: upgradeMessageId, peerId: peer?.peerId, senderId: fromId?.peerId, savedId: savedId, prepaidUpgradeHash: prepaidUpgradeHash, giftMessageId: giftMessageId))
|
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, upgraded: (flags & (1 << 5)) != 0, canUpgrade: (flags & (1 << 10)) != 0, upgradeStars: upgradeStars, isRefunded: (flags & (1 << 9)) != 0, isPrepaidUpgrade: (flags & (1 << 13)) != 0, upgradeMessageId: upgradeMessageId, peerId: peer?.peerId, senderId: fromId?.peerId, savedId: savedId, prepaidUpgradeHash: prepaidUpgradeHash, giftMessageId: giftMessageId, upgradeSeparate: (flags & (1 << 16)) != 0))
|
||||||
case let .messageActionStarGiftUnique(flags, apiGift, canExportAt, transferStars, fromId, peer, savedId, resaleAmount, canTransferDate, canResaleDate):
|
case let .messageActionStarGiftUnique(flags, apiGift, canExportAt, transferStars, fromId, peer, savedId, resaleAmount, canTransferDate, canResaleDate):
|
||||||
guard let gift = StarGift(apiStarGift: apiGift) else {
|
guard let gift = StarGift(apiStarGift: apiGift) else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -210,7 +210,7 @@ public class BoxedMessage: NSObject {
|
|||||||
|
|
||||||
public class Serialization: NSObject, MTSerialization {
|
public class Serialization: NSObject, MTSerialization {
|
||||||
public func currentLayer() -> UInt {
|
public func currentLayer() -> UInt {
|
||||||
return 213
|
return 214
|
||||||
}
|
}
|
||||||
|
|
||||||
public func parseMessage(_ data: Data!) -> Any! {
|
public func parseMessage(_ data: Data!) -> Any! {
|
||||||
|
|||||||
@ -243,7 +243,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(gift: StarGift, convertStars: Int64?, text: String?, entities: [MessageTextEntity]?, nameHidden: Bool, savedToProfile: Bool, converted: Bool, upgraded: Bool, canUpgrade: Bool, upgradeStars: Int64?, isRefunded: Bool, isPrepaidUpgrade: Bool, upgradeMessageId: Int32?, peerId: EnginePeer.Id?, senderId: EnginePeer.Id?, savedId: Int64?, prepaidUpgradeHash: String?, giftMessageId: Int32?)
|
case starGift(gift: StarGift, convertStars: Int64?, text: String?, entities: [MessageTextEntity]?, nameHidden: Bool, savedToProfile: Bool, converted: Bool, upgraded: Bool, canUpgrade: Bool, upgradeStars: Int64?, isRefunded: Bool, isPrepaidUpgrade: Bool, upgradeMessageId: Int32?, peerId: EnginePeer.Id?, senderId: EnginePeer.Id?, savedId: Int64?, prepaidUpgradeHash: String?, giftMessageId: Int32?, upgradeSeparate: Bool)
|
||||||
case starGiftUnique(gift: StarGift, isUpgrade: Bool, isTransferred: Bool, savedToProfile: Bool, canExportDate: Int32?, transferStars: Int64?, isRefunded: Bool, isPrepaidUpgrade: Bool, peerId: EnginePeer.Id?, senderId: EnginePeer.Id?, savedId: Int64?, resaleAmount: CurrencyAmount?, canTransferDate: Int32?, canResaleDate: Int32?)
|
case starGiftUnique(gift: StarGift, isUpgrade: Bool, isTransferred: Bool, savedToProfile: Bool, canExportDate: Int32?, transferStars: Int64?, isRefunded: Bool, isPrepaidUpgrade: Bool, peerId: EnginePeer.Id?, senderId: EnginePeer.Id?, savedId: Int64?, resaleAmount: CurrencyAmount?, canTransferDate: Int32?, canResaleDate: Int32?)
|
||||||
case paidMessagesRefunded(count: Int32, stars: Int64)
|
case paidMessagesRefunded(count: Int32, stars: Int64)
|
||||||
case paidMessagesPriceEdited(stars: Int64, broadcastMessagesAllowed: Bool)
|
case paidMessagesPriceEdited(stars: Int64, broadcastMessagesAllowed: Bool)
|
||||||
@ -375,7 +375,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(gift: decoder.decodeObjectForKey("gift", decoder: { StarGift(decoder: $0) }) as! StarGift, convertStars: decoder.decodeOptionalInt64ForKey("convertStars"), 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), upgraded: decoder.decodeBoolForKey("upgraded", orElse: false), canUpgrade: decoder.decodeBoolForKey("canUpgrade", orElse: false), upgradeStars: decoder.decodeOptionalInt64ForKey("upgradeStars"), isRefunded: decoder.decodeBoolForKey("isRefunded", orElse: false), isPrepaidUpgrade: decoder.decodeBoolForKey("isPrepaidUpgrade", orElse: false), upgradeMessageId: decoder.decodeOptionalInt32ForKey("upgradeMessageId"), peerId: decoder.decodeOptionalInt64ForKey("peerId").flatMap { EnginePeer.Id($0) }, senderId: decoder.decodeOptionalInt64ForKey("senderId").flatMap { EnginePeer.Id($0) }, savedId: decoder.decodeOptionalInt64ForKey("savedId"), prepaidUpgradeHash: decoder.decodeOptionalStringForKey("prepaidUpgradeHash"), giftMessageId: decoder.decodeOptionalInt32ForKey("giftMessageId"))
|
self = .starGift(gift: decoder.decodeObjectForKey("gift", decoder: { StarGift(decoder: $0) }) as! StarGift, convertStars: decoder.decodeOptionalInt64ForKey("convertStars"), 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), upgraded: decoder.decodeBoolForKey("upgraded", orElse: false), canUpgrade: decoder.decodeBoolForKey("canUpgrade", orElse: false), upgradeStars: decoder.decodeOptionalInt64ForKey("upgradeStars"), isRefunded: decoder.decodeBoolForKey("isRefunded", orElse: false), isPrepaidUpgrade: decoder.decodeBoolForKey("isPrepaidUpgrade", orElse: false), upgradeMessageId: decoder.decodeOptionalInt32ForKey("upgradeMessageId"), peerId: decoder.decodeOptionalInt64ForKey("peerId").flatMap { EnginePeer.Id($0) }, senderId: decoder.decodeOptionalInt64ForKey("senderId").flatMap { EnginePeer.Id($0) }, savedId: decoder.decodeOptionalInt64ForKey("savedId"), prepaidUpgradeHash: decoder.decodeOptionalStringForKey("prepaidUpgradeHash"), giftMessageId: decoder.decodeOptionalInt32ForKey("giftMessageId"), upgradeSeparate: decoder.decodeOptionalBoolForKey("upgradeSeparate") ?? false)
|
||||||
case 45:
|
case 45:
|
||||||
var resaleAmount: CurrencyAmount?
|
var resaleAmount: CurrencyAmount?
|
||||||
if let amount = decoder.decodeCodable(CurrencyAmount.self, forKey: "resaleAmount") {
|
if let amount = decoder.decodeCodable(CurrencyAmount.self, forKey: "resaleAmount") {
|
||||||
@ -705,7 +705,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "giveawayMsgId")
|
encoder.encodeNil(forKey: "giveawayMsgId")
|
||||||
}
|
}
|
||||||
case let .starGift(gift, convertStars, text, entities, nameHidden, savedToProfile, converted, upgraded, canUpgrade, upgradeStars, isRefunded, isPrepaidUpgrade, upgradeMessageId, peerId, senderId, savedId, prepaidUpgradeHash, giftMessageId):
|
case let .starGift(gift, convertStars, text, entities, nameHidden, savedToProfile, converted, upgraded, canUpgrade, upgradeStars, isRefunded, isPrepaidUpgrade, upgradeMessageId, peerId, senderId, savedId, prepaidUpgradeHash, giftMessageId, upgradeSeparate):
|
||||||
encoder.encodeInt32(44, forKey: "_rawValue")
|
encoder.encodeInt32(44, forKey: "_rawValue")
|
||||||
encoder.encodeObject(gift, forKey: "gift")
|
encoder.encodeObject(gift, forKey: "gift")
|
||||||
if let convertStars {
|
if let convertStars {
|
||||||
@ -762,6 +762,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: "giftMessageId")
|
encoder.encodeNil(forKey: "giftMessageId")
|
||||||
}
|
}
|
||||||
|
encoder.encodeBool(upgradeSeparate, forKey: "upgradeSeparate")
|
||||||
case let .starGiftUnique(gift, isUpgrade, isTransferred, savedToProfile, canExportDate, transferStars, isRefunded, isPrepaidUpgrade, peerId, senderId, savedId, resaleAmount, canTransferDate, canResaleDate):
|
case let .starGiftUnique(gift, isUpgrade, isTransferred, savedToProfile, canExportDate, transferStars, isRefunded, isPrepaidUpgrade, peerId, senderId, savedId, resaleAmount, canTransferDate, canResaleDate):
|
||||||
encoder.encodeInt32(45, forKey: "_rawValue")
|
encoder.encodeInt32(45, forKey: "_rawValue")
|
||||||
encoder.encodeObject(gift, forKey: "gift")
|
encoder.encodeObject(gift, forKey: "gift")
|
||||||
@ -887,7 +888,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
|
|||||||
return [peerId]
|
return [peerId]
|
||||||
case let .prizeStars(_, _, boostPeerId, _, _):
|
case let .prizeStars(_, _, boostPeerId, _, _):
|
||||||
return boostPeerId.flatMap { [$0] } ?? []
|
return boostPeerId.flatMap { [$0] } ?? []
|
||||||
case let .starGift(gift, _, _, _, _, _, _, _, _, _, _, _, _, peerId, senderId, _, _, _):
|
case let .starGift(gift, _, _, _, _, _, _, _, _, _, _, _, _, peerId, senderId, _, _, _, _):
|
||||||
var peerIds: [PeerId] = []
|
var peerIds: [PeerId] = []
|
||||||
if let peerId {
|
if let peerId {
|
||||||
peerIds.append(peerId)
|
peerIds.append(peerId)
|
||||||
|
|||||||
@ -17,7 +17,7 @@ public enum AppStoreTransactionPurpose {
|
|||||||
case gift(peerId: EnginePeer.Id, currency: String, amount: Int64)
|
case gift(peerId: EnginePeer.Id, currency: String, amount: Int64)
|
||||||
case giftCode(peerIds: [EnginePeer.Id], boostPeer: EnginePeer.Id?, currency: String, amount: Int64, text: String?, entities: [MessageTextEntity]?)
|
case giftCode(peerIds: [EnginePeer.Id], boostPeer: EnginePeer.Id?, currency: String, amount: Int64, text: String?, entities: [MessageTextEntity]?)
|
||||||
case giveaway(boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64)
|
case giveaway(boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64)
|
||||||
case stars(count: Int64, currency: String, amount: Int64)
|
case stars(count: Int64, currency: String, amount: Int64, peerId: EnginePeer.Id?)
|
||||||
case starsGift(peerId: EnginePeer.Id, count: Int64, currency: String, amount: Int64)
|
case starsGift(peerId: EnginePeer.Id, count: Int64, currency: String, amount: Int64)
|
||||||
case starsGiveaway(stars: Int64, boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
case starsGiveaway(stars: Int64, boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
||||||
case authCode(restore: Bool, phoneNumber: String, phoneCodeHash: String, currency: String, amount: Int64)
|
case authCode(restore: Bool, phoneNumber: String, phoneCodeHash: String, currency: String, amount: Int64)
|
||||||
@ -99,8 +99,24 @@ private func apiInputStorePaymentPurpose(postbox: Postbox, purpose: AppStoreTran
|
|||||||
return .single(.inputStorePaymentPremiumGiveaway(flags: flags, boostPeer: apiBoostPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: currency, amount: amount))
|
return .single(.inputStorePaymentPremiumGiveaway(flags: flags, boostPeer: apiBoostPeer, additionalPeers: additionalPeers, countriesIso2: countries, prizeDescription: prizeDescription, randomId: randomId, untilDate: untilDate, currency: currency, amount: amount))
|
||||||
}
|
}
|
||||||
|> switchToLatest
|
|> switchToLatest
|
||||||
case let .stars(count, currency, amount):
|
case let .stars(count, currency, amount, peerId):
|
||||||
return .single(.inputStorePaymentStarsTopup(stars: count, currency: currency, amount: amount))
|
let peerSignal: Signal<Api.InputPeer?, NoError>
|
||||||
|
if let peerId {
|
||||||
|
peerSignal = postbox.loadedPeerWithId(peerId)
|
||||||
|
|> map { peer in
|
||||||
|
return apiInputPeer(peer)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
peerSignal = .single(nil)
|
||||||
|
}
|
||||||
|
return peerSignal
|
||||||
|
|> map { spendPurposePeer in
|
||||||
|
var flags: Int32 = 0
|
||||||
|
if let _ = spendPurposePeer {
|
||||||
|
flags |= (1 << 0)
|
||||||
|
}
|
||||||
|
return .inputStorePaymentStarsTopup(flags: flags, stars: count, currency: currency, amount: amount, spendPurposePeer: spendPurposePeer)
|
||||||
|
}
|
||||||
case let .starsGift(peerId, count, currency, amount):
|
case let .starsGift(peerId, count, currency, amount):
|
||||||
return postbox.loadedPeerWithId(peerId)
|
return postbox.loadedPeerWithId(peerId)
|
||||||
|> mapToSignal { peer -> Signal<Api.InputStorePaymentPurpose, NoError> in
|
|> mapToSignal { peer -> Signal<Api.InputStorePaymentPurpose, NoError> in
|
||||||
|
|||||||
@ -9,7 +9,7 @@ public enum BotPaymentInvoiceSource {
|
|||||||
case slug(String)
|
case slug(String)
|
||||||
case premiumGiveaway(boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, option: PremiumGiftCodeOption)
|
case premiumGiveaway(boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, option: PremiumGiftCodeOption)
|
||||||
case giftCode(users: [PeerId], currency: String, amount: Int64, option: PremiumGiftCodeOption, text: String?, entities: [MessageTextEntity]?)
|
case giftCode(users: [PeerId], currency: String, amount: Int64, option: PremiumGiftCodeOption, text: String?, entities: [MessageTextEntity]?)
|
||||||
case stars(option: StarsTopUpOption)
|
case stars(option: StarsTopUpOption, peerId: EnginePeer.Id?)
|
||||||
case starsGift(peerId: EnginePeer.Id, count: Int64, currency: String, amount: Int64)
|
case starsGift(peerId: EnginePeer.Id, count: Int64, currency: String, amount: Int64)
|
||||||
case starsChatSubscription(hash: String)
|
case starsChatSubscription(hash: String)
|
||||||
case starsGiveaway(stars: Int64, boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
case starsGiveaway(stars: Int64, boostPeer: EnginePeer.Id, additionalPeerIds: [EnginePeer.Id], countries: [String], onlyNewSubscribers: Bool, showWinners: Bool, prizeDescription: String?, randomId: Int64, untilDate: Int32, currency: String, amount: Int64, users: Int32)
|
||||||
@ -325,12 +325,14 @@ func _internal_parseInputInvoice(transaction: Transaction, source: BotPaymentInv
|
|||||||
let option: Api.PremiumGiftCodeOption = .premiumGiftCodeOption(flags: flags, users: option.users, months: option.months, storeProduct: option.storeProductId, storeQuantity: option.storeQuantity, currency: option.currency, amount: option.amount)
|
let option: Api.PremiumGiftCodeOption = .premiumGiftCodeOption(flags: flags, users: option.users, months: option.months, storeProduct: option.storeProductId, storeQuantity: option.storeQuantity, currency: option.currency, amount: option.amount)
|
||||||
|
|
||||||
return .inputInvoicePremiumGiftCode(purpose: inputPurpose, option: option)
|
return .inputInvoicePremiumGiftCode(purpose: inputPurpose, option: option)
|
||||||
case let .stars(option):
|
case let .stars(option, peerId):
|
||||||
var flags: Int32 = 0
|
var flags: Int32 = 0
|
||||||
if let _ = option.storeProductId {
|
var spendPurposePeer: Api.InputPeer?
|
||||||
|
if let peerId, let peer = transaction.getPeer(peerId), let inputPeer = apiInputPeer(peer) {
|
||||||
flags |= (1 << 0)
|
flags |= (1 << 0)
|
||||||
|
spendPurposePeer = inputPeer
|
||||||
}
|
}
|
||||||
return .inputInvoiceStars(purpose: .inputStorePaymentStarsTopup(stars: option.count, currency: option.currency, amount: option.amount))
|
return .inputInvoiceStars(purpose: .inputStorePaymentStarsTopup(flags: flags, stars: option.count, currency: option.currency, amount: option.amount, spendPurposePeer: spendPurposePeer))
|
||||||
case let .starsGift(peerId, count, currency, amount):
|
case let .starsGift(peerId, count, currency, amount):
|
||||||
guard let peer = transaction.getPeer(peerId), let inputUser = apiInputUser(peer) else {
|
guard let peer = transaction.getPeer(peerId), let inputUser = apiInputUser(peer) else {
|
||||||
return nil
|
return nil
|
||||||
|
|||||||
@ -57,6 +57,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
case upgradeStars
|
case upgradeStars
|
||||||
case releasedBy
|
case releasedBy
|
||||||
case perUserLimit
|
case perUserLimit
|
||||||
|
case lockedUntilDate
|
||||||
}
|
}
|
||||||
|
|
||||||
public struct Availability: Equatable, Codable, PostboxCoding {
|
public struct Availability: Equatable, Codable, PostboxCoding {
|
||||||
@ -179,8 +180,9 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
public let upgradeStars: Int64?
|
public let upgradeStars: Int64?
|
||||||
public let releasedBy: EnginePeer.Id?
|
public let releasedBy: EnginePeer.Id?
|
||||||
public let perUserLimit: PerUserLimit?
|
public let perUserLimit: PerUserLimit?
|
||||||
|
public let lockedUntilDate: Int32?
|
||||||
|
|
||||||
public init(id: Int64, title: String?, file: TelegramMediaFile, price: Int64, convertStars: Int64, availability: Availability?, soldOut: SoldOut?, flags: Flags, upgradeStars: Int64?, releasedBy: EnginePeer.Id?, perUserLimit: PerUserLimit?) {
|
public init(id: Int64, title: String?, file: TelegramMediaFile, price: Int64, convertStars: Int64, availability: Availability?, soldOut: SoldOut?, flags: Flags, upgradeStars: Int64?, releasedBy: EnginePeer.Id?, perUserLimit: PerUserLimit?, lockedUntilDate: Int32?) {
|
||||||
self.id = id
|
self.id = id
|
||||||
self.title = title
|
self.title = title
|
||||||
self.file = file
|
self.file = file
|
||||||
@ -192,6 +194,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
self.upgradeStars = upgradeStars
|
self.upgradeStars = upgradeStars
|
||||||
self.releasedBy = releasedBy
|
self.releasedBy = releasedBy
|
||||||
self.perUserLimit = perUserLimit
|
self.perUserLimit = perUserLimit
|
||||||
|
self.lockedUntilDate = lockedUntilDate
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
@ -213,6 +216,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
self.upgradeStars = try container.decodeIfPresent(Int64.self, forKey: .upgradeStars)
|
self.upgradeStars = try container.decodeIfPresent(Int64.self, forKey: .upgradeStars)
|
||||||
self.releasedBy = try container.decodeIfPresent(EnginePeer.Id.self, forKey: .releasedBy)
|
self.releasedBy = try container.decodeIfPresent(EnginePeer.Id.self, forKey: .releasedBy)
|
||||||
self.perUserLimit = try container.decodeIfPresent(PerUserLimit.self, forKey: .perUserLimit)
|
self.perUserLimit = try container.decodeIfPresent(PerUserLimit.self, forKey: .perUserLimit)
|
||||||
|
self.lockedUntilDate = try container.decodeIfPresent(Int32.self, forKey: .lockedUntilDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(decoder: PostboxDecoder) {
|
public init(decoder: PostboxDecoder) {
|
||||||
@ -227,6 +231,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
self.upgradeStars = decoder.decodeOptionalInt64ForKey(CodingKeys.upgradeStars.rawValue)
|
self.upgradeStars = decoder.decodeOptionalInt64ForKey(CodingKeys.upgradeStars.rawValue)
|
||||||
self.releasedBy = decoder.decodeOptionalInt64ForKey(CodingKeys.releasedBy.rawValue).flatMap { EnginePeer.Id($0) }
|
self.releasedBy = decoder.decodeOptionalInt64ForKey(CodingKeys.releasedBy.rawValue).flatMap { EnginePeer.Id($0) }
|
||||||
self.perUserLimit = decoder.decodeObjectForKey(CodingKeys.perUserLimit.rawValue, decoder: { StarGift.Gift.PerUserLimit(decoder: $0) }) as? StarGift.Gift.PerUserLimit
|
self.perUserLimit = decoder.decodeObjectForKey(CodingKeys.perUserLimit.rawValue, decoder: { StarGift.Gift.PerUserLimit(decoder: $0) }) as? StarGift.Gift.PerUserLimit
|
||||||
|
self.lockedUntilDate = decoder.decodeOptionalInt32ForKey(CodingKeys.lockedUntilDate.rawValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -247,6 +252,7 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
try container.encodeIfPresent(self.upgradeStars, forKey: .upgradeStars)
|
try container.encodeIfPresent(self.upgradeStars, forKey: .upgradeStars)
|
||||||
try container.encodeIfPresent(self.releasedBy, forKey: .releasedBy)
|
try container.encodeIfPresent(self.releasedBy, forKey: .releasedBy)
|
||||||
try container.encodeIfPresent(self.perUserLimit, forKey: .perUserLimit)
|
try container.encodeIfPresent(self.perUserLimit, forKey: .perUserLimit)
|
||||||
|
try container.encodeIfPresent(self.lockedUntilDate, forKey: .lockedUntilDate)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(_ encoder: PostboxEncoder) {
|
public func encode(_ encoder: PostboxEncoder) {
|
||||||
@ -285,6 +291,11 @@ public enum StarGift: Equatable, Codable, PostboxCoding {
|
|||||||
} else {
|
} else {
|
||||||
encoder.encodeNil(forKey: CodingKeys.perUserLimit.rawValue)
|
encoder.encodeNil(forKey: CodingKeys.perUserLimit.rawValue)
|
||||||
}
|
}
|
||||||
|
if let lockedUntilDate = self.lockedUntilDate {
|
||||||
|
encoder.encodeInt32(lockedUntilDate, forKey: CodingKeys.lockedUntilDate.rawValue)
|
||||||
|
} else {
|
||||||
|
encoder.encodeNil(forKey: CodingKeys.lockedUntilDate.rawValue)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -843,7 +854,7 @@ public extension StarGift {
|
|||||||
extension StarGift {
|
extension StarGift {
|
||||||
init?(apiStarGift: Api.StarGift) {
|
init?(apiStarGift: Api.StarGift) {
|
||||||
switch apiStarGift {
|
switch apiStarGift {
|
||||||
case let .starGift(apiFlags, id, sticker, stars, availabilityRemains, availabilityTotal, availabilityResale, convertStars, firstSale, lastSale, upgradeStars, minResaleStars, title, releasedBy, perUserTotal, perUserRemains):
|
case let .starGift(apiFlags, id, sticker, stars, availabilityRemains, availabilityTotal, availabilityResale, convertStars, firstSale, lastSale, upgradeStars, minResaleStars, title, releasedBy, perUserTotal, perUserRemains, lockedUntilDate):
|
||||||
var flags = StarGift.Gift.Flags()
|
var flags = StarGift.Gift.Flags()
|
||||||
if (apiFlags & (1 << 2)) != 0 {
|
if (apiFlags & (1 << 2)) != 0 {
|
||||||
flags.insert(.isBirthdayGift)
|
flags.insert(.isBirthdayGift)
|
||||||
@ -872,7 +883,7 @@ extension StarGift {
|
|||||||
guard let file = telegramMediaFileFromApiDocument(sticker, altDocuments: nil) else {
|
guard let file = telegramMediaFileFromApiDocument(sticker, altDocuments: nil) else {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
self = .generic(StarGift.Gift(id: id, title: title, file: file, price: stars, convertStars: convertStars, availability: availability, soldOut: soldOut, flags: flags, upgradeStars: upgradeStars, releasedBy: releasedBy?.peerId, perUserLimit: perUserLimit))
|
self = .generic(StarGift.Gift(id: id, title: title, file: file, price: stars, convertStars: convertStars, availability: availability, soldOut: soldOut, flags: flags, upgradeStars: upgradeStars, releasedBy: releasedBy?.peerId, perUserLimit: perUserLimit, lockedUntilDate: lockedUntilDate))
|
||||||
case let .starGiftUnique(flags, id, giftId, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, giftAddress, resellAmounts, releasedBy, valueAmount, valueCurrency):
|
case let .starGiftUnique(flags, id, giftId, title, slug, num, ownerPeerId, ownerName, ownerAddress, attributes, availabilityIssued, availabilityTotal, giftAddress, resellAmounts, releasedBy, valueAmount, valueCurrency):
|
||||||
let owner: StarGift.UniqueGift.Owner
|
let owner: StarGift.UniqueGift.Owner
|
||||||
if let ownerAddress {
|
if let ownerAddress {
|
||||||
@ -1182,7 +1193,8 @@ func _internal_upgradeStarGift(account: Account, formId: Int64?, reference: Star
|
|||||||
canTransferDate: canTransferDate,
|
canTransferDate: canTransferDate,
|
||||||
canResaleDate: canResaleDate,
|
canResaleDate: canResaleDate,
|
||||||
collectionIds: nil,
|
collectionIds: nil,
|
||||||
prepaidUpgradeHash: nil
|
prepaidUpgradeHash: nil,
|
||||||
|
upgradeSeparate: false
|
||||||
))
|
))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1214,6 +1226,34 @@ func _internal_starGiftUpgradePreview(account: Account, giftId: Int64) -> Signal
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public enum CanSendGiftResult {
|
||||||
|
case available
|
||||||
|
case unavailable(text: String, entities: [MessageTextEntity])
|
||||||
|
case failed
|
||||||
|
}
|
||||||
|
|
||||||
|
func _internal_checkCanSendStarGift(account: Account, giftId: Int64) -> Signal<CanSendGiftResult, NoError> {
|
||||||
|
return account.network.request(Api.functions.payments.checkCanSendGift(giftId: giftId))
|
||||||
|
|> map(Optional.init)
|
||||||
|
|> `catch` { _ -> Signal<Api.payments.CheckCanSendGiftResult?, NoError> in
|
||||||
|
return .single(nil)
|
||||||
|
}
|
||||||
|
|> map { result in
|
||||||
|
guard let result else {
|
||||||
|
return .unavailable(text: "", entities: [])
|
||||||
|
}
|
||||||
|
switch result {
|
||||||
|
case .checkCanSendGiftResultOk:
|
||||||
|
return .available
|
||||||
|
case let .checkCanSendGiftResultFail(reason):
|
||||||
|
switch reason {
|
||||||
|
case let .textWithEntities(text, entities):
|
||||||
|
return .unavailable(text: text, entities: messageTextEntitiesFromApiEntities(entities))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
final class CachedProfileGifts: Codable {
|
final class CachedProfileGifts: Codable {
|
||||||
enum CodingKeys: String, CodingKey {
|
enum CodingKeys: String, CodingKey {
|
||||||
case gifts
|
case gifts
|
||||||
@ -2037,6 +2077,7 @@ public final class ProfileGiftsContext {
|
|||||||
case canResaleDate
|
case canResaleDate
|
||||||
case collectionIds
|
case collectionIds
|
||||||
case prepaidUpgradeHash
|
case prepaidUpgradeHash
|
||||||
|
case upgradeSeparate
|
||||||
}
|
}
|
||||||
|
|
||||||
public let gift: TelegramCore.StarGift
|
public let gift: TelegramCore.StarGift
|
||||||
@ -2057,6 +2098,7 @@ public final class ProfileGiftsContext {
|
|||||||
public let canResaleDate: Int32?
|
public let canResaleDate: Int32?
|
||||||
public let collectionIds: [Int32]?
|
public let collectionIds: [Int32]?
|
||||||
public let prepaidUpgradeHash: String?
|
public let prepaidUpgradeHash: String?
|
||||||
|
public let upgradeSeparate: Bool
|
||||||
|
|
||||||
fileprivate let _fromPeerId: EnginePeer.Id?
|
fileprivate let _fromPeerId: EnginePeer.Id?
|
||||||
|
|
||||||
@ -2082,7 +2124,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: Int32?,
|
canTransferDate: Int32?,
|
||||||
canResaleDate: Int32?,
|
canResaleDate: Int32?,
|
||||||
collectionIds: [Int32]?,
|
collectionIds: [Int32]?,
|
||||||
prepaidUpgradeHash: String?
|
prepaidUpgradeHash: String?,
|
||||||
|
upgradeSeparate: Bool
|
||||||
) {
|
) {
|
||||||
self.gift = gift
|
self.gift = gift
|
||||||
self.reference = reference
|
self.reference = reference
|
||||||
@ -2103,6 +2146,7 @@ public final class ProfileGiftsContext {
|
|||||||
self.canResaleDate = canResaleDate
|
self.canResaleDate = canResaleDate
|
||||||
self.collectionIds = collectionIds
|
self.collectionIds = collectionIds
|
||||||
self.prepaidUpgradeHash = prepaidUpgradeHash
|
self.prepaidUpgradeHash = prepaidUpgradeHash
|
||||||
|
self.upgradeSeparate = upgradeSeparate
|
||||||
}
|
}
|
||||||
|
|
||||||
public init(from decoder: Decoder) throws {
|
public init(from decoder: Decoder) throws {
|
||||||
@ -2133,6 +2177,7 @@ public final class ProfileGiftsContext {
|
|||||||
self.canResaleDate = try container.decodeIfPresent(Int32.self, forKey: .canResaleDate)
|
self.canResaleDate = try container.decodeIfPresent(Int32.self, forKey: .canResaleDate)
|
||||||
self.collectionIds = try container.decodeIfPresent([Int32].self, forKey: .collectionIds)
|
self.collectionIds = try container.decodeIfPresent([Int32].self, forKey: .collectionIds)
|
||||||
self.prepaidUpgradeHash = try container.decodeIfPresent(String.self, forKey: .prepaidUpgradeHash)
|
self.prepaidUpgradeHash = try container.decodeIfPresent(String.self, forKey: .prepaidUpgradeHash)
|
||||||
|
self.upgradeSeparate = try container.decodeIfPresent(Bool.self, forKey: .upgradeSeparate) ?? false
|
||||||
}
|
}
|
||||||
|
|
||||||
public func encode(to encoder: Encoder) throws {
|
public func encode(to encoder: Encoder) throws {
|
||||||
@ -2156,6 +2201,7 @@ public final class ProfileGiftsContext {
|
|||||||
try container.encodeIfPresent(self.canResaleDate, forKey: .canResaleDate)
|
try container.encodeIfPresent(self.canResaleDate, forKey: .canResaleDate)
|
||||||
try container.encodeIfPresent(self.collectionIds, forKey: .collectionIds)
|
try container.encodeIfPresent(self.collectionIds, forKey: .collectionIds)
|
||||||
try container.encodeIfPresent(self.prepaidUpgradeHash, forKey: .prepaidUpgradeHash)
|
try container.encodeIfPresent(self.prepaidUpgradeHash, forKey: .prepaidUpgradeHash)
|
||||||
|
try container.encode(self.upgradeSeparate, forKey: .upgradeSeparate)
|
||||||
}
|
}
|
||||||
|
|
||||||
public func withGift(_ gift: TelegramCore.StarGift) -> StarGift {
|
public func withGift(_ gift: TelegramCore.StarGift) -> StarGift {
|
||||||
@ -2177,7 +2223,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: self.canTransferDate,
|
canTransferDate: self.canTransferDate,
|
||||||
canResaleDate: self.canResaleDate,
|
canResaleDate: self.canResaleDate,
|
||||||
collectionIds: self.collectionIds,
|
collectionIds: self.collectionIds,
|
||||||
prepaidUpgradeHash: self.prepaidUpgradeHash
|
prepaidUpgradeHash: self.prepaidUpgradeHash,
|
||||||
|
upgradeSeparate: self.upgradeSeparate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2200,7 +2247,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: self.canTransferDate,
|
canTransferDate: self.canTransferDate,
|
||||||
canResaleDate: self.canResaleDate,
|
canResaleDate: self.canResaleDate,
|
||||||
collectionIds: self.collectionIds,
|
collectionIds: self.collectionIds,
|
||||||
prepaidUpgradeHash: self.prepaidUpgradeHash
|
prepaidUpgradeHash: self.prepaidUpgradeHash,
|
||||||
|
upgradeSeparate: self.upgradeSeparate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2223,7 +2271,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: self.canTransferDate,
|
canTransferDate: self.canTransferDate,
|
||||||
canResaleDate: self.canResaleDate,
|
canResaleDate: self.canResaleDate,
|
||||||
collectionIds: self.collectionIds,
|
collectionIds: self.collectionIds,
|
||||||
prepaidUpgradeHash: self.prepaidUpgradeHash
|
prepaidUpgradeHash: self.prepaidUpgradeHash,
|
||||||
|
upgradeSeparate: self.upgradeSeparate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
fileprivate func withFromPeer(_ fromPeer: EnginePeer?) -> StarGift {
|
fileprivate func withFromPeer(_ fromPeer: EnginePeer?) -> StarGift {
|
||||||
@ -2245,7 +2294,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: self.canTransferDate,
|
canTransferDate: self.canTransferDate,
|
||||||
canResaleDate: self.canResaleDate,
|
canResaleDate: self.canResaleDate,
|
||||||
collectionIds: self.collectionIds,
|
collectionIds: self.collectionIds,
|
||||||
prepaidUpgradeHash: self.prepaidUpgradeHash
|
prepaidUpgradeHash: self.prepaidUpgradeHash,
|
||||||
|
upgradeSeparate: self.upgradeSeparate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2268,7 +2318,8 @@ public final class ProfileGiftsContext {
|
|||||||
canTransferDate: self.canTransferDate,
|
canTransferDate: self.canTransferDate,
|
||||||
canResaleDate: self.canResaleDate,
|
canResaleDate: self.canResaleDate,
|
||||||
collectionIds: collectionIds,
|
collectionIds: collectionIds,
|
||||||
prepaidUpgradeHash: self.prepaidUpgradeHash
|
prepaidUpgradeHash: self.prepaidUpgradeHash,
|
||||||
|
upgradeSeparate: self.upgradeSeparate
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2519,6 +2570,7 @@ extension ProfileGiftsContext.State.StarGift {
|
|||||||
self.canResaleDate = canResaleAt
|
self.canResaleDate = canResaleAt
|
||||||
self.collectionIds = collectionIds
|
self.collectionIds = collectionIds
|
||||||
self.prepaidUpgradeHash = prepaidUpgradeHash
|
self.prepaidUpgradeHash = prepaidUpgradeHash
|
||||||
|
self.upgradeSeparate = (flags & (1 << 17)) != 0
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1654,7 +1654,8 @@ func _internal_sendStarsPaymentForm(account: Account, formId: Int64, source: Bot
|
|||||||
canTransferDate: canTransferDate,
|
canTransferDate: canTransferDate,
|
||||||
canResaleDate: canResaleDate,
|
canResaleDate: canResaleDate,
|
||||||
collectionIds: nil,
|
collectionIds: nil,
|
||||||
prepaidUpgradeHash: nil
|
prepaidUpgradeHash: nil,
|
||||||
|
upgradeSeparate: false
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -141,6 +141,10 @@ public extension TelegramEngine {
|
|||||||
return _internal_starGiftUpgradePreview(account: self.account, giftId: giftId)
|
return _internal_starGiftUpgradePreview(account: self.account, giftId: giftId)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public func checkCanSendStarGift(giftId: Int64) -> Signal<CanSendGiftResult, NoError> {
|
||||||
|
return _internal_checkCanSendStarGift(account: self.account, giftId: giftId)
|
||||||
|
}
|
||||||
|
|
||||||
public func getUniqueStarGift(slug: String) -> Signal<StarGift.UniqueGift?, NoError> {
|
public func getUniqueStarGift(slug: String) -> Signal<StarGift.UniqueGift?, NoError> {
|
||||||
return _internal_getUniqueStarGift(account: self.account, slug: slug)
|
return _internal_getUniqueStarGift(account: self.account, slug: slug)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user