mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-10-09 03:20:48 +00:00
Update API
This commit is contained in:
parent
b7829bbeba
commit
739adeff1f
@ -49,7 +49,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[-1255641564] = { return parseString($0) }
|
dict[-1255641564] = { return parseString($0) }
|
||||||
dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) }
|
dict[-1194283041] = { return Api.AccountDaysTTL.parse_accountDaysTTL($0) }
|
||||||
dict[1008422669] = { return Api.AppWebViewResult.parse_appWebViewResultUrl($0) }
|
dict[1008422669] = { return Api.AppWebViewResult.parse_appWebViewResultUrl($0) }
|
||||||
dict[-928371502] = { return Api.AttachMenuBot.parse_attachMenuBot($0) }
|
dict[-653423106] = { return Api.AttachMenuBot.parse_attachMenuBot($0) }
|
||||||
dict[-1297663893] = { return Api.AttachMenuBotIcon.parse_attachMenuBotIcon($0) }
|
dict[-1297663893] = { return Api.AttachMenuBotIcon.parse_attachMenuBotIcon($0) }
|
||||||
dict[1165423600] = { return Api.AttachMenuBotIconColor.parse_attachMenuBotIconColor($0) }
|
dict[1165423600] = { return Api.AttachMenuBotIconColor.parse_attachMenuBotIconColor($0) }
|
||||||
dict[1011024320] = { return Api.AttachMenuBots.parse_attachMenuBots($0) }
|
dict[1011024320] = { return Api.AttachMenuBots.parse_attachMenuBots($0) }
|
||||||
@ -884,6 +884,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
|
|||||||
dict[619974263] = { return Api.Update.parse_updateMessagePollVote($0) }
|
dict[619974263] = { return Api.Update.parse_updateMessagePollVote($0) }
|
||||||
dict[1578843320] = { return Api.Update.parse_updateMessageReactions($0) }
|
dict[1578843320] = { return Api.Update.parse_updateMessageReactions($0) }
|
||||||
dict[-2030252155] = { return Api.Update.parse_updateMoveStickerSetToTop($0) }
|
dict[-2030252155] = { return Api.Update.parse_updateMoveStickerSetToTop($0) }
|
||||||
|
dict[-1991136273] = { return Api.Update.parse_updateNewAuthorization($0) }
|
||||||
dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) }
|
dict[1656358105] = { return Api.Update.parse_updateNewChannelMessage($0) }
|
||||||
dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) }
|
dict[314359194] = { return Api.Update.parse_updateNewEncryptedMessage($0) }
|
||||||
dict[522914557] = { return Api.Update.parse_updateNewMessage($0) }
|
dict[522914557] = { return Api.Update.parse_updateNewMessage($0) }
|
||||||
|
@ -72,22 +72,22 @@ public extension Api {
|
|||||||
}
|
}
|
||||||
public extension Api {
|
public extension Api {
|
||||||
enum AttachMenuBot: TypeConstructorDescription {
|
enum AttachMenuBot: TypeConstructorDescription {
|
||||||
case attachMenuBot(flags: Int32, botId: Int64, shortName: String, peerTypes: [Api.AttachMenuPeerType], icons: [Api.AttachMenuBotIcon])
|
case attachMenuBot(flags: Int32, botId: Int64, shortName: String, peerTypes: [Api.AttachMenuPeerType]?, icons: [Api.AttachMenuBotIcon])
|
||||||
|
|
||||||
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
|
||||||
switch self {
|
switch self {
|
||||||
case .attachMenuBot(let flags, let botId, let shortName, let peerTypes, let icons):
|
case .attachMenuBot(let flags, let botId, let shortName, let peerTypes, let icons):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(-928371502)
|
buffer.appendInt32(-653423106)
|
||||||
}
|
}
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(botId, buffer: buffer, boxed: false)
|
serializeInt64(botId, buffer: buffer, boxed: false)
|
||||||
serializeString(shortName, buffer: buffer, boxed: false)
|
serializeString(shortName, buffer: buffer, boxed: false)
|
||||||
buffer.appendInt32(481674261)
|
if Int(flags) & Int(1 << 3) != 0 {buffer.appendInt32(481674261)
|
||||||
buffer.appendInt32(Int32(peerTypes.count))
|
buffer.appendInt32(Int32(peerTypes!.count))
|
||||||
for item in peerTypes {
|
for item in peerTypes! {
|
||||||
item.serialize(buffer, true)
|
item.serialize(buffer, true)
|
||||||
}
|
}}
|
||||||
buffer.appendInt32(481674261)
|
buffer.appendInt32(481674261)
|
||||||
buffer.appendInt32(Int32(icons.count))
|
buffer.appendInt32(Int32(icons.count))
|
||||||
for item in icons {
|
for item in icons {
|
||||||
@ -112,9 +112,9 @@ public extension Api {
|
|||||||
var _3: String?
|
var _3: String?
|
||||||
_3 = parseString(reader)
|
_3 = parseString(reader)
|
||||||
var _4: [Api.AttachMenuPeerType]?
|
var _4: [Api.AttachMenuPeerType]?
|
||||||
if let _ = reader.readInt32() {
|
if Int(_1!) & Int(1 << 3) != 0 {if let _ = reader.readInt32() {
|
||||||
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AttachMenuPeerType.self)
|
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AttachMenuPeerType.self)
|
||||||
}
|
} }
|
||||||
var _5: [Api.AttachMenuBotIcon]?
|
var _5: [Api.AttachMenuBotIcon]?
|
||||||
if let _ = reader.readInt32() {
|
if let _ = reader.readInt32() {
|
||||||
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AttachMenuBotIcon.self)
|
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.AttachMenuBotIcon.self)
|
||||||
@ -122,10 +122,10 @@ public extension Api {
|
|||||||
let _c1 = _1 != nil
|
let _c1 = _1 != nil
|
||||||
let _c2 = _2 != nil
|
let _c2 = _2 != nil
|
||||||
let _c3 = _3 != nil
|
let _c3 = _3 != nil
|
||||||
let _c4 = _4 != nil
|
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
|
||||||
let _c5 = _5 != nil
|
let _c5 = _5 != nil
|
||||||
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
return Api.AttachMenuBot.attachMenuBot(flags: _1!, botId: _2!, shortName: _3!, peerTypes: _4!, icons: _5!)
|
return Api.AttachMenuBot.attachMenuBot(flags: _1!, botId: _2!, shortName: _3!, peerTypes: _4, icons: _5!)
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
return nil
|
return nil
|
||||||
|
@ -1138,6 +1138,7 @@ public extension Api {
|
|||||||
case updateMessagePollVote(pollId: Int64, peer: Api.Peer, options: [Buffer], qts: Int32)
|
case updateMessagePollVote(pollId: Int64, peer: Api.Peer, options: [Buffer], qts: Int32)
|
||||||
case updateMessageReactions(flags: Int32, peer: Api.Peer, msgId: Int32, topMsgId: Int32?, reactions: Api.MessageReactions)
|
case updateMessageReactions(flags: Int32, peer: Api.Peer, msgId: Int32, topMsgId: Int32?, reactions: Api.MessageReactions)
|
||||||
case updateMoveStickerSetToTop(flags: Int32, stickerset: Int64)
|
case updateMoveStickerSetToTop(flags: Int32, stickerset: Int64)
|
||||||
|
case updateNewAuthorization(flags: Int32, hash: Int64, date: Int32?, device: String?, location: String?)
|
||||||
case updateNewChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
case updateNewChannelMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
||||||
case updateNewEncryptedMessage(message: Api.EncryptedMessage, qts: Int32)
|
case updateNewEncryptedMessage(message: Api.EncryptedMessage, qts: Int32)
|
||||||
case updateNewMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
case updateNewMessage(message: Api.Message, pts: Int32, ptsCount: Int32)
|
||||||
@ -1770,6 +1771,16 @@ public extension Api {
|
|||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
serializeInt64(stickerset, buffer: buffer, boxed: false)
|
serializeInt64(stickerset, buffer: buffer, boxed: false)
|
||||||
break
|
break
|
||||||
|
case .updateNewAuthorization(let flags, let hash, let date, let device, let location):
|
||||||
|
if boxed {
|
||||||
|
buffer.appendInt32(-1991136273)
|
||||||
|
}
|
||||||
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
|
serializeInt64(hash, buffer: buffer, boxed: false)
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(date!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeString(device!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 0) != 0 {serializeString(location!, buffer: buffer, boxed: false)}
|
||||||
|
break
|
||||||
case .updateNewChannelMessage(let message, let pts, let ptsCount):
|
case .updateNewChannelMessage(let message, let pts, let ptsCount):
|
||||||
if boxed {
|
if boxed {
|
||||||
buffer.appendInt32(1656358105)
|
buffer.appendInt32(1656358105)
|
||||||
@ -2319,6 +2330,8 @@ public extension Api {
|
|||||||
return ("updateMessageReactions", [("flags", flags as Any), ("peer", peer as Any), ("msgId", msgId as Any), ("topMsgId", topMsgId as Any), ("reactions", reactions as Any)])
|
return ("updateMessageReactions", [("flags", flags as Any), ("peer", peer as Any), ("msgId", msgId as Any), ("topMsgId", topMsgId as Any), ("reactions", reactions as Any)])
|
||||||
case .updateMoveStickerSetToTop(let flags, let stickerset):
|
case .updateMoveStickerSetToTop(let flags, let stickerset):
|
||||||
return ("updateMoveStickerSetToTop", [("flags", flags as Any), ("stickerset", stickerset as Any)])
|
return ("updateMoveStickerSetToTop", [("flags", flags as Any), ("stickerset", stickerset as Any)])
|
||||||
|
case .updateNewAuthorization(let flags, let hash, let date, let device, let location):
|
||||||
|
return ("updateNewAuthorization", [("flags", flags as Any), ("hash", hash as Any), ("date", date as Any), ("device", device as Any), ("location", location as Any)])
|
||||||
case .updateNewChannelMessage(let message, let pts, let ptsCount):
|
case .updateNewChannelMessage(let message, let pts, let ptsCount):
|
||||||
return ("updateNewChannelMessage", [("message", message as Any), ("pts", pts as Any), ("ptsCount", ptsCount as Any)])
|
return ("updateNewChannelMessage", [("message", message as Any), ("pts", pts as Any), ("ptsCount", ptsCount as Any)])
|
||||||
case .updateNewEncryptedMessage(let message, let qts):
|
case .updateNewEncryptedMessage(let message, let qts):
|
||||||
@ -3633,6 +3646,29 @@ public extension Api {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
public static func parse_updateNewAuthorization(_ reader: BufferReader) -> Update? {
|
||||||
|
var _1: Int32?
|
||||||
|
_1 = reader.readInt32()
|
||||||
|
var _2: Int64?
|
||||||
|
_2 = reader.readInt64()
|
||||||
|
var _3: Int32?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_3 = reader.readInt32() }
|
||||||
|
var _4: String?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
|
||||||
|
var _5: String?
|
||||||
|
if Int(_1!) & Int(1 << 0) != 0 {_5 = parseString(reader) }
|
||||||
|
let _c1 = _1 != nil
|
||||||
|
let _c2 = _2 != nil
|
||||||
|
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
|
||||||
|
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
|
||||||
|
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
|
||||||
|
if _c1 && _c2 && _c3 && _c4 && _c5 {
|
||||||
|
return Api.Update.updateNewAuthorization(flags: _1!, hash: _2!, date: _3, device: _4, location: _5)
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
}
|
||||||
public static func parse_updateNewChannelMessage(_ reader: BufferReader) -> Update? {
|
public static func parse_updateNewChannelMessage(_ reader: BufferReader) -> Update? {
|
||||||
var _1: Api.Message?
|
var _1: Api.Message?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
|
@ -6369,15 +6369,16 @@ public extension Api.functions.messages {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
public extension Api.functions.messages {
|
public extension Api.functions.messages {
|
||||||
static func requestSimpleWebView(flags: Int32, bot: Api.InputUser, url: String, themeParams: Api.DataJSON?, platform: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.SimpleWebViewResult>) {
|
static func requestSimpleWebView(flags: Int32, bot: Api.InputUser, url: String?, startParam: String?, themeParams: Api.DataJSON?, platform: String) -> (FunctionDescription, Buffer, DeserializeFunctionResponse<Api.SimpleWebViewResult>) {
|
||||||
let buffer = Buffer()
|
let buffer = Buffer()
|
||||||
buffer.appendInt32(698084494)
|
buffer.appendInt32(440815626)
|
||||||
serializeInt32(flags, buffer: buffer, boxed: false)
|
serializeInt32(flags, buffer: buffer, boxed: false)
|
||||||
bot.serialize(buffer, true)
|
bot.serialize(buffer, true)
|
||||||
serializeString(url, buffer: buffer, boxed: false)
|
if Int(flags) & Int(1 << 3) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
|
||||||
|
if Int(flags) & Int(1 << 4) != 0 {serializeString(startParam!, buffer: buffer, boxed: false)}
|
||||||
if Int(flags) & Int(1 << 0) != 0 {themeParams!.serialize(buffer, true)}
|
if Int(flags) & Int(1 << 0) != 0 {themeParams!.serialize(buffer, true)}
|
||||||
serializeString(platform, buffer: buffer, boxed: false)
|
serializeString(platform, buffer: buffer, boxed: false)
|
||||||
return (FunctionDescription(name: "messages.requestSimpleWebView", parameters: [("flags", String(describing: flags)), ("bot", String(describing: bot)), ("url", String(describing: url)), ("themeParams", String(describing: themeParams)), ("platform", String(describing: platform))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.SimpleWebViewResult? in
|
return (FunctionDescription(name: "messages.requestSimpleWebView", parameters: [("flags", String(describing: flags)), ("bot", String(describing: bot)), ("url", String(describing: url)), ("startParam", String(describing: startParam)), ("themeParams", String(describing: themeParams)), ("platform", String(describing: platform))]), buffer, DeserializeFunctionResponse { (buffer: Buffer) -> Api.SimpleWebViewResult? in
|
||||||
let reader = BufferReader(buffer)
|
let reader = BufferReader(buffer)
|
||||||
var result: Api.SimpleWebViewResult?
|
var result: Api.SimpleWebViewResult?
|
||||||
if let signature = reader.readInt32() {
|
if let signature = reader.readInt32() {
|
||||||
|
@ -302,7 +302,7 @@ func managedSynchronizeAttachMenuBots(accountPeerId: PeerId, postbox: Postbox, n
|
|||||||
}
|
}
|
||||||
if !icons.isEmpty {
|
if !icons.isEmpty {
|
||||||
var peerTypes: AttachMenuBots.Bot.PeerFlags = []
|
var peerTypes: AttachMenuBots.Bot.PeerFlags = []
|
||||||
for apiType in apiPeerTypes {
|
for apiType in apiPeerTypes ?? [] {
|
||||||
switch apiType {
|
switch apiType {
|
||||||
case .attachMenuPeerTypeSameBotPM:
|
case .attachMenuPeerTypeSameBotPM:
|
||||||
peerTypes.insert(.sameBot)
|
peerTypes.insert(.sameBot)
|
||||||
@ -505,7 +505,7 @@ func _internal_getAttachMenuBot(accountPeerId: PeerId, postbox: Postbox, network
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
var peerTypes: AttachMenuBots.Bot.PeerFlags = []
|
var peerTypes: AttachMenuBots.Bot.PeerFlags = []
|
||||||
for apiType in apiPeerTypes {
|
for apiType in apiPeerTypes ?? [] {
|
||||||
switch apiType {
|
switch apiType {
|
||||||
case .attachMenuPeerTypeSameBotPM:
|
case .attachMenuPeerTypeSameBotPM:
|
||||||
peerTypes.insert(.sameBot)
|
peerTypes.insert(.sameBot)
|
||||||
|
@ -31,7 +31,7 @@ func _internal_requestSimpleWebView(postbox: Postbox, network: Network, botId: P
|
|||||||
if inline {
|
if inline {
|
||||||
flags |= (1 << 1)
|
flags |= (1 << 1)
|
||||||
}
|
}
|
||||||
return network.request(Api.functions.messages.requestSimpleWebView(flags: flags, bot: inputUser, url: url, themeParams: serializedThemeParams, platform: botWebViewPlatform))
|
return network.request(Api.functions.messages.requestSimpleWebView(flags: flags, bot: inputUser, url: url, startParam: nil, themeParams: serializedThemeParams, platform: botWebViewPlatform))
|
||||||
|> mapError { _ -> RequestSimpleWebViewError in
|
|> mapError { _ -> RequestSimpleWebViewError in
|
||||||
return .generic
|
return .generic
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user