Update API

This commit is contained in:
Ali 2023-01-11 13:41:48 +04:00
parent 858f765d1c
commit 28b2e25514
37 changed files with 30005 additions and 29446 deletions

View File

@ -211,6 +211,8 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[594408994] = { return Api.EmojiKeyword.parse_emojiKeywordDeleted($0) }
dict[1556570557] = { return Api.EmojiKeywordsDifference.parse_emojiKeywordsDifference($0) }
dict[-1275374751] = { return Api.EmojiLanguage.parse_emojiLanguage($0) }
dict[2048790993] = { return Api.EmojiList.parse_emojiList($0) }
dict[1209970170] = { return Api.EmojiList.parse_emojiListNotModified($0) }
dict[-1835310691] = { return Api.EmojiStatus.parse_emojiStatus($0) }
dict[769727150] = { return Api.EmojiStatus.parse_emojiStatusEmpty($0) }
dict[-97474361] = { return Api.EmojiStatus.parse_emojiStatusUntil($0) }
@ -408,6 +410,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[901503851] = { return Api.KeyboardButton.parse_keyboardButtonCallback($0) }
dict[1358175439] = { return Api.KeyboardButton.parse_keyboardButtonGame($0) }
dict[-59151553] = { return Api.KeyboardButton.parse_keyboardButtonRequestGeoLocation($0) }
dict[218842764] = { return Api.KeyboardButton.parse_keyboardButtonRequestPeer($0) }
dict[-1318425559] = { return Api.KeyboardButton.parse_keyboardButtonRequestPhone($0) }
dict[-1144565411] = { return Api.KeyboardButton.parse_keyboardButtonRequestPoll($0) }
dict[-1598009252] = { return Api.KeyboardButton.parse_keyboardButtonSimpleWebView($0) }
@ -454,6 +457,7 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[-1892568281] = { return Api.MessageAction.parse_messageActionPaymentSentMe($0) }
dict[-2132731265] = { return Api.MessageAction.parse_messageActionPhoneCall($0) }
dict[-1799538451] = { return Api.MessageAction.parse_messageActionPinMessage($0) }
dict[-25742243] = { return Api.MessageAction.parse_messageActionRequestedPeer($0) }
dict[1200788123] = { return Api.MessageAction.parse_messageActionScreenshotTaken($0) }
dict[-648257196] = { return Api.MessageAction.parse_messageActionSecureValuesSent($0) }
dict[455635795] = { return Api.MessageAction.parse_messageActionSecureValuesSentMe($0) }
@ -660,6 +664,9 @@ fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
dict[777640226] = { return Api.ReportReason.parse_inputReportReasonPornography($0) }
dict[1490799288] = { return Api.ReportReason.parse_inputReportReasonSpam($0) }
dict[505595789] = { return Api.ReportReason.parse_inputReportReasonViolence($0) }
dict[401534846] = { return Api.RequestPeerType.parse_requestPeerTypeBroadcast($0) }
dict[-54345306] = { return Api.RequestPeerType.parse_requestPeerTypeChat($0) }
dict[1597737472] = { return Api.RequestPeerType.parse_requestPeerTypeUser($0) }
dict[-797791052] = { return Api.RestrictionReason.parse_restrictionReason($0) }
dict[894777186] = { return Api.RichText.parse_textAnchor($0) }
dict[1730456516] = { return Api.RichText.parse_textBold($0) }
@ -1290,6 +1297,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiLanguage:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiList:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiStatus:
_1.serialize(buffer, boxed)
case let _1 as Api.EmojiURL:
@ -1560,6 +1569,8 @@ public extension Api {
_1.serialize(buffer, boxed)
case let _1 as Api.ReportReason:
_1.serialize(buffer, boxed)
case let _1 as Api.RequestPeerType:
_1.serialize(buffer, boxed)
case let _1 as Api.RestrictionReason:
_1.serialize(buffer, boxed)
case let _1 as Api.RichText:

View File

@ -1,3 +1,231 @@
public extension Api {
enum InputSecureFile: TypeConstructorDescription {
case inputSecureFile(id: Int64, accessHash: Int64)
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureFile(let id, let accessHash):
if boxed {
buffer.appendInt32(1399317950)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
if boxed {
buffer.appendInt32(859091184)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt32(parts, buffer: buffer, boxed: false)
serializeString(md5Checksum, buffer: buffer, boxed: false)
serializeBytes(fileHash, buffer: buffer, boxed: false)
serializeBytes(secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureFile(let id, let accessHash):
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
}
}
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureValue: TypeConstructorDescription {
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
if boxed {
buffer.appendInt32(-618540889)
}
serializeInt32(flags, buffer: buffer, boxed: false)
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(translation!.count))
for item in translation! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
}
}
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
var _4: Api.InputSecureFile?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _5: Api.InputSecureFile?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _6: Api.InputSecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _7: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _8: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _9: Api.SecurePlainData?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputSingleMedia: TypeConstructorDescription {
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSingleMedia(let flags, let media, let randomId, let message, let entities):
if boxed {
buffer.appendInt32(482797855)
}
serializeInt32(flags, buffer: buffer, boxed: false)
media.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSingleMedia(let flags, let media, let randomId, let message, let entities):
return ("inputSingleMedia", [("flags", flags as Any), ("media", media as Any), ("randomId", randomId as Any), ("message", message as Any), ("entities", entities as Any)])
}
}
public static func parse_inputSingleMedia(_ reader: BufferReader) -> InputSingleMedia? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputMedia?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputMedia
}
var _3: Int64?
_3 = reader.readInt64()
var _4: String?
_4 = parseString(reader)
var _5: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSingleMedia.inputSingleMedia(flags: _1!, media: _2!, randomId: _3!, message: _4!, entities: _5)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputStickerSet: TypeConstructorDescription {
case inputStickerSetAnimatedEmoji
@ -816,255 +1044,3 @@ public extension Api {
}
}
public extension Api {
enum Invoice: TypeConstructorDescription {
case invoice(flags: Int32, currency: String, prices: [Api.LabeledPrice], maxTipAmount: Int64?, suggestedTipAmounts: [Int64]?, recurringTermsUrl: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let recurringTermsUrl):
if boxed {
buffer.appendInt32(1048946971)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(currency, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(prices.count))
for item in prices {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 8) != 0 {serializeInt64(maxTipAmount!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 8) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(suggestedTipAmounts!.count))
for item in suggestedTipAmounts! {
serializeInt64(item, buffer: buffer, boxed: false)
}}
if Int(flags) & Int(1 << 9) != 0 {serializeString(recurringTermsUrl!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .invoice(let flags, let currency, let prices, let maxTipAmount, let suggestedTipAmounts, let recurringTermsUrl):
return ("invoice", [("flags", flags as Any), ("currency", currency as Any), ("prices", prices as Any), ("maxTipAmount", maxTipAmount as Any), ("suggestedTipAmounts", suggestedTipAmounts as Any), ("recurringTermsUrl", recurringTermsUrl as Any)])
}
}
public static func parse_invoice(_ reader: BufferReader) -> Invoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: [Api.LabeledPrice]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.LabeledPrice.self)
}
var _4: Int64?
if Int(_1!) & Int(1 << 8) != 0 {_4 = reader.readInt64() }
var _5: [Int64]?
if Int(_1!) & Int(1 << 8) != 0 {if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
} }
var _6: String?
if Int(_1!) & Int(1 << 9) != 0 {_6 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 8) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 9) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.Invoice.invoice(flags: _1!, currency: _2!, prices: _3!, maxTipAmount: _4, suggestedTipAmounts: _5, recurringTermsUrl: _6)
}
else {
return nil
}
}
}
}
public extension Api {
enum JSONObjectValue: TypeConstructorDescription {
case jsonObjectValue(key: String, value: Api.JSONValue)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .jsonObjectValue(let key, let value):
if boxed {
buffer.appendInt32(-1059185703)
}
serializeString(key, buffer: buffer, boxed: false)
value.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .jsonObjectValue(let key, let value):
return ("jsonObjectValue", [("key", key as Any), ("value", value as Any)])
}
}
public static func parse_jsonObjectValue(_ reader: BufferReader) -> JSONObjectValue? {
var _1: String?
_1 = parseString(reader)
var _2: Api.JSONValue?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.JSONValue
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.JSONObjectValue.jsonObjectValue(key: _1!, value: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum JSONValue: TypeConstructorDescription {
case jsonArray(value: [Api.JSONValue])
case jsonBool(value: Api.Bool)
case jsonNull
case jsonNumber(value: Double)
case jsonObject(value: [Api.JSONObjectValue])
case jsonString(value: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .jsonArray(let value):
if boxed {
buffer.appendInt32(-146520221)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(value.count))
for item in value {
item.serialize(buffer, true)
}
break
case .jsonBool(let value):
if boxed {
buffer.appendInt32(-952869270)
}
value.serialize(buffer, true)
break
case .jsonNull:
if boxed {
buffer.appendInt32(1064139624)
}
break
case .jsonNumber(let value):
if boxed {
buffer.appendInt32(736157604)
}
serializeDouble(value, buffer: buffer, boxed: false)
break
case .jsonObject(let value):
if boxed {
buffer.appendInt32(-1715350371)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(value.count))
for item in value {
item.serialize(buffer, true)
}
break
case .jsonString(let value):
if boxed {
buffer.appendInt32(-1222740358)
}
serializeString(value, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .jsonArray(let value):
return ("jsonArray", [("value", value as Any)])
case .jsonBool(let value):
return ("jsonBool", [("value", value as Any)])
case .jsonNull:
return ("jsonNull", [])
case .jsonNumber(let value):
return ("jsonNumber", [("value", value as Any)])
case .jsonObject(let value):
return ("jsonObject", [("value", value as Any)])
case .jsonString(let value):
return ("jsonString", [("value", value as Any)])
}
}
public static func parse_jsonArray(_ reader: BufferReader) -> JSONValue? {
var _1: [Api.JSONValue]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.JSONValue.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.JSONValue.jsonArray(value: _1!)
}
else {
return nil
}
}
public static func parse_jsonBool(_ reader: BufferReader) -> JSONValue? {
var _1: Api.Bool?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
if _c1 {
return Api.JSONValue.jsonBool(value: _1!)
}
else {
return nil
}
}
public static func parse_jsonNull(_ reader: BufferReader) -> JSONValue? {
return Api.JSONValue.jsonNull
}
public static func parse_jsonNumber(_ reader: BufferReader) -> JSONValue? {
var _1: Double?
_1 = reader.readDouble()
let _c1 = _1 != nil
if _c1 {
return Api.JSONValue.jsonNumber(value: _1!)
}
else {
return nil
}
}
public static func parse_jsonObject(_ reader: BufferReader) -> JSONValue? {
var _1: [Api.JSONObjectValue]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.JSONObjectValue.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.JSONValue.jsonObject(value: _1!)
}
else {
return nil
}
}
public static func parse_jsonString(_ reader: BufferReader) -> JSONValue? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.JSONValue.jsonString(value: _1!)
}
else {
return nil
}
}
}
}

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -386,6 +386,64 @@ public extension Api {
}
}
public extension Api {
enum EmojiList: TypeConstructorDescription {
case emojiList(hash: Int64, documentId: [Int64])
case emojiListNotModified
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .emojiList(let hash, let documentId):
if boxed {
buffer.appendInt32(2048790993)
}
serializeInt64(hash, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(documentId.count))
for item in documentId {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .emojiListNotModified:
if boxed {
buffer.appendInt32(1209970170)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .emojiList(let hash, let documentId):
return ("emojiList", [("hash", hash as Any), ("documentId", documentId as Any)])
case .emojiListNotModified:
return ("emojiListNotModified", [])
}
}
public static func parse_emojiList(_ reader: BufferReader) -> EmojiList? {
var _1: Int64?
_1 = reader.readInt64()
var _2: [Int64]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.EmojiList.emojiList(hash: _1!, documentId: _2!)
}
else {
return nil
}
}
public static func parse_emojiListNotModified(_ reader: BufferReader) -> EmojiList? {
return Api.EmojiList.emojiListNotModified
}
}
}
public extension Api {
enum EmojiStatus: TypeConstructorDescription {
case emojiStatus(documentId: Int64)
@ -1040,95 +1098,3 @@ public extension Api {
}
}
public extension Api {
enum Folder: TypeConstructorDescription {
case folder(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .folder(let flags, let id, let title, let photo):
if boxed {
buffer.appendInt32(-11252123)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {photo!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .folder(let flags, let id, let title, let photo):
return ("folder", [("flags", flags as Any), ("id", id as Any), ("title", title as Any), ("photo", photo as Any)])
}
}
public static func parse_folder(_ reader: BufferReader) -> Folder? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Api.ChatPhoto?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.ChatPhoto
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.Folder.folder(flags: _1!, id: _2!, title: _3!, photo: _4)
}
else {
return nil
}
}
}
}
public extension Api {
enum FolderPeer: TypeConstructorDescription {
case folderPeer(peer: Api.Peer, folderId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .folderPeer(let peer, let folderId):
if boxed {
buffer.appendInt32(-373643672)
}
peer.serialize(buffer, true)
serializeInt32(folderId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .folderPeer(let peer, let folderId):
return ("folderPeer", [("peer", peer as Any), ("folderId", folderId as Any)])
}
}
public static func parse_folderPeer(_ reader: BufferReader) -> FolderPeer? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.FolderPeer.folderPeer(peer: _1!, folderId: _2!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,95 @@
public extension Api {
enum Folder: TypeConstructorDescription {
case folder(flags: Int32, id: Int32, title: String, photo: Api.ChatPhoto?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .folder(let flags, let id, let title, let photo):
if boxed {
buffer.appendInt32(-11252123)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(id, buffer: buffer, boxed: false)
serializeString(title, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {photo!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .folder(let flags, let id, let title, let photo):
return ("folder", [("flags", flags as Any), ("id", id as Any), ("title", title as Any), ("photo", photo as Any)])
}
}
public static func parse_folder(_ reader: BufferReader) -> Folder? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Api.ChatPhoto?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.ChatPhoto
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 3) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.Folder.folder(flags: _1!, id: _2!, title: _3!, photo: _4)
}
else {
return nil
}
}
}
}
public extension Api {
enum FolderPeer: TypeConstructorDescription {
case folderPeer(peer: Api.Peer, folderId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .folderPeer(let peer, let folderId):
if boxed {
buffer.appendInt32(-373643672)
}
peer.serialize(buffer, true)
serializeInt32(folderId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .folderPeer(let peer, let folderId):
return ("folderPeer", [("peer", peer as Any), ("folderId", folderId as Any)])
}
}
public static func parse_folderPeer(_ reader: BufferReader) -> FolderPeer? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.FolderPeer.folderPeer(peer: _1!, folderId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum ForumTopic: TypeConstructorDescription {
case forumTopic(flags: Int32, id: Int32, date: Int32, title: String, iconColor: Int32, iconEmojiId: Int64?, topMessage: Int32, readInboxMaxId: Int32, readOutboxMaxId: Int32, unreadCount: Int32, unreadMentionsCount: Int32, unreadReactionsCount: Int32, fromId: Api.Peer, notifySettings: Api.PeerNotifySettings, draft: Api.DraftMessage?)
@ -1262,191 +1354,3 @@ public extension Api {
}
}
public extension Api {
enum InputBotInlineResult: TypeConstructorDescription {
case inputBotInlineResult(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumb: Api.InputWebDocument?, content: Api.InputWebDocument?, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultDocument(flags: Int32, id: String, type: String, title: String?, description: String?, document: Api.InputDocument, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultGame(id: String, shortName: String, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultPhoto(id: String, type: String, photo: Api.InputPhoto, sendMessage: Api.InputBotInlineMessage)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumb, let content, let sendMessage):
if boxed {
buffer.appendInt32(-2000710887)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {thumb!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {content!.serialize(buffer, true)}
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultDocument(let flags, let id, let type, let title, let description, let document, let sendMessage):
if boxed {
buffer.appendInt32(-459324)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
document.serialize(buffer, true)
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultGame(let id, let shortName, let sendMessage):
if boxed {
buffer.appendInt32(1336154098)
}
serializeString(id, buffer: buffer, boxed: false)
serializeString(shortName, buffer: buffer, boxed: false)
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultPhoto(let id, let type, let photo, let sendMessage):
if boxed {
buffer.appendInt32(-1462213465)
}
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
photo.serialize(buffer, true)
sendMessage.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumb, let content, let sendMessage):
return ("inputBotInlineResult", [("flags", flags as Any), ("id", id as Any), ("type", type as Any), ("title", title as Any), ("description", description as Any), ("url", url as Any), ("thumb", thumb as Any), ("content", content as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultDocument(let flags, let id, let type, let title, let description, let document, let sendMessage):
return ("inputBotInlineResultDocument", [("flags", flags as Any), ("id", id as Any), ("type", type as Any), ("title", title as Any), ("description", description as Any), ("document", document as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultGame(let id, let shortName, let sendMessage):
return ("inputBotInlineResultGame", [("id", id as Any), ("shortName", shortName as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultPhoto(let id, let type, let photo, let sendMessage):
return ("inputBotInlineResultPhoto", [("id", id as Any), ("type", type as Any), ("photo", photo as Any), ("sendMessage", sendMessage as Any)])
}
}
public static func parse_inputBotInlineResult(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: String?
if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
var _7: Api.InputWebDocument?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
} }
var _8: Api.InputWebDocument?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
} }
var _9: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputBotInlineResult.inputBotInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultDocument(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: Api.InputDocument?
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _7: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.InputBotInlineResult.inputBotInlineResultDocument(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, document: _6!, sendMessage: _7!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultGame(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputBotInlineResult.inputBotInlineResultGame(id: _1!, shortName: _2!, sendMessage: _3!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultPhoto(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputPhoto?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
var _4: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputBotInlineResult.inputBotInlineResultPhoto(id: _1!, type: _2!, photo: _3!, sendMessage: _4!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,191 @@
public extension Api {
enum InputBotInlineResult: TypeConstructorDescription {
case inputBotInlineResult(flags: Int32, id: String, type: String, title: String?, description: String?, url: String?, thumb: Api.InputWebDocument?, content: Api.InputWebDocument?, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultDocument(flags: Int32, id: String, type: String, title: String?, description: String?, document: Api.InputDocument, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultGame(id: String, shortName: String, sendMessage: Api.InputBotInlineMessage)
case inputBotInlineResultPhoto(id: String, type: String, photo: Api.InputPhoto, sendMessage: Api.InputBotInlineMessage)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumb, let content, let sendMessage):
if boxed {
buffer.appendInt32(-2000710887)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeString(url!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 4) != 0 {thumb!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {content!.serialize(buffer, true)}
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultDocument(let flags, let id, let type, let title, let description, let document, let sendMessage):
if boxed {
buffer.appendInt32(-459324)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeString(description!, buffer: buffer, boxed: false)}
document.serialize(buffer, true)
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultGame(let id, let shortName, let sendMessage):
if boxed {
buffer.appendInt32(1336154098)
}
serializeString(id, buffer: buffer, boxed: false)
serializeString(shortName, buffer: buffer, boxed: false)
sendMessage.serialize(buffer, true)
break
case .inputBotInlineResultPhoto(let id, let type, let photo, let sendMessage):
if boxed {
buffer.appendInt32(-1462213465)
}
serializeString(id, buffer: buffer, boxed: false)
serializeString(type, buffer: buffer, boxed: false)
photo.serialize(buffer, true)
sendMessage.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputBotInlineResult(let flags, let id, let type, let title, let description, let url, let thumb, let content, let sendMessage):
return ("inputBotInlineResult", [("flags", flags as Any), ("id", id as Any), ("type", type as Any), ("title", title as Any), ("description", description as Any), ("url", url as Any), ("thumb", thumb as Any), ("content", content as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultDocument(let flags, let id, let type, let title, let description, let document, let sendMessage):
return ("inputBotInlineResultDocument", [("flags", flags as Any), ("id", id as Any), ("type", type as Any), ("title", title as Any), ("description", description as Any), ("document", document as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultGame(let id, let shortName, let sendMessage):
return ("inputBotInlineResultGame", [("id", id as Any), ("shortName", shortName as Any), ("sendMessage", sendMessage as Any)])
case .inputBotInlineResultPhoto(let id, let type, let photo, let sendMessage):
return ("inputBotInlineResultPhoto", [("id", id as Any), ("type", type as Any), ("photo", photo as Any), ("sendMessage", sendMessage as Any)])
}
}
public static func parse_inputBotInlineResult(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: String?
if Int(_1!) & Int(1 << 3) != 0 {_6 = parseString(reader) }
var _7: Api.InputWebDocument?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
} }
var _8: Api.InputWebDocument?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.InputWebDocument
} }
var _9: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 4) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 5) == 0) || _8 != nil
let _c9 = _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputBotInlineResult.inputBotInlineResult(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, url: _6, thumb: _7, content: _8, sendMessage: _9!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultDocument(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 2) != 0 {_5 = parseString(reader) }
var _6: Api.InputDocument?
if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputDocument
}
var _7: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.InputBotInlineResult.inputBotInlineResultDocument(flags: _1!, id: _2!, type: _3!, title: _4, description: _5, document: _6!, sendMessage: _7!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultGame(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputBotInlineResult.inputBotInlineResultGame(id: _1!, shortName: _2!, sendMessage: _3!)
}
else {
return nil
}
}
public static func parse_inputBotInlineResultPhoto(_ reader: BufferReader) -> InputBotInlineResult? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: Api.InputPhoto?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputPhoto
}
var _4: Api.InputBotInlineMessage?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputBotInlineMessage
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputBotInlineResult.inputBotInlineResultPhoto(id: _1!, type: _2!, photo: _3!, sendMessage: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputChannel: TypeConstructorDescription {
case inputChannel(channelId: Int64, accessHash: Int64)
@ -962,45 +1150,3 @@ public extension Api {
}
}
public extension Api {
indirect enum InputFolderPeer: TypeConstructorDescription {
case inputFolderPeer(peer: Api.InputPeer, folderId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputFolderPeer(let peer, let folderId):
if boxed {
buffer.appendInt32(-70073706)
}
peer.serialize(buffer, true)
serializeInt32(folderId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputFolderPeer(let peer, let folderId):
return ("inputFolderPeer", [("peer", peer as Any), ("folderId", folderId as Any)])
}
}
public static func parse_inputFolderPeer(_ reader: BufferReader) -> InputFolderPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputFolderPeer.inputFolderPeer(peer: _1!, folderId: _2!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,45 @@
public extension Api {
indirect enum InputFolderPeer: TypeConstructorDescription {
case inputFolderPeer(peer: Api.InputPeer, folderId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputFolderPeer(let peer, let folderId):
if boxed {
buffer.appendInt32(-70073706)
}
peer.serialize(buffer, true)
serializeInt32(folderId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputFolderPeer(let peer, let folderId):
return ("inputFolderPeer", [("peer", peer as Any), ("folderId", folderId as Any)])
}
}
public static func parse_inputFolderPeer(_ reader: BufferReader) -> InputFolderPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputFolderPeer.inputFolderPeer(peer: _1!, folderId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputGame: TypeConstructorDescription {
case inputGameID(id: Int64, accessHash: Int64)
@ -956,113 +998,3 @@ public extension Api {
}
}
public extension Api {
enum InputPaymentCredentials: TypeConstructorDescription {
case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
case inputPaymentCredentialsGooglePay(paymentToken: Api.DataJSON)
case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPaymentCredentials(let flags, let data):
if boxed {
buffer.appendInt32(873977640)
}
serializeInt32(flags, buffer: buffer, boxed: false)
data.serialize(buffer, true)
break
case .inputPaymentCredentialsApplePay(let paymentData):
if boxed {
buffer.appendInt32(178373535)
}
paymentData.serialize(buffer, true)
break
case .inputPaymentCredentialsGooglePay(let paymentToken):
if boxed {
buffer.appendInt32(-1966921727)
}
paymentToken.serialize(buffer, true)
break
case .inputPaymentCredentialsSaved(let id, let tmpPassword):
if boxed {
buffer.appendInt32(-1056001329)
}
serializeString(id, buffer: buffer, boxed: false)
serializeBytes(tmpPassword, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPaymentCredentials(let flags, let data):
return ("inputPaymentCredentials", [("flags", flags as Any), ("data", data as Any)])
case .inputPaymentCredentialsApplePay(let paymentData):
return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData as Any)])
case .inputPaymentCredentialsGooglePay(let paymentToken):
return ("inputPaymentCredentialsGooglePay", [("paymentToken", paymentToken as Any)])
case .inputPaymentCredentialsSaved(let id, let tmpPassword):
return ("inputPaymentCredentialsSaved", [("id", id as Any), ("tmpPassword", tmpPassword as Any)])
}
}
public static func parse_inputPaymentCredentials(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.DataJSON?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputPaymentCredentials.inputPaymentCredentials(flags: _1!, data: _2!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsApplePay(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Api.DataJSON?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPaymentCredentials.inputPaymentCredentialsApplePay(paymentData: _1!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsGooglePay(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Api.DataJSON?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPaymentCredentials.inputPaymentCredentialsGooglePay(paymentToken: _1!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsSaved(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: String?
_1 = parseString(reader)
var _2: Buffer?
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputPaymentCredentials.inputPaymentCredentialsSaved(id: _1!, tmpPassword: _2!)
}
else {
return nil
}
}
}
}

View File

@ -1,3 +1,113 @@
public extension Api {
enum InputPaymentCredentials: TypeConstructorDescription {
case inputPaymentCredentials(flags: Int32, data: Api.DataJSON)
case inputPaymentCredentialsApplePay(paymentData: Api.DataJSON)
case inputPaymentCredentialsGooglePay(paymentToken: Api.DataJSON)
case inputPaymentCredentialsSaved(id: String, tmpPassword: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPaymentCredentials(let flags, let data):
if boxed {
buffer.appendInt32(873977640)
}
serializeInt32(flags, buffer: buffer, boxed: false)
data.serialize(buffer, true)
break
case .inputPaymentCredentialsApplePay(let paymentData):
if boxed {
buffer.appendInt32(178373535)
}
paymentData.serialize(buffer, true)
break
case .inputPaymentCredentialsGooglePay(let paymentToken):
if boxed {
buffer.appendInt32(-1966921727)
}
paymentToken.serialize(buffer, true)
break
case .inputPaymentCredentialsSaved(let id, let tmpPassword):
if boxed {
buffer.appendInt32(-1056001329)
}
serializeString(id, buffer: buffer, boxed: false)
serializeBytes(tmpPassword, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPaymentCredentials(let flags, let data):
return ("inputPaymentCredentials", [("flags", flags as Any), ("data", data as Any)])
case .inputPaymentCredentialsApplePay(let paymentData):
return ("inputPaymentCredentialsApplePay", [("paymentData", paymentData as Any)])
case .inputPaymentCredentialsGooglePay(let paymentToken):
return ("inputPaymentCredentialsGooglePay", [("paymentToken", paymentToken as Any)])
case .inputPaymentCredentialsSaved(let id, let tmpPassword):
return ("inputPaymentCredentialsSaved", [("id", id as Any), ("tmpPassword", tmpPassword as Any)])
}
}
public static func parse_inputPaymentCredentials(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.DataJSON?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputPaymentCredentials.inputPaymentCredentials(flags: _1!, data: _2!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsApplePay(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Api.DataJSON?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPaymentCredentials.inputPaymentCredentialsApplePay(paymentData: _1!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsGooglePay(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: Api.DataJSON?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.DataJSON
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPaymentCredentials.inputPaymentCredentialsGooglePay(paymentToken: _1!)
}
else {
return nil
}
}
public static func parse_inputPaymentCredentialsSaved(_ reader: BufferReader) -> InputPaymentCredentials? {
var _1: String?
_1 = parseString(reader)
var _2: Buffer?
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputPaymentCredentials.inputPaymentCredentialsSaved(id: _1!, tmpPassword: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputPeer: TypeConstructorDescription {
case inputPeerChannel(channelId: Int64, accessHash: Int64)
@ -612,231 +722,3 @@ public extension Api {
}
}
public extension Api {
enum InputSecureFile: TypeConstructorDescription {
case inputSecureFile(id: Int64, accessHash: Int64)
case inputSecureFileUploaded(id: Int64, parts: Int32, md5Checksum: String, fileHash: Buffer, secret: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureFile(let id, let accessHash):
if boxed {
buffer.appendInt32(1399317950)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
if boxed {
buffer.appendInt32(859091184)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt32(parts, buffer: buffer, boxed: false)
serializeString(md5Checksum, buffer: buffer, boxed: false)
serializeBytes(fileHash, buffer: buffer, boxed: false)
serializeBytes(secret, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureFile(let id, let accessHash):
return ("inputSecureFile", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputSecureFileUploaded(let id, let parts, let md5Checksum, let fileHash, let secret):
return ("inputSecureFileUploaded", [("id", id as Any), ("parts", parts as Any), ("md5Checksum", md5Checksum as Any), ("fileHash", fileHash as Any), ("secret", secret as Any)])
}
}
public static func parse_inputSecureFile(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputSecureFile.inputSecureFile(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputSecureFileUploaded(_ reader: BufferReader) -> InputSecureFile? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: String?
_3 = parseString(reader)
var _4: Buffer?
_4 = parseBytes(reader)
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSecureFile.inputSecureFileUploaded(id: _1!, parts: _2!, md5Checksum: _3!, fileHash: _4!, secret: _5!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputSecureValue: TypeConstructorDescription {
case inputSecureValue(flags: Int32, type: Api.SecureValueType, data: Api.SecureData?, frontSide: Api.InputSecureFile?, reverseSide: Api.InputSecureFile?, selfie: Api.InputSecureFile?, translation: [Api.InputSecureFile]?, files: [Api.InputSecureFile]?, plainData: Api.SecurePlainData?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
if boxed {
buffer.appendInt32(-618540889)
}
serializeInt32(flags, buffer: buffer, boxed: false)
type.serialize(buffer, true)
if Int(flags) & Int(1 << 0) != 0 {data!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {frontSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {reverseSide!.serialize(buffer, true)}
if Int(flags) & Int(1 << 3) != 0 {selfie!.serialize(buffer, true)}
if Int(flags) & Int(1 << 6) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(translation!.count))
for item in translation! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(files!.count))
for item in files! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 5) != 0 {plainData!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSecureValue(let flags, let type, let data, let frontSide, let reverseSide, let selfie, let translation, let files, let plainData):
return ("inputSecureValue", [("flags", flags as Any), ("type", type as Any), ("data", data as Any), ("frontSide", frontSide as Any), ("reverseSide", reverseSide as Any), ("selfie", selfie as Any), ("translation", translation as Any), ("files", files as Any), ("plainData", plainData as Any)])
}
}
public static func parse_inputSecureValue(_ reader: BufferReader) -> InputSecureValue? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.SecureValueType?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.SecureValueType
}
var _3: Api.SecureData?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.SecureData
} }
var _4: Api.InputSecureFile?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _5: Api.InputSecureFile?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _6: Api.InputSecureFile?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.InputSecureFile
} }
var _7: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 6) != 0 {if let _ = reader.readInt32() {
_7 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _8: [Api.InputSecureFile]?
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputSecureFile.self)
} }
var _9: Api.SecurePlainData?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_9 = Api.parse(reader, signature: signature) as? Api.SecurePlainData
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 3) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 4) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 5) == 0) || _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return Api.InputSecureValue.inputSecureValue(flags: _1!, type: _2!, data: _3, frontSide: _4, reverseSide: _5, selfie: _6, translation: _7, files: _8, plainData: _9)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputSingleMedia: TypeConstructorDescription {
case inputSingleMedia(flags: Int32, media: Api.InputMedia, randomId: Int64, message: String, entities: [Api.MessageEntity]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputSingleMedia(let flags, let media, let randomId, let message, let entities):
if boxed {
buffer.appendInt32(482797855)
}
serializeInt32(flags, buffer: buffer, boxed: false)
media.serialize(buffer, true)
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(entities!.count))
for item in entities! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputSingleMedia(let flags, let media, let randomId, let message, let entities):
return ("inputSingleMedia", [("flags", flags as Any), ("media", media as Any), ("randomId", randomId as Any), ("message", message as Any), ("entities", entities as Any)])
}
}
public static func parse_inputSingleMedia(_ reader: BufferReader) -> InputSingleMedia? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputMedia?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputMedia
}
var _3: Int64?
_3 = reader.readInt64()
var _4: String?
_4 = parseString(reader)
var _5: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 0) != 0 {if let _ = reader.readInt32() {
_5 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 0) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputSingleMedia.inputSingleMedia(flags: _1!, media: _2!, randomId: _3!, message: _4!, entities: _5)
}
else {
return nil
}
}
}
}

View File

@ -46,6 +46,32 @@ extension ReplyMarkupButton {
self.init(title: text, titleWhenForwarded: nil, action: .openWebView(url: url, simple: false))
case let .keyboardButtonSimpleWebView(text, url):
self.init(title: text, titleWhenForwarded: nil, action: .openWebView(url: url, simple: true))
case let .keyboardButtonRequestPeer(text, buttonId, peerType):
let mappedPeerType: ReplyMarkupButtonRequestPeerType
switch peerType {
case let .requestPeerTypeUser(_, bot, premium):
mappedPeerType = .user(ReplyMarkupButtonRequestPeerType.User(
isBot: bot.flatMap({ $0 == .boolTrue }),
isPremium: premium.flatMap({ $0 == .boolTrue })
))
case let .requestPeerTypeChat(flags, creator, hasUsername, forum, userAdminRights, botAdminRights):
mappedPeerType = .group(ReplyMarkupButtonRequestPeerType.Group(
isCreator: creator.flatMap({ $0 == .boolTrue }),
hasUsername: hasUsername.flatMap({ $0 == .boolTrue }),
isForum: forum.flatMap({ $0 == .boolTrue }),
botParticipant: (flags & (1 << 5)) != 0,
userAdminRights: userAdminRights.flatMap(TelegramChatAdminRights.init(apiAdminRights:)),
botAdminRights: botAdminRights.flatMap(TelegramChatAdminRights.init(apiAdminRights:))
))
case let .requestPeerTypeBroadcast(_, creator, hasUsername, userAdminRights, botAdminRights):
mappedPeerType = .channel(ReplyMarkupButtonRequestPeerType.Channel(
isCreator: creator.flatMap({ $0 == .boolTrue }),
hasUsername: hasUsername.flatMap({ $0 == .boolTrue }),
userAdminRights: userAdminRights.flatMap(TelegramChatAdminRights.init(apiAdminRights:)),
botAdminRights: botAdminRights.flatMap(TelegramChatAdminRights.init(apiAdminRights:))
))
}
self.init(title: text, titleWhenForwarded: nil, action: .requestPeer(peerType: mappedPeerType, buttonId: buttonId))
}
}
}

View File

@ -205,7 +205,7 @@ func apiMessagePeerIds(_ message: Api.Message) -> [PeerId] {
}
switch action {
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme, .messageActionChatJoinedByRequest, .messageActionWebViewDataSent, .messageActionWebViewDataSentMe, .messageActionGiftPremium, .messageActionTopicCreate, .messageActionTopicEdit, .messageActionSuggestProfilePhoto, .messageActionAttachMenuBotAllowed:
case .messageActionChannelCreate, .messageActionChatDeletePhoto, .messageActionChatEditPhoto, .messageActionChatEditTitle, .messageActionEmpty, .messageActionPinMessage, .messageActionHistoryClear, .messageActionGameScore, .messageActionPaymentSent, .messageActionPaymentSentMe, .messageActionPhoneCall, .messageActionScreenshotTaken, .messageActionCustomAction, .messageActionBotAllowed, .messageActionSecureValuesSent, .messageActionSecureValuesSentMe, .messageActionContactSignUp, .messageActionGroupCall, .messageActionSetMessagesTTL, .messageActionGroupCallScheduled, .messageActionSetChatTheme, .messageActionChatJoinedByRequest, .messageActionWebViewDataSent, .messageActionWebViewDataSentMe, .messageActionGiftPremium, .messageActionTopicCreate, .messageActionTopicEdit, .messageActionSuggestProfilePhoto, .messageActionAttachMenuBotAllowed, .messageActionRequestedPeer:
break
case let .messageActionChannelMigrateFrom(_, chatId):
result.append(PeerId(namespace: Namespaces.Peer.CloudGroup, id: PeerId.Id._internalFromInt64Value(chatId)))

View File

@ -108,6 +108,8 @@ func telegramMediaActionFromApiAction(_ action: Api.MessageAction) -> TelegramMe
return TelegramMediaAction(action: .suggestedProfilePhoto(image: telegramMediaImageFromApiPhoto(photo)))
case .messageActionAttachMenuBotAllowed:
return TelegramMediaAction(action: .attachMenuBotAllowed)
case let .messageActionRequestedPeer(buttonId, peer):
return TelegramMediaAction(action: .requestedPeer(buttonId: buttonId, peerId: peer.peerId))
}
}

View File

@ -1,5 +1,185 @@
import Postbox
public enum ReplyMarkupButtonRequestPeerType: Codable, Equatable {
enum CodingKeys: String, CodingKey {
case discriminator = "d"
case user = "u"
case group = "g"
case channel = "c"
}
enum Discriminator: Int32 {
case user = 0
case group = 1
case channel = 2
}
public struct User: Codable, Equatable {
enum CodingKeys: String, CodingKey {
case isBot = "b"
case isPremium = "p"
}
public var isBot: Bool?
public var isPremium: Bool?
public init(isBot: Bool?, isPremium: Bool?) {
self.isBot = isBot
self.isPremium = isPremium
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.isBot = try container.decodeIfPresent(Bool.self, forKey: .isBot)
self.isPremium = try container.decodeIfPresent(Bool.self, forKey: .isPremium)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(self.isBot, forKey: .isBot)
try container.encodeIfPresent(self.isPremium, forKey: .isPremium)
}
}
public struct Group: Codable, Equatable {
enum CodingKeys: String, CodingKey {
case isCreator = "cr"
case hasUsername = "un"
case isForum = "fo"
case botParticipant = "bo"
case userAdminRights = "ur"
case botAdminRights = "br"
}
public var isCreator: Bool?
public var hasUsername: Bool?
public var isForum: Bool?
public var botParticipant: Bool
public var userAdminRights: TelegramChatAdminRights?
public var botAdminRights: TelegramChatAdminRights?
public init(
isCreator: Bool?,
hasUsername: Bool?,
isForum: Bool?,
botParticipant: Bool,
userAdminRights: TelegramChatAdminRights?,
botAdminRights: TelegramChatAdminRights?
) {
self.isCreator = isCreator
self.hasUsername = hasUsername
self.isForum = isForum
self.botParticipant = botParticipant
self.userAdminRights = userAdminRights
self.botAdminRights = botAdminRights
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.isCreator = try container.decodeIfPresent(Bool.self, forKey: .isCreator)
self.hasUsername = try container.decodeIfPresent(Bool.self, forKey: .hasUsername)
self.isForum = try container.decodeIfPresent(Bool.self, forKey: .isForum)
self.botParticipant = try container.decode(Bool.self, forKey: .botParticipant)
self.userAdminRights = try container.decodeIfPresent(TelegramChatAdminRights.self, forKey: .userAdminRights)
self.botAdminRights = try container.decodeIfPresent(TelegramChatAdminRights.self, forKey: .botAdminRights)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(self.isCreator, forKey: .isCreator)
try container.encodeIfPresent(self.hasUsername, forKey: .hasUsername)
try container.encodeIfPresent(self.isForum, forKey: .isForum)
try container.encode(self.botParticipant, forKey: .botParticipant)
try container.encodeIfPresent(self.userAdminRights, forKey: .userAdminRights)
try container.encodeIfPresent(self.botAdminRights, forKey: .botAdminRights)
}
}
public struct Channel: Codable, Equatable {
enum CodingKeys: String, CodingKey {
case isCreator = "cr"
case hasUsername = "un"
case userAdminRights = "ur"
case botAdminRights = "br"
}
public var isCreator: Bool?
public var hasUsername: Bool?
public var userAdminRights: TelegramChatAdminRights?
public var botAdminRights: TelegramChatAdminRights?
public init(
isCreator: Bool?,
hasUsername: Bool?,
userAdminRights: TelegramChatAdminRights?,
botAdminRights: TelegramChatAdminRights?
) {
self.isCreator = isCreator
self.hasUsername = hasUsername
self.userAdminRights = userAdminRights
self.botAdminRights = botAdminRights
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
self.isCreator = try container.decodeIfPresent(Bool.self, forKey: .isCreator)
self.hasUsername = try container.decodeIfPresent(Bool.self, forKey: .hasUsername)
self.userAdminRights = try container.decodeIfPresent(TelegramChatAdminRights.self, forKey: .userAdminRights)
self.botAdminRights = try container.decodeIfPresent(TelegramChatAdminRights.self, forKey: .botAdminRights)
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
try container.encodeIfPresent(self.isCreator, forKey: .isCreator)
try container.encodeIfPresent(self.hasUsername, forKey: .hasUsername)
try container.encodeIfPresent(self.userAdminRights, forKey: .userAdminRights)
try container.encodeIfPresent(self.botAdminRights, forKey: .botAdminRights)
}
}
case user(User)
case group(Group)
case channel(Channel)
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: CodingKeys.self)
switch try container.decode(Int32.self, forKey: .discriminator) {
case Discriminator.user.rawValue:
self = .user(try container.decode(User.self, forKey: .user))
case Discriminator.group.rawValue:
self = .group(try container.decode(Group.self, forKey: .group))
case Discriminator.channel.rawValue:
self = .channel(try container.decode(Channel.self, forKey: .channel))
default:
assertionFailure()
self = .user(User(isBot: nil, isPremium: nil))
}
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: CodingKeys.self)
switch self {
case let .user(user):
try container.encode(Discriminator.user.rawValue, forKey: .discriminator)
try container.encode(user, forKey: .user)
case let .group(group):
try container.encode(Discriminator.group.rawValue, forKey: .discriminator)
try container.encode(group, forKey: .group)
case let .channel(channel):
try container.encode(Discriminator.channel.rawValue, forKey: .discriminator)
try container.encode(channel, forKey: .channel)
}
}
}
public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
case text
case url(String)
@ -13,6 +193,7 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
case setupPoll(isQuiz: Bool?)
case openUserProfile(peerId: PeerId)
case openWebView(url: String, simple: Bool)
case requestPeer(peerType: ReplyMarkupButtonRequestPeerType, buttonId: Int32)
public init(decoder: PostboxDecoder) {
switch decoder.decodeInt32ForKey("v", orElse: 0) {
@ -40,6 +221,8 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
self = .openUserProfile(peerId: PeerId(decoder.decodeInt64ForKey("peerId", orElse: 0)))
case 11:
self = .openWebView(url: decoder.decodeStringForKey("u", orElse: ""), simple: decoder.decodeInt32ForKey("s", orElse: 0) != 0)
case 12:
self = .requestPeer(peerType: decoder.decode(ReplyMarkupButtonRequestPeerType.self, forKey: "pt") ?? ReplyMarkupButtonRequestPeerType.user(ReplyMarkupButtonRequestPeerType.User(isBot: nil, isPremium: nil)), buttonId: decoder.decodeInt32ForKey("b", orElse: 0))
default:
self = .text
}
@ -86,6 +269,10 @@ public enum ReplyMarkupButtonAction: PostboxCoding, Equatable {
encoder.encodeInt32(11, forKey: "v")
encoder.encodeString(url, forKey: "u")
encoder.encodeInt32(simple ? 1 : 0, forKey: "s")
case let .requestPeer(peerType, buttonId):
encoder.encodeInt32(12, forKey: "v")
encoder.encodeInt32(buttonId, forKey: "b")
encoder.encode(peerType, forKey: "pt")
}
}
}

View File

@ -84,7 +84,7 @@ public struct TelegramChatAdminRightsFlags: OptionSet, Hashable {
}
}
public struct TelegramChatAdminRights: PostboxCoding, Equatable {
public struct TelegramChatAdminRights: PostboxCoding, Codable, Equatable {
public let rights: TelegramChatAdminRightsFlags
public init(rights: TelegramChatAdminRightsFlags) {
@ -95,10 +95,22 @@ public struct TelegramChatAdminRights: PostboxCoding, Equatable {
self.rights = TelegramChatAdminRightsFlags(rawValue: decoder.decodeInt32ForKey("f", orElse: 0))
}
public init(from decoder: Decoder) throws {
let container = try decoder.container(keyedBy: StringCodingKey.self)
self.rights = TelegramChatAdminRightsFlags(rawValue: try container.decode(Int32.self, forKey: "f"))
}
public func encode(_ encoder: PostboxEncoder) {
encoder.encodeInt32(self.rights.rawValue, forKey: "f")
}
public func encode(to encoder: Encoder) throws {
var container = encoder.container(keyedBy: StringCodingKey.self)
try container.encode(self.rights.rawValue, forKey: "f")
}
public static func ==(lhs: TelegramChatAdminRights, rhs: TelegramChatAdminRights) -> Bool {
return lhs.rights == rhs.rights
}

View File

@ -100,6 +100,7 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
case topicEdited(components: [ForumTopicEditComponent])
case suggestedProfilePhoto(image: TelegramMediaImage?)
case attachMenuBotAllowed
case requestedPeer(buttonId: Int32, peerId: PeerId)
public init(decoder: PostboxDecoder) {
let rawValue: Int32 = decoder.decodeInt32ForKey("_rawValue", orElse: 0)
@ -178,6 +179,8 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
self = .suggestedProfilePhoto(image: decoder.decodeObjectForKey("image") as? TelegramMediaImage)
case 31:
self = .attachMenuBotAllowed
case 32:
self = .requestedPeer(buttonId: decoder.decodeInt32ForKey("b", orElse: 0), peerId: PeerId(decoder.decodeInt64ForKey("pi", orElse: 0)))
default:
self = .unknown
}
@ -331,6 +334,10 @@ public enum TelegramMediaActionType: PostboxCoding, Equatable {
}
case .attachMenuBotAllowed:
encoder.encodeInt32(31, forKey: "_rawValue")
case let .requestedPeer(buttonId, peerId):
encoder.encodeInt32(32, forKey: "_rawValue")
encoder.encodeInt32(buttonId, forKey: "b")
encoder.encodeInt64(peerId.toInt64(), forKey: "pi")
}
}

View File

@ -833,6 +833,10 @@ public func universalServiceMessageString(presentationData: (PresentationTheme,
}
case .attachMenuBotAllowed:
attributedString = NSAttributedString(string: strings.Notification_BotWriteAllowed, font: titleFont, textColor: primaryTextColor)
case let .requestedPeer(_, peerId):
//TODO:localize
let _ = peerId
attributedString = NSAttributedString(string: "Requested Chat", font: titleFont, textColor: primaryTextColor)
case .unknown:
attributedString = nil
}

View File

@ -431,6 +431,8 @@ final class ChatButtonKeyboardInputNode: ChatInputNode {
})
case let .openWebView(url, simple):
self.controllerInteraction.openWebView(markupButton.title, url, simple, false)
case .requestPeer:
break
}
if dismissIfOnce {
if let message = self.message {

View File

@ -861,6 +861,8 @@ public class ChatMessageItemView: ListViewItemNode, ChatMessageItemNodeProtocol
})
case let .openWebView(url, simple):
item.controllerInteraction.openWebView(button.title, url, simple, false)
case .requestPeer:
break
}
}
}

View File

@ -861,6 +861,8 @@ final class ChatPinnedMessageTitlePanelNode: ChatTitleAccessoryPanelNode {
})
case let .openWebView(url, simple):
controllerInteraction.openWebView(button.title, url, simple, false)
case .requestPeer:
break
}
break