Update API

This commit is contained in:
Isaac 2025-02-18 14:44:50 +01:00
parent f17ead143a
commit caf985f13e
3 changed files with 44 additions and 7 deletions

View File

@ -382,6 +382,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[887591921] = { return Api.InputInvoice.parse_inputInvoiceChatInviteSubscription($0) }
dict[-977967015] = { return Api.InputInvoice.parse_inputInvoiceMessage($0) }
dict[-1734841331] = { return Api.InputInvoice.parse_inputInvoicePremiumGiftCode($0) }
dict[-625298705] = { return Api.InputInvoice.parse_inputInvoicePremiumGiftStars($0) }
dict[-1020867857] = { return Api.InputInvoice.parse_inputInvoiceSlug($0) }
dict[-396206446] = { return Api.InputInvoice.parse_inputInvoiceStarGift($0) }
dict[1247763417] = { return Api.InputInvoice.parse_inputInvoiceStarGiftTransfer($0) }
@ -766,7 +767,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-419066241] = { return Api.PostInteractionCounters.parse_postInteractionCountersMessage($0) }
dict[-1974989273] = { return Api.PostInteractionCounters.parse_postInteractionCountersStory($0) }
dict[629052971] = { return Api.PremiumGiftCodeOption.parse_premiumGiftCodeOption($0) }
dict[1958953753] = { return Api.PremiumGiftOption.parse_premiumGiftOption($0) }
dict[2042649079] = { return Api.PremiumGiftOption.parse_premiumGiftOption($0) }
dict[1596792306] = { return Api.PremiumSubscriptionOption.parse_premiumSubscriptionOption($0) }
dict[-1303143084] = { return Api.PrepaidGiveaway.parse_prepaidGiveaway($0) }
dict[-1700956192] = { return Api.PrepaidGiveaway.parse_prepaidStarsGiveaway($0) }

View File

@ -211,6 +211,7 @@ public extension Api {
case inputInvoiceChatInviteSubscription(hash: String)
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
case inputInvoicePremiumGiftStars(flags: Int32, userId: Api.InputUser, months: Int32, message: Api.TextWithEntities?)
case inputInvoiceSlug(slug: String)
case inputInvoiceStarGift(flags: Int32, peer: Api.InputPeer, giftId: Int64, message: Api.TextWithEntities?)
case inputInvoiceStarGiftTransfer(stargift: Api.InputSavedStarGift, toId: Api.InputPeer)
@ -239,6 +240,15 @@ public extension Api {
purpose.serialize(buffer, true)
option.serialize(buffer, true)
break
case .inputInvoicePremiumGiftStars(let flags, let userId, let months, let message):
if boxed {
buffer.appendInt32(-625298705)
}
serializeInt32(flags, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeInt32(months, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {message!.serialize(buffer, true)}
break
case .inputInvoiceSlug(let slug):
if boxed {
buffer.appendInt32(-1020867857)
@ -285,6 +295,8 @@ public extension Api {
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
case .inputInvoicePremiumGiftCode(let purpose, let option):
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
case .inputInvoicePremiumGiftStars(let flags, let userId, let months, let message):
return ("inputInvoicePremiumGiftStars", [("flags", flags as Any), ("userId", userId as Any), ("months", months as Any), ("message", message as Any)])
case .inputInvoiceSlug(let slug):
return ("inputInvoiceSlug", [("slug", slug as Any)])
case .inputInvoiceStarGift(let flags, let peer, let giftId, let message):
@ -343,6 +355,30 @@ public extension Api {
return nil
}
}
public static func parse_inputInvoicePremiumGiftStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputUser?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputUser
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Api.TextWithEntities?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputInvoice.inputInvoicePremiumGiftStars(flags: _1!, userId: _2!, months: _3!, message: _4)
}
else {
return nil
}
}
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)

View File

@ -980,19 +980,19 @@ public extension Api {
}
public extension Api {
enum PremiumGiftOption: TypeConstructorDescription {
case premiumGiftOption(flags: Int32, months: Int32, currency: String, amount: Int64, botUrl: String, storeProduct: String?)
case premiumGiftOption(flags: Int32, months: Int32, currency: String, amount: Int64, botUrl: String?, storeProduct: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .premiumGiftOption(let flags, let months, let currency, let amount, let botUrl, let storeProduct):
if boxed {
buffer.appendInt32(1958953753)
buffer.appendInt32(2042649079)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(months, buffer: buffer, boxed: false)
serializeString(currency, buffer: buffer, boxed: false)
serializeInt64(amount, buffer: buffer, boxed: false)
serializeString(botUrl, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(botUrl!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeString(storeProduct!, buffer: buffer, boxed: false)}
break
}
@ -1015,17 +1015,17 @@ public extension Api {
var _4: Int64?
_4 = reader.readInt64()
var _5: String?
_5 = parseString(reader)
if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
var _6: String?
if Int(_1!) & Int(1 << 0) != 0 {_6 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.PremiumGiftOption.premiumGiftOption(flags: _1!, months: _2!, currency: _3!, amount: _4!, botUrl: _5!, storeProduct: _6)
return Api.PremiumGiftOption.premiumGiftOption(flags: _1!, months: _2!, currency: _3!, amount: _4!, botUrl: _5, storeProduct: _6)
}
else {
return nil