mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-06-16 05:55:20 +00:00
Fix API
This commit is contained in:
parent
adae15d010
commit
f80ffdcfba
@ -629,9 +629,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1670052855] = { return Api.FoundGif.parse_foundGifCached($0) }
|
dict[-1670052855] = { return Api.FoundGif.parse_foundGifCached($0) }
|
||||||
dict[537022650] = { return Api.User.parse_userEmpty($0) }
|
dict[537022650] = { return Api.User.parse_userEmpty($0) }
|
||||||
dict[-1820043071] = { return Api.User.parse_user($0) }
|
dict[-1820043071] = { return Api.User.parse_user($0) }
|
||||||
dict[-2082087340] = { return Api.Message.parse_messageEmpty($0) }
|
|
||||||
dict[1487813065] = { return Api.Message.parse_message($0) }
|
dict[1487813065] = { return Api.Message.parse_message($0) }
|
||||||
dict[678405636] = { return Api.Message.parse_messageService($0) }
|
dict[678405636] = { return Api.Message.parse_messageService($0) }
|
||||||
|
dict[-1868117372] = { return Api.Message.parse_messageEmpty($0) }
|
||||||
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
|
dict[831924812] = { return Api.StatsGroupTopInviter.parse_statsGroupTopInviter($0) }
|
||||||
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
|
dict[186120336] = { return Api.messages.RecentStickers.parse_recentStickersNotModified($0) }
|
||||||
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
|
dict[586395571] = { return Api.messages.RecentStickers.parse_recentStickers($0) }
|
||||||
@ -652,7 +652,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) }
|
dict[-1056001329] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsSaved($0) }
|
||||||
dict[873977640] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentials($0) }
|
dict[873977640] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentials($0) }
|
||||||
dict[178373535] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsApplePay($0) }
|
dict[178373535] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsApplePay($0) }
|
||||||
dict[-905587442] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsAndroidPay($0) }
|
dict[-1966921727] = { return Api.InputPaymentCredentials.parse_inputPaymentCredentialsGooglePay($0) }
|
||||||
dict[-1239335713] = { return Api.ShippingOption.parse_shippingOption($0) }
|
dict[-1239335713] = { return Api.ShippingOption.parse_shippingOption($0) }
|
||||||
dict[859091184] = { return Api.InputSecureFile.parse_inputSecureFileUploaded($0) }
|
dict[859091184] = { return Api.InputSecureFile.parse_inputSecureFileUploaded($0) }
|
||||||
dict[1399317950] = { return Api.InputSecureFile.parse_inputSecureFile($0) }
|
dict[1399317950] = { return Api.InputSecureFile.parse_inputSecureFile($0) }
|
||||||
|
@ -18152,18 +18152,12 @@ public extension Api {
|
|||||||
|
|
||||||
}
|
}
|
||||||
public enum Message: TypeConstructorDescription {
|
public enum Message: TypeConstructorDescription {
|
||||||
case messageEmpty(id: Int32)
|
|
||||||
case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?)
|
case message(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, fwdFrom: Api.MessageFwdHeader?, viaBotId: Int32?, replyTo: Api.MessageReplyHeader?, date: Int32, message: String, media: Api.MessageMedia?, replyMarkup: Api.ReplyMarkup?, entities: [Api.MessageEntity]?, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?, editDate: Int32?, postAuthor: String?, groupedId: Int64?, restrictionReason: [Api.RestrictionReason]?)
|
||||||
case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction)
|
case messageService(flags: Int32, id: Int32, fromId: Api.Peer?, peerId: Api.Peer, replyTo: Api.MessageReplyHeader?, date: Int32, action: Api.MessageAction)
|
||||||
|
case messageEmpty(flags: Int32, id: Int32, peerId: Api.Peer?)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messageEmpty(let id):
|
|
||||||
if boxed {
|
|
||||||
buffer.appendInt32(-2082087340)
|
|
||||||
}
|
|
||||||
serializeInt32(id, buffer: buffer, boxed: false)
|
|
||||||
break
|
|
||||||
case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(1487813065)
|
buffer.appendInt32(1487813065)
|
||||||
@ -18208,31 +18202,28 @@ public extension Api {
|
|||||||
serializeInt32(date, buffer: buffer, boxed: false)
|
serializeInt32(date, buffer: buffer, boxed: false)
|
||||||
action.serialize(buffer, true)
|
action.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
|
case .messageEmpty(let flags, let id, let peerId):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1868117372)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
serializeInt32(id, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {peerId!.serialize(buffer, true)}
|
||||||
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public func descriptionFields() -> (String, [(String, Any)]) {
|
public func descriptionFields() -> (String, [(String, Any)]) {
|
||||||
switch self {
|
switch self {
|
||||||
case .messageEmpty(let id):
|
|
||||||
return ("messageEmpty", [("id", id)])
|
|
||||||
case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
case .message(let flags, let id, let fromId, let peerId, let fwdFrom, let viaBotId, let replyTo, let date, let message, let media, let replyMarkup, let entities, let views, let forwards, let replies, let editDate, let postAuthor, let groupedId, let restrictionReason):
|
||||||
return ("message", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("fwdFrom", fwdFrom), ("viaBotId", viaBotId), ("replyTo", replyTo), ("date", date), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("views", views), ("forwards", forwards), ("replies", replies), ("editDate", editDate), ("postAuthor", postAuthor), ("groupedId", groupedId), ("restrictionReason", restrictionReason)])
|
return ("message", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("fwdFrom", fwdFrom), ("viaBotId", viaBotId), ("replyTo", replyTo), ("date", date), ("message", message), ("media", media), ("replyMarkup", replyMarkup), ("entities", entities), ("views", views), ("forwards", forwards), ("replies", replies), ("editDate", editDate), ("postAuthor", postAuthor), ("groupedId", groupedId), ("restrictionReason", restrictionReason)])
|
||||||
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action):
|
case .messageService(let flags, let id, let fromId, let peerId, let replyTo, let date, let action):
|
||||||
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("replyTo", replyTo), ("date", date), ("action", action)])
|
return ("messageService", [("flags", flags), ("id", id), ("fromId", fromId), ("peerId", peerId), ("replyTo", replyTo), ("date", date), ("action", action)])
|
||||||
|
case .messageEmpty(let flags, let id, let peerId):
|
||||||
|
return ("messageEmpty", [("flags", flags), ("id", id), ("peerId", peerId)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static func parse_messageEmpty(_ reader: BufferReader) -> Message? {
|
|
||||||
var _1: Int32?
|
|
||||||
_1 = reader.readInt32()
|
|
||||||
let _c1 = _1 != nil
|
|
||||||
if _c1 {
|
|
||||||
return Api.Message.messageEmpty(id: _1!)
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
return nil
|
|
||||||
}
|
|
||||||
}
|
|
||||||
public static func parse_message(_ reader: BufferReader) -> Message? {
|
public static func parse_message(_ reader: BufferReader) -> Message? {
|
||||||
var _1: Int32?
|
var _1: Int32?
|
||||||
_1 = reader.readInt32()
|
_1 = reader.readInt32()
|
||||||
@ -18353,6 +18344,25 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_messageEmpty(_ reader: BufferReader) -> Message? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int32?
|
||||||
|
_2 = reader.readInt32()
|
||||||
|
var _3: Api.Peer?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
|
||||||
|
_3 = Api.parse(reader, signature: signature) as? Api.Peer
|
||||||
|
} }
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||||
|
if _c1 && _c2 && _c3 {
|
||||||
|
return Api.Message.messageEmpty(flags: _1!, id: _2!, peerId: _3)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
public enum StatsGroupTopInviter: TypeConstructorDescription {
|
public enum StatsGroupTopInviter: TypeConstructorDescription {
|
||||||
@ -18911,7 +18921,7 @@ public extension Api {
|
|||||||
case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
|
case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
|
||||||
case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
|
case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
|
||||||
case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
|
case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
|
||||||
case inputPaymentCredentialsAndroidPay(paymentToken: Api.DataJSON, googleTransactionId: String)
|
case inputPaymentCredentialsGooglePay(paymentToken: Api.DataJSON)
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
@ -18935,12 +18945,11 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
paymentData.serialize(buffer, true)
|
paymentData.serialize(buffer, true)
|
||||||
break
|
break
|
||||||
case .inputPaymentCredentialsAndroidPay(let paymentToken, let googleTransactionId):
|
case .inputPaymentCredentialsGooglePay(let paymentToken):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-905587442)
|
buffer.appendInt32(-1966921727)
|
||||||
}
|
}
|
||||||
paymentToken.serialize(buffer, true)
|
paymentToken.serialize(buffer, true)
|
||||||
serializeString(googleTransactionId, buffer: buffer, boxed: false)
|
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -18953,8 +18962,8 @@ public extension Api {
|
|||||||
return ("inputPaymentCredentials", [("flags", flags), ("data", data)])
|
return ("inputPaymentCredentials", [("flags", flags), ("data", data)])
|
||||||
case .inputPaymentCredentialsApplePay(let paymentData):
|
case .inputPaymentCredentialsApplePay(let paymentData):
|
||||||
return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData)])
|
return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData)])
|
||||||
case .inputPaymentCredentialsAndroidPay(let paymentToken, let googleTransactionId):
|
case .inputPaymentCredentialsGooglePay(let paymentToken):
|
||||||
return ("inputPaymentCredentialsAndroidPay", [("paymentToken", paymentToken), ("googleTransactionId", googleTransactionId)])
|
return ("inputPaymentCredentialsGooglePay", [("paymentToken", paymentToken)])
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -19001,17 +19010,14 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
public static func parse_inputPaymentCredentialsAndroidPay(_ reader: BufferReader) -> InputPaymentCredentials? {
|
public static func parse_inputPaymentCredentialsGooglePay(_ reader: BufferReader) -> InputPaymentCredentials? {
|
||||||
var _1: Api.DataJSON?
|
var _1: Api.DataJSON?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
|
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
|
||||||
}
|
}
|
||||||
var _2: String?
|
|
||||||
_2 = parseString(reader)
|
|
||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
if _c1 {
|
||||||
if _c1 && _c2 {
|
return Api.InputPaymentCredentials.inputPaymentCredentialsGooglePay(paymentToken: _1!)
|
||||||
return Api.InputPaymentCredentials.inputPaymentCredentialsAndroidPay(paymentToken: _1!, googleTransactionId: _2!)
|
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -116,8 +116,12 @@ func apiMessagePeerId(_ messsage: Api.Message) -> PeerId? {
|
|||||||
case let .message(message):
|
case let .message(message):
|
||||||
let chatPeerId = message.peerId
|
let chatPeerId = message.peerId
|
||||||
return chatPeerId.peerId
|
return chatPeerId.peerId
|
||||||
case .messageEmpty:
|
case let .messageEmpty(_, id, peerId):
|
||||||
|
if let peerId = peerId {
|
||||||
|
return peerId.peerId
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
}
|
||||||
case let .messageService(flags, _, fromId, chatPeerId, _, _, _):
|
case let .messageService(flags, _, fromId, chatPeerId, _, _, _):
|
||||||
return chatPeerId.peerId
|
return chatPeerId.peerId
|
||||||
}
|
}
|
||||||
|
@ -99,7 +99,7 @@ extension Api.Message {
|
|||||||
switch self {
|
switch self {
|
||||||
case let .message(message):
|
case let .message(message):
|
||||||
return message.id
|
return message.id
|
||||||
case let .messageEmpty(id):
|
case let .messageEmpty(_, id, _):
|
||||||
return id
|
return id
|
||||||
case let .messageService(_, id, _, _, _, _, _):
|
case let .messageService(_, id, _, _, _, _, _):
|
||||||
return id
|
return id
|
||||||
@ -115,8 +115,12 @@ extension Api.Message {
|
|||||||
|
|
||||||
let peerId: PeerId = message.peerId.peerId
|
let peerId: PeerId = message.peerId.peerId
|
||||||
return MessageId(peerId: peerId, namespace: namespace, id: id)
|
return MessageId(peerId: peerId, namespace: namespace, id: id)
|
||||||
case .messageEmpty:
|
case let .messageEmpty(_, id, peerId):
|
||||||
|
if let peerId = peerId {
|
||||||
|
return MessageId(peerId: peerId.peerId, namespace: Namespaces.Message.Cloud, id: id)
|
||||||
|
} else {
|
||||||
return nil
|
return nil
|
||||||
|
}
|
||||||
case let .messageService(flags, id, fromId, chatPeerId, _, _, _):
|
case let .messageService(flags, id, fromId, chatPeerId, _, _, _):
|
||||||
let peerId: PeerId = chatPeerId.peerId
|
let peerId: PeerId = chatPeerId.peerId
|
||||||
return MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: id)
|
return MessageId(peerId: peerId, namespace: Namespaces.Message.Cloud, id: id)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user