Merge commit '7621e2f8dec938cf48181c8b10afc9b01f444e68' into beta

This commit is contained in:
Ilya Laktyushin
2025-12-06 02:17:48 +04:00
commit 8344b97e03
28070 changed files with 7995182 additions and 0 deletions
+15
View File
@@ -0,0 +1,15 @@
load("@build_bazel_rules_swift//swift:swift.bzl", "swift_library")
swift_library(
name = "TelegramApi",
module_name = "TelegramApi",
copts = [
"-warnings-as-errors",
],
srcs = glob([
"Sources/**/*.swift",
]),
visibility = [
"//visibility:public",
],
)
+27
View File
@@ -0,0 +1,27 @@
// swift-tools-version:5.5
// The swift-tools-version declares the minimum version of Swift required to build this package.
import PackageDescription
let package = Package(
name: "TelegramApi",
platforms: [.macOS(.v10_13)],
products: [
// Products define the executables and libraries a package produces, and make them visible to other packages.
.library(
name: "TelegramApi",
targets: ["TelegramApi"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
// .package(url: /* package url */, from: "1.0.0"),
],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages this package depends on.
.target(
name: "TelegramApi",
dependencies: [],
path: "Sources"),
]
)
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
+982
View File
@@ -0,0 +1,982 @@
public extension Api {
indirect enum InputFileLocation: TypeConstructorDescription {
case inputDocumentFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String)
case inputEncryptedFileLocation(id: Int64, accessHash: Int64)
case inputFileLocation(volumeId: Int64, localId: Int32, secret: Int64, fileReference: Buffer)
case inputGroupCallStream(flags: Int32, call: Api.InputGroupCall, timeMs: Int64, scale: Int32, videoChannel: Int32?, videoQuality: Int32?)
case inputPeerPhotoFileLocation(flags: Int32, peer: Api.InputPeer, photoId: Int64)
case inputPhotoFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, thumbSize: String)
case inputPhotoLegacyFileLocation(id: Int64, accessHash: Int64, fileReference: Buffer, volumeId: Int64, localId: Int32, secret: Int64)
case inputSecureFileLocation(id: Int64, accessHash: Int64)
case inputStickerSetThumb(stickerset: Api.InputStickerSet, thumbVersion: Int32)
case inputTakeoutFileLocation
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputDocumentFileLocation(let id, let accessHash, let fileReference, let thumbSize):
if boxed {
buffer.appendInt32(-1160743548)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeBytes(fileReference, buffer: buffer, boxed: false)
serializeString(thumbSize, buffer: buffer, boxed: false)
break
case .inputEncryptedFileLocation(let id, let accessHash):
if boxed {
buffer.appendInt32(-182231723)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputFileLocation(let volumeId, let localId, let secret, let fileReference):
if boxed {
buffer.appendInt32(-539317279)
}
serializeInt64(volumeId, buffer: buffer, boxed: false)
serializeInt32(localId, buffer: buffer, boxed: false)
serializeInt64(secret, buffer: buffer, boxed: false)
serializeBytes(fileReference, buffer: buffer, boxed: false)
break
case .inputGroupCallStream(let flags, let call, let timeMs, let scale, let videoChannel, let videoQuality):
if boxed {
buffer.appendInt32(93890858)
}
serializeInt32(flags, buffer: buffer, boxed: false)
call.serialize(buffer, true)
serializeInt64(timeMs, buffer: buffer, boxed: false)
serializeInt32(scale, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(videoChannel!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(videoQuality!, buffer: buffer, boxed: false)}
break
case .inputPeerPhotoFileLocation(let flags, let peer, let photoId):
if boxed {
buffer.appendInt32(925204121)
}
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt64(photoId, buffer: buffer, boxed: false)
break
case .inputPhotoFileLocation(let id, let accessHash, let fileReference, let thumbSize):
if boxed {
buffer.appendInt32(1075322878)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeBytes(fileReference, buffer: buffer, boxed: false)
serializeString(thumbSize, buffer: buffer, boxed: false)
break
case .inputPhotoLegacyFileLocation(let id, let accessHash, let fileReference, let volumeId, let localId, let secret):
if boxed {
buffer.appendInt32(-667654413)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeBytes(fileReference, buffer: buffer, boxed: false)
serializeInt64(volumeId, buffer: buffer, boxed: false)
serializeInt32(localId, buffer: buffer, boxed: false)
serializeInt64(secret, buffer: buffer, boxed: false)
break
case .inputSecureFileLocation(let id, let accessHash):
if boxed {
buffer.appendInt32(-876089816)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputStickerSetThumb(let stickerset, let thumbVersion):
if boxed {
buffer.appendInt32(-1652231205)
}
stickerset.serialize(buffer, true)
serializeInt32(thumbVersion, buffer: buffer, boxed: false)
break
case .inputTakeoutFileLocation:
if boxed {
buffer.appendInt32(700340377)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputDocumentFileLocation(let id, let accessHash, let fileReference, let thumbSize):
return ("inputDocumentFileLocation", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any), ("thumbSize", thumbSize as Any)])
case .inputEncryptedFileLocation(let id, let accessHash):
return ("inputEncryptedFileLocation", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputFileLocation(let volumeId, let localId, let secret, let fileReference):
return ("inputFileLocation", [("volumeId", volumeId as Any), ("localId", localId as Any), ("secret", secret as Any), ("fileReference", fileReference as Any)])
case .inputGroupCallStream(let flags, let call, let timeMs, let scale, let videoChannel, let videoQuality):
return ("inputGroupCallStream", [("flags", flags as Any), ("call", call as Any), ("timeMs", timeMs as Any), ("scale", scale as Any), ("videoChannel", videoChannel as Any), ("videoQuality", videoQuality as Any)])
case .inputPeerPhotoFileLocation(let flags, let peer, let photoId):
return ("inputPeerPhotoFileLocation", [("flags", flags as Any), ("peer", peer as Any), ("photoId", photoId as Any)])
case .inputPhotoFileLocation(let id, let accessHash, let fileReference, let thumbSize):
return ("inputPhotoFileLocation", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any), ("thumbSize", thumbSize as Any)])
case .inputPhotoLegacyFileLocation(let id, let accessHash, let fileReference, let volumeId, let localId, let secret):
return ("inputPhotoLegacyFileLocation", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any), ("volumeId", volumeId as Any), ("localId", localId as Any), ("secret", secret as Any)])
case .inputSecureFileLocation(let id, let accessHash):
return ("inputSecureFileLocation", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputStickerSetThumb(let stickerset, let thumbVersion):
return ("inputStickerSetThumb", [("stickerset", stickerset as Any), ("thumbVersion", thumbVersion as Any)])
case .inputTakeoutFileLocation:
return ("inputTakeoutFileLocation", [])
}
}
public static func parse_inputDocumentFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Buffer?
_3 = parseBytes(reader)
var _4: String?
_4 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputFileLocation.inputDocumentFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
}
else {
return nil
}
}
public static func parse_inputEncryptedFileLocation(_ reader: BufferReader) -> InputFileLocation? {
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.InputFileLocation.inputEncryptedFileLocation(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputFileLocation.inputFileLocation(volumeId: _1!, localId: _2!, secret: _3!, fileReference: _4!)
}
else {
return nil
}
}
public static func parse_inputGroupCallStream(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputGroupCall?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputGroupCall
}
var _3: Int64?
_3 = reader.readInt64()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt32() }
var _6: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_6 = reader.readInt32() }
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
let _c6 = (Int(_1!) & Int(1 << 0) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.InputFileLocation.inputGroupCallStream(flags: _1!, call: _2!, timeMs: _3!, scale: _4!, videoChannel: _5, videoQuality: _6)
}
else {
return nil
}
}
public static func parse_inputPeerPhotoFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputPeer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputFileLocation.inputPeerPhotoFileLocation(flags: _1!, peer: _2!, photoId: _3!)
}
else {
return nil
}
}
public static func parse_inputPhotoFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Buffer?
_3 = parseBytes(reader)
var _4: String?
_4 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputFileLocation.inputPhotoFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, thumbSize: _4!)
}
else {
return nil
}
}
public static func parse_inputPhotoLegacyFileLocation(_ reader: BufferReader) -> InputFileLocation? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Buffer?
_3 = parseBytes(reader)
var _4: Int64?
_4 = reader.readInt64()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int64?
_6 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.InputFileLocation.inputPhotoLegacyFileLocation(id: _1!, accessHash: _2!, fileReference: _3!, volumeId: _4!, localId: _5!, secret: _6!)
}
else {
return nil
}
}
public static func parse_inputSecureFileLocation(_ reader: BufferReader) -> InputFileLocation? {
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.InputFileLocation.inputSecureFileLocation(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputStickerSetThumb(_ reader: BufferReader) -> InputFileLocation? {
var _1: Api.InputStickerSet?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStickerSet
}
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputFileLocation.inputStickerSetThumb(stickerset: _1!, thumbVersion: _2!)
}
else {
return nil
}
}
public static func parse_inputTakeoutFileLocation(_ reader: BufferReader) -> InputFileLocation? {
return Api.InputFileLocation.inputTakeoutFileLocation
}
}
}
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)
case inputGameShortName(botId: Api.InputUser, shortName: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputGameID(let id, let accessHash):
if boxed {
buffer.appendInt32(53231223)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputGameShortName(let botId, let shortName):
if boxed {
buffer.appendInt32(-1020139510)
}
botId.serialize(buffer, true)
serializeString(shortName, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputGameID(let id, let accessHash):
return ("inputGameID", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputGameShortName(let botId, let shortName):
return ("inputGameShortName", [("botId", botId as Any), ("shortName", shortName as Any)])
}
}
public static func parse_inputGameID(_ reader: BufferReader) -> InputGame? {
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.InputGame.inputGameID(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputGameShortName(_ reader: BufferReader) -> InputGame? {
var _1: Api.InputUser?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputUser
}
var _2: String?
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputGame.inputGameShortName(botId: _1!, shortName: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputGeoPoint: TypeConstructorDescription {
case inputGeoPoint(flags: Int32, lat: Double, long: Double, accuracyRadius: Int32?)
case inputGeoPointEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
if boxed {
buffer.appendInt32(1210199983)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeDouble(lat, buffer: buffer, boxed: false)
serializeDouble(long, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(accuracyRadius!, buffer: buffer, boxed: false)}
break
case .inputGeoPointEmpty:
if boxed {
buffer.appendInt32(-457104426)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputGeoPoint(let flags, let lat, let long, let accuracyRadius):
return ("inputGeoPoint", [("flags", flags as Any), ("lat", lat as Any), ("long", long as Any), ("accuracyRadius", accuracyRadius as Any)])
case .inputGeoPointEmpty:
return ("inputGeoPointEmpty", [])
}
}
public static func parse_inputGeoPoint(_ reader: BufferReader) -> InputGeoPoint? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Double?
_2 = reader.readDouble()
var _3: Double?
_3 = reader.readDouble()
var _4: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_4 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputGeoPoint.inputGeoPoint(flags: _1!, lat: _2!, long: _3!, accuracyRadius: _4)
}
else {
return nil
}
}
public static func parse_inputGeoPointEmpty(_ reader: BufferReader) -> InputGeoPoint? {
return Api.InputGeoPoint.inputGeoPointEmpty
}
}
}
public extension Api {
enum InputGroupCall: TypeConstructorDescription {
case inputGroupCall(id: Int64, accessHash: Int64)
case inputGroupCallInviteMessage(msgId: Int32)
case inputGroupCallSlug(slug: String)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputGroupCall(let id, let accessHash):
if boxed {
buffer.appendInt32(-659913713)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputGroupCallInviteMessage(let msgId):
if boxed {
buffer.appendInt32(-1945083841)
}
serializeInt32(msgId, buffer: buffer, boxed: false)
break
case .inputGroupCallSlug(let slug):
if boxed {
buffer.appendInt32(-33127873)
}
serializeString(slug, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputGroupCall(let id, let accessHash):
return ("inputGroupCall", [("id", id as Any), ("accessHash", accessHash as Any)])
case .inputGroupCallInviteMessage(let msgId):
return ("inputGroupCallInviteMessage", [("msgId", msgId as Any)])
case .inputGroupCallSlug(let slug):
return ("inputGroupCallSlug", [("slug", slug as Any)])
}
}
public static func parse_inputGroupCall(_ reader: BufferReader) -> InputGroupCall? {
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.InputGroupCall.inputGroupCall(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputGroupCallInviteMessage(_ reader: BufferReader) -> InputGroupCall? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.InputGroupCall.inputGroupCallInviteMessage(msgId: _1!)
}
else {
return nil
}
}
public static func parse_inputGroupCallSlug(_ reader: BufferReader) -> InputGroupCall? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputGroupCall.inputGroupCallSlug(slug: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum InputInvoice: TypeConstructorDescription {
case inputInvoiceBusinessBotTransferStars(bot: Api.InputUser, stars: Int64)
case inputInvoiceChatInviteSubscription(hash: String)
case inputInvoiceMessage(peer: Api.InputPeer, msgId: Int32)
case inputInvoicePremiumAuthCode(purpose: Api.InputStorePaymentPurpose)
case inputInvoicePremiumGiftCode(purpose: Api.InputStorePaymentPurpose, option: Api.PremiumGiftCodeOption)
case inputInvoicePremiumGiftStars(flags: Int32, userId: Api.InputUser, months: Int32, message: Api.TextWithEntities?)
case inputInvoiceSlug(slug: String)
case inputInvoiceStarGift(flags: Int32, peer: Api.InputPeer, giftId: Int64, message: Api.TextWithEntities?)
case inputInvoiceStarGiftAuctionBid(flags: Int32, peer: Api.InputPeer?, giftId: Int64, bidAmount: Int64, message: Api.TextWithEntities?)
case inputInvoiceStarGiftDropOriginalDetails(stargift: Api.InputSavedStarGift)
case inputInvoiceStarGiftPrepaidUpgrade(peer: Api.InputPeer, hash: String)
case inputInvoiceStarGiftResale(flags: Int32, slug: String, toId: Api.InputPeer)
case inputInvoiceStarGiftTransfer(stargift: Api.InputSavedStarGift, toId: Api.InputPeer)
case inputInvoiceStarGiftUpgrade(flags: Int32, stargift: Api.InputSavedStarGift)
case inputInvoiceStars(purpose: Api.InputStorePaymentPurpose)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputInvoiceBusinessBotTransferStars(let bot, let stars):
if boxed {
buffer.appendInt32(-191267262)
}
bot.serialize(buffer, true)
serializeInt64(stars, buffer: buffer, boxed: false)
break
case .inputInvoiceChatInviteSubscription(let hash):
if boxed {
buffer.appendInt32(887591921)
}
serializeString(hash, buffer: buffer, boxed: false)
break
case .inputInvoiceMessage(let peer, let msgId):
if boxed {
buffer.appendInt32(-977967015)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
break
case .inputInvoicePremiumAuthCode(let purpose):
if boxed {
buffer.appendInt32(1048049172)
}
purpose.serialize(buffer, true)
break
case .inputInvoicePremiumGiftCode(let purpose, let option):
if boxed {
buffer.appendInt32(-1734841331)
}
purpose.serialize(buffer, true)
option.serialize(buffer, true)
break
case .inputInvoicePremiumGiftStars(let flags, let userId, let months, let message):
if boxed {
buffer.appendInt32(-625298705)
}
serializeInt32(flags, buffer: buffer, boxed: false)
userId.serialize(buffer, true)
serializeInt32(months, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {message!.serialize(buffer, true)}
break
case .inputInvoiceSlug(let slug):
if boxed {
buffer.appendInt32(-1020867857)
}
serializeString(slug, buffer: buffer, boxed: false)
break
case .inputInvoiceStarGift(let flags, let peer, let giftId, let message):
if boxed {
buffer.appendInt32(-396206446)
}
serializeInt32(flags, buffer: buffer, boxed: false)
peer.serialize(buffer, true)
serializeInt64(giftId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)}
break
case .inputInvoiceStarGiftAuctionBid(let flags, let peer, let giftId, let bidAmount, let message):
if boxed {
buffer.appendInt32(516618768)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {peer!.serialize(buffer, true)}
serializeInt64(giftId, buffer: buffer, boxed: false)
serializeInt64(bidAmount, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {message!.serialize(buffer, true)}
break
case .inputInvoiceStarGiftDropOriginalDetails(let stargift):
if boxed {
buffer.appendInt32(153344209)
}
stargift.serialize(buffer, true)
break
case .inputInvoiceStarGiftPrepaidUpgrade(let peer, let hash):
if boxed {
buffer.appendInt32(-1710536520)
}
peer.serialize(buffer, true)
serializeString(hash, buffer: buffer, boxed: false)
break
case .inputInvoiceStarGiftResale(let flags, let slug, let toId):
if boxed {
buffer.appendInt32(-1012968668)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeString(slug, buffer: buffer, boxed: false)
toId.serialize(buffer, true)
break
case .inputInvoiceStarGiftTransfer(let stargift, let toId):
if boxed {
buffer.appendInt32(1247763417)
}
stargift.serialize(buffer, true)
toId.serialize(buffer, true)
break
case .inputInvoiceStarGiftUpgrade(let flags, let stargift):
if boxed {
buffer.appendInt32(1300335965)
}
serializeInt32(flags, buffer: buffer, boxed: false)
stargift.serialize(buffer, true)
break
case .inputInvoiceStars(let purpose):
if boxed {
buffer.appendInt32(1710230755)
}
purpose.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputInvoiceBusinessBotTransferStars(let bot, let stars):
return ("inputInvoiceBusinessBotTransferStars", [("bot", bot as Any), ("stars", stars as Any)])
case .inputInvoiceChatInviteSubscription(let hash):
return ("inputInvoiceChatInviteSubscription", [("hash", hash as Any)])
case .inputInvoiceMessage(let peer, let msgId):
return ("inputInvoiceMessage", [("peer", peer as Any), ("msgId", msgId as Any)])
case .inputInvoicePremiumAuthCode(let purpose):
return ("inputInvoicePremiumAuthCode", [("purpose", purpose as Any)])
case .inputInvoicePremiumGiftCode(let purpose, let option):
return ("inputInvoicePremiumGiftCode", [("purpose", purpose as Any), ("option", option as Any)])
case .inputInvoicePremiumGiftStars(let flags, let userId, let months, let message):
return ("inputInvoicePremiumGiftStars", [("flags", flags as Any), ("userId", userId as Any), ("months", months as Any), ("message", message as Any)])
case .inputInvoiceSlug(let slug):
return ("inputInvoiceSlug", [("slug", slug as Any)])
case .inputInvoiceStarGift(let flags, let peer, let giftId, let message):
return ("inputInvoiceStarGift", [("flags", flags as Any), ("peer", peer as Any), ("giftId", giftId as Any), ("message", message as Any)])
case .inputInvoiceStarGiftAuctionBid(let flags, let peer, let giftId, let bidAmount, let message):
return ("inputInvoiceStarGiftAuctionBid", [("flags", flags as Any), ("peer", peer as Any), ("giftId", giftId as Any), ("bidAmount", bidAmount as Any), ("message", message as Any)])
case .inputInvoiceStarGiftDropOriginalDetails(let stargift):
return ("inputInvoiceStarGiftDropOriginalDetails", [("stargift", stargift as Any)])
case .inputInvoiceStarGiftPrepaidUpgrade(let peer, let hash):
return ("inputInvoiceStarGiftPrepaidUpgrade", [("peer", peer as Any), ("hash", hash as Any)])
case .inputInvoiceStarGiftResale(let flags, let slug, let toId):
return ("inputInvoiceStarGiftResale", [("flags", flags as Any), ("slug", slug as Any), ("toId", toId as Any)])
case .inputInvoiceStarGiftTransfer(let stargift, let toId):
return ("inputInvoiceStarGiftTransfer", [("stargift", stargift as Any), ("toId", toId as Any)])
case .inputInvoiceStarGiftUpgrade(let flags, let stargift):
return ("inputInvoiceStarGiftUpgrade", [("flags", flags as Any), ("stargift", stargift as Any)])
case .inputInvoiceStars(let purpose):
return ("inputInvoiceStars", [("purpose", purpose as Any)])
}
}
public static func parse_inputInvoiceBusinessBotTransferStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputUser?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputUser
}
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceBusinessBotTransferStars(bot: _1!, stars: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceChatInviteSubscription(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceChatInviteSubscription(hash: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoiceMessage(_ reader: BufferReader) -> InputInvoice? {
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.InputInvoice.inputInvoiceMessage(peer: _1!, msgId: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoicePremiumAuthCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoicePremiumAuthCode(purpose: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoicePremiumGiftCode(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
var _2: Api.PremiumGiftCodeOption?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.PremiumGiftCodeOption
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoicePremiumGiftCode(purpose: _1!, option: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoicePremiumGiftStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputUser?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputUser
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Api.TextWithEntities?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 0) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputInvoice.inputInvoicePremiumGiftStars(flags: _1!, userId: _2!, months: _3!, message: _4)
}
else {
return nil
}
}
public static func parse_inputInvoiceSlug(_ reader: BufferReader) -> InputInvoice? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceSlug(slug: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGift(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputPeer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _3: Int64?
_3 = reader.readInt64()
var _4: Api.TextWithEntities?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.InputInvoice.inputInvoiceStarGift(flags: _1!, peer: _2!, giftId: _3!, message: _4)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftAuctionBid(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputPeer?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPeer
} }
var _3: Int64?
_3 = reader.readInt64()
var _4: Int64?
_4 = reader.readInt64()
var _5: Api.TextWithEntities?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.TextWithEntities
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = (Int(_1!) & Int(1 << 1) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.InputInvoice.inputInvoiceStarGiftAuctionBid(flags: _1!, peer: _2, giftId: _3!, bidAmount: _4!, message: _5)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftDropOriginalDetails(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputSavedStarGift?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputSavedStarGift
}
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceStarGiftDropOriginalDetails(stargift: _1!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftPrepaidUpgrade(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: String?
_2 = parseString(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceStarGiftPrepaidUpgrade(peer: _1!, hash: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftResale(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.InputPeer?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputInvoice.inputInvoiceStarGiftResale(flags: _1!, slug: _2!, toId: _3!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftTransfer(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputSavedStarGift?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputSavedStarGift
}
var _2: Api.InputPeer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceStarGiftTransfer(stargift: _1!, toId: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStarGiftUpgrade(_ reader: BufferReader) -> InputInvoice? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.InputSavedStarGift?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.InputSavedStarGift
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.InputInvoice.inputInvoiceStarGiftUpgrade(flags: _1!, stargift: _2!)
}
else {
return nil
}
}
public static func parse_inputInvoiceStars(_ reader: BufferReader) -> InputInvoice? {
var _1: Api.InputStorePaymentPurpose?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputStorePaymentPurpose
}
let _c1 = _1 != nil
if _c1 {
return Api.InputInvoice.inputInvoiceStars(purpose: _1!)
}
else {
return nil
}
}
}
}
File diff suppressed because it is too large Load Diff
+740
View File
@@ -0,0 +1,740 @@
public extension Api {
indirect enum InputPeer: TypeConstructorDescription {
case inputPeerChannel(channelId: Int64, accessHash: Int64)
case inputPeerChannelFromMessage(peer: Api.InputPeer, msgId: Int32, channelId: Int64)
case inputPeerChat(chatId: Int64)
case inputPeerEmpty
case inputPeerSelf
case inputPeerUser(userId: Int64, accessHash: Int64)
case inputPeerUserFromMessage(peer: Api.InputPeer, msgId: Int32, userId: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
if boxed {
buffer.appendInt32(666680316)
}
serializeInt64(channelId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
if boxed {
buffer.appendInt32(-1121318848)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(channelId, buffer: buffer, boxed: false)
break
case .inputPeerChat(let chatId):
if boxed {
buffer.appendInt32(900291769)
}
serializeInt64(chatId, buffer: buffer, boxed: false)
break
case .inputPeerEmpty:
if boxed {
buffer.appendInt32(2134579434)
}
break
case .inputPeerSelf:
if boxed {
buffer.appendInt32(2107670217)
}
break
case .inputPeerUser(let userId, let accessHash):
if boxed {
buffer.appendInt32(-571955892)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
if boxed {
buffer.appendInt32(-1468331492)
}
peer.serialize(buffer, true)
serializeInt32(msgId, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPeerChannel(let channelId, let accessHash):
return ("inputPeerChannel", [("channelId", channelId as Any), ("accessHash", accessHash as Any)])
case .inputPeerChannelFromMessage(let peer, let msgId, let channelId):
return ("inputPeerChannelFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("channelId", channelId as Any)])
case .inputPeerChat(let chatId):
return ("inputPeerChat", [("chatId", chatId as Any)])
case .inputPeerEmpty:
return ("inputPeerEmpty", [])
case .inputPeerSelf:
return ("inputPeerSelf", [])
case .inputPeerUser(let userId, let accessHash):
return ("inputPeerUser", [("userId", userId as Any), ("accessHash", accessHash as Any)])
case .inputPeerUserFromMessage(let peer, let msgId, let userId):
return ("inputPeerUserFromMessage", [("peer", peer as Any), ("msgId", msgId as Any), ("userId", userId as Any)])
}
}
public static func parse_inputPeerChannel(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerChannel(channelId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerChannelFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerChannelFromMessage(peer: _1!, msgId: _2!, channelId: _3!)
}
else {
return nil
}
}
public static func parse_inputPeerChat(_ reader: BufferReader) -> InputPeer? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.InputPeer.inputPeerChat(chatId: _1!)
}
else {
return nil
}
}
public static func parse_inputPeerEmpty(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerEmpty
}
public static func parse_inputPeerSelf(_ reader: BufferReader) -> InputPeer? {
return Api.InputPeer.inputPeerSelf
}
public static func parse_inputPeerUser(_ reader: BufferReader) -> InputPeer? {
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.InputPeer.inputPeerUser(userId: _1!, accessHash: _2!)
}
else {
return nil
}
}
public static func parse_inputPeerUserFromMessage(_ reader: BufferReader) -> InputPeer? {
var _1: Api.InputPeer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.InputPeer
}
var _2: Int32?
_2 = reader.readInt32()
var _3: Int64?
_3 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPeer.inputPeerUserFromMessage(peer: _1!, msgId: _2!, userId: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputPeerNotifySettings: TypeConstructorDescription {
case inputPeerNotifySettings(flags: Int32, showPreviews: Api.Bool?, silent: Api.Bool?, muteUntil: Int32?, sound: Api.NotificationSound?, storiesMuted: Api.Bool?, storiesHideSender: Api.Bool?, storiesSound: Api.NotificationSound?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound, let storiesMuted, let storiesHideSender, let storiesSound):
if boxed {
buffer.appendInt32(-892638494)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {showPreviews!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {silent!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(muteUntil!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {sound!.serialize(buffer, true)}
if Int(flags) & Int(1 << 6) != 0 {storiesMuted!.serialize(buffer, true)}
if Int(flags) & Int(1 << 7) != 0 {storiesHideSender!.serialize(buffer, true)}
if Int(flags) & Int(1 << 8) != 0 {storiesSound!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPeerNotifySettings(let flags, let showPreviews, let silent, let muteUntil, let sound, let storiesMuted, let storiesHideSender, let storiesSound):
return ("inputPeerNotifySettings", [("flags", flags as Any), ("showPreviews", showPreviews as Any), ("silent", silent as Any), ("muteUntil", muteUntil as Any), ("sound", sound as Any), ("storiesMuted", storiesMuted as Any), ("storiesHideSender", storiesHideSender as Any), ("storiesSound", storiesSound as Any)])
}
}
public static func parse_inputPeerNotifySettings(_ reader: BufferReader) -> InputPeerNotifySettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Bool?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _3: Api.Bool?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _4: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_4 = reader.readInt32() }
var _5: Api.NotificationSound?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.NotificationSound
} }
var _6: Api.Bool?
if Int(_1!) & Int(1 << 6) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _7: Api.Bool?
if Int(_1!) & Int(1 << 7) != 0 {if let signature = reader.readInt32() {
_7 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _8: Api.NotificationSound?
if Int(_1!) & Int(1 << 8) != 0 {if let signature = reader.readInt32() {
_8 = Api.parse(reader, signature: signature) as? Api.NotificationSound
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 3) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 6) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 7) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 8) == 0) || _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return Api.InputPeerNotifySettings.inputPeerNotifySettings(flags: _1!, showPreviews: _2, silent: _3, muteUntil: _4, sound: _5, storiesMuted: _6, storiesHideSender: _7, storiesSound: _8)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputPhoneCall: TypeConstructorDescription {
case inputPhoneCall(id: Int64, accessHash: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPhoneCall(let id, let accessHash):
if boxed {
buffer.appendInt32(506920429)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPhoneCall(let id, let accessHash):
return ("inputPhoneCall", [("id", id as Any), ("accessHash", accessHash as Any)])
}
}
public static func parse_inputPhoneCall(_ reader: BufferReader) -> InputPhoneCall? {
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.InputPhoneCall.inputPhoneCall(id: _1!, accessHash: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum InputPhoto: TypeConstructorDescription {
case inputPhoto(id: Int64, accessHash: Int64, fileReference: Buffer)
case inputPhotoEmpty
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPhoto(let id, let accessHash, let fileReference):
if boxed {
buffer.appendInt32(1001634122)
}
serializeInt64(id, buffer: buffer, boxed: false)
serializeInt64(accessHash, buffer: buffer, boxed: false)
serializeBytes(fileReference, buffer: buffer, boxed: false)
break
case .inputPhotoEmpty:
if boxed {
buffer.appendInt32(483901197)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPhoto(let id, let accessHash, let fileReference):
return ("inputPhoto", [("id", id as Any), ("accessHash", accessHash as Any), ("fileReference", fileReference as Any)])
case .inputPhotoEmpty:
return ("inputPhotoEmpty", [])
}
}
public static func parse_inputPhoto(_ reader: BufferReader) -> InputPhoto? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int64?
_2 = reader.readInt64()
var _3: Buffer?
_3 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.InputPhoto.inputPhoto(id: _1!, accessHash: _2!, fileReference: _3!)
}
else {
return nil
}
}
public static func parse_inputPhotoEmpty(_ reader: BufferReader) -> InputPhoto? {
return Api.InputPhoto.inputPhotoEmpty
}
}
}
public extension Api {
enum InputPrivacyKey: TypeConstructorDescription {
case inputPrivacyKeyAbout
case inputPrivacyKeyAddedByPhone
case inputPrivacyKeyBirthday
case inputPrivacyKeyChatInvite
case inputPrivacyKeyForwards
case inputPrivacyKeyNoPaidMessages
case inputPrivacyKeyPhoneCall
case inputPrivacyKeyPhoneNumber
case inputPrivacyKeyPhoneP2P
case inputPrivacyKeyProfilePhoto
case inputPrivacyKeySavedMusic
case inputPrivacyKeyStarGiftsAutoSave
case inputPrivacyKeyStatusTimestamp
case inputPrivacyKeyVoiceMessages
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPrivacyKeyAbout:
if boxed {
buffer.appendInt32(941870144)
}
break
case .inputPrivacyKeyAddedByPhone:
if boxed {
buffer.appendInt32(-786326563)
}
break
case .inputPrivacyKeyBirthday:
if boxed {
buffer.appendInt32(-698740276)
}
break
case .inputPrivacyKeyChatInvite:
if boxed {
buffer.appendInt32(-1107622874)
}
break
case .inputPrivacyKeyForwards:
if boxed {
buffer.appendInt32(-1529000952)
}
break
case .inputPrivacyKeyNoPaidMessages:
if boxed {
buffer.appendInt32(-1111124044)
}
break
case .inputPrivacyKeyPhoneCall:
if boxed {
buffer.appendInt32(-88417185)
}
break
case .inputPrivacyKeyPhoneNumber:
if boxed {
buffer.appendInt32(55761658)
}
break
case .inputPrivacyKeyPhoneP2P:
if boxed {
buffer.appendInt32(-610373422)
}
break
case .inputPrivacyKeyProfilePhoto:
if boxed {
buffer.appendInt32(1461304012)
}
break
case .inputPrivacyKeySavedMusic:
if boxed {
buffer.appendInt32(1304334886)
}
break
case .inputPrivacyKeyStarGiftsAutoSave:
if boxed {
buffer.appendInt32(-512548031)
}
break
case .inputPrivacyKeyStatusTimestamp:
if boxed {
buffer.appendInt32(1335282456)
}
break
case .inputPrivacyKeyVoiceMessages:
if boxed {
buffer.appendInt32(-1360618136)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPrivacyKeyAbout:
return ("inputPrivacyKeyAbout", [])
case .inputPrivacyKeyAddedByPhone:
return ("inputPrivacyKeyAddedByPhone", [])
case .inputPrivacyKeyBirthday:
return ("inputPrivacyKeyBirthday", [])
case .inputPrivacyKeyChatInvite:
return ("inputPrivacyKeyChatInvite", [])
case .inputPrivacyKeyForwards:
return ("inputPrivacyKeyForwards", [])
case .inputPrivacyKeyNoPaidMessages:
return ("inputPrivacyKeyNoPaidMessages", [])
case .inputPrivacyKeyPhoneCall:
return ("inputPrivacyKeyPhoneCall", [])
case .inputPrivacyKeyPhoneNumber:
return ("inputPrivacyKeyPhoneNumber", [])
case .inputPrivacyKeyPhoneP2P:
return ("inputPrivacyKeyPhoneP2P", [])
case .inputPrivacyKeyProfilePhoto:
return ("inputPrivacyKeyProfilePhoto", [])
case .inputPrivacyKeySavedMusic:
return ("inputPrivacyKeySavedMusic", [])
case .inputPrivacyKeyStarGiftsAutoSave:
return ("inputPrivacyKeyStarGiftsAutoSave", [])
case .inputPrivacyKeyStatusTimestamp:
return ("inputPrivacyKeyStatusTimestamp", [])
case .inputPrivacyKeyVoiceMessages:
return ("inputPrivacyKeyVoiceMessages", [])
}
}
public static func parse_inputPrivacyKeyAbout(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyAbout
}
public static func parse_inputPrivacyKeyAddedByPhone(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyAddedByPhone
}
public static func parse_inputPrivacyKeyBirthday(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyBirthday
}
public static func parse_inputPrivacyKeyChatInvite(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyChatInvite
}
public static func parse_inputPrivacyKeyForwards(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyForwards
}
public static func parse_inputPrivacyKeyNoPaidMessages(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyNoPaidMessages
}
public static func parse_inputPrivacyKeyPhoneCall(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyPhoneCall
}
public static func parse_inputPrivacyKeyPhoneNumber(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyPhoneNumber
}
public static func parse_inputPrivacyKeyPhoneP2P(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyPhoneP2P
}
public static func parse_inputPrivacyKeyProfilePhoto(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyProfilePhoto
}
public static func parse_inputPrivacyKeySavedMusic(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeySavedMusic
}
public static func parse_inputPrivacyKeyStarGiftsAutoSave(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyStarGiftsAutoSave
}
public static func parse_inputPrivacyKeyStatusTimestamp(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyStatusTimestamp
}
public static func parse_inputPrivacyKeyVoiceMessages(_ reader: BufferReader) -> InputPrivacyKey? {
return Api.InputPrivacyKey.inputPrivacyKeyVoiceMessages
}
}
}
public extension Api {
enum InputPrivacyRule: TypeConstructorDescription {
case inputPrivacyValueAllowAll
case inputPrivacyValueAllowBots
case inputPrivacyValueAllowChatParticipants(chats: [Int64])
case inputPrivacyValueAllowCloseFriends
case inputPrivacyValueAllowContacts
case inputPrivacyValueAllowPremium
case inputPrivacyValueAllowUsers(users: [Api.InputUser])
case inputPrivacyValueDisallowAll
case inputPrivacyValueDisallowBots
case inputPrivacyValueDisallowChatParticipants(chats: [Int64])
case inputPrivacyValueDisallowContacts
case inputPrivacyValueDisallowUsers(users: [Api.InputUser])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputPrivacyValueAllowAll:
if boxed {
buffer.appendInt32(407582158)
}
break
case .inputPrivacyValueAllowBots:
if boxed {
buffer.appendInt32(1515179237)
}
break
case .inputPrivacyValueAllowChatParticipants(let chats):
if boxed {
buffer.appendInt32(-2079962673)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueAllowCloseFriends:
if boxed {
buffer.appendInt32(793067081)
}
break
case .inputPrivacyValueAllowContacts:
if boxed {
buffer.appendInt32(218751099)
}
break
case .inputPrivacyValueAllowPremium:
if boxed {
buffer.appendInt32(2009975281)
}
break
case .inputPrivacyValueAllowUsers(let users):
if boxed {
buffer.appendInt32(320652927)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
case .inputPrivacyValueDisallowAll:
if boxed {
buffer.appendInt32(-697604407)
}
break
case .inputPrivacyValueDisallowBots:
if boxed {
buffer.appendInt32(-991594219)
}
break
case .inputPrivacyValueDisallowChatParticipants(let chats):
if boxed {
buffer.appendInt32(-380694650)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .inputPrivacyValueDisallowContacts:
if boxed {
buffer.appendInt32(195371015)
}
break
case .inputPrivacyValueDisallowUsers(let users):
if boxed {
buffer.appendInt32(-1877932953)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
item.serialize(buffer, true)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputPrivacyValueAllowAll:
return ("inputPrivacyValueAllowAll", [])
case .inputPrivacyValueAllowBots:
return ("inputPrivacyValueAllowBots", [])
case .inputPrivacyValueAllowChatParticipants(let chats):
return ("inputPrivacyValueAllowChatParticipants", [("chats", chats as Any)])
case .inputPrivacyValueAllowCloseFriends:
return ("inputPrivacyValueAllowCloseFriends", [])
case .inputPrivacyValueAllowContacts:
return ("inputPrivacyValueAllowContacts", [])
case .inputPrivacyValueAllowPremium:
return ("inputPrivacyValueAllowPremium", [])
case .inputPrivacyValueAllowUsers(let users):
return ("inputPrivacyValueAllowUsers", [("users", users as Any)])
case .inputPrivacyValueDisallowAll:
return ("inputPrivacyValueDisallowAll", [])
case .inputPrivacyValueDisallowBots:
return ("inputPrivacyValueDisallowBots", [])
case .inputPrivacyValueDisallowChatParticipants(let chats):
return ("inputPrivacyValueDisallowChatParticipants", [("chats", chats as Any)])
case .inputPrivacyValueDisallowContacts:
return ("inputPrivacyValueDisallowContacts", [])
case .inputPrivacyValueDisallowUsers(let users):
return ("inputPrivacyValueDisallowUsers", [("users", users as Any)])
}
}
public static func parse_inputPrivacyValueAllowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowAll
}
public static func parse_inputPrivacyValueAllowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowBots
}
public static func parse_inputPrivacyValueAllowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowChatParticipants(chats: _1!)
}
else {
return nil
}
}
public static func parse_inputPrivacyValueAllowCloseFriends(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowCloseFriends
}
public static func parse_inputPrivacyValueAllowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowContacts
}
public static func parse_inputPrivacyValueAllowPremium(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueAllowPremium
}
public static func parse_inputPrivacyValueAllowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueAllowUsers(users: _1!)
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowAll(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowAll
}
public static func parse_inputPrivacyValueDisallowBots(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowBots
}
public static func parse_inputPrivacyValueDisallowChatParticipants(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowChatParticipants(chats: _1!)
}
else {
return nil
}
}
public static func parse_inputPrivacyValueDisallowContacts(_ reader: BufferReader) -> InputPrivacyRule? {
return Api.InputPrivacyRule.inputPrivacyValueDisallowContacts
}
public static func parse_inputPrivacyValueDisallowUsers(_ reader: BufferReader) -> InputPrivacyRule? {
var _1: [Api.InputUser]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.InputUser.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.InputPrivacyRule.inputPrivacyValueDisallowUsers(users: _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
+948
View File
@@ -0,0 +1,948 @@
public extension Api {
enum MessagePeerReaction: TypeConstructorDescription {
case messagePeerReaction(flags: Int32, peerId: Api.Peer, date: Int32, reaction: Api.Reaction)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messagePeerReaction(let flags, let peerId, let date, let reaction):
if boxed {
buffer.appendInt32(-1938180548)
}
serializeInt32(flags, buffer: buffer, boxed: false)
peerId.serialize(buffer, true)
serializeInt32(date, buffer: buffer, boxed: false)
reaction.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messagePeerReaction(let flags, let peerId, let date, let reaction):
return ("messagePeerReaction", [("flags", flags as Any), ("peerId", peerId as Any), ("date", date as Any), ("reaction", reaction as Any)])
}
}
public static func parse_messagePeerReaction(_ reader: BufferReader) -> MessagePeerReaction? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _3: Int32?
_3 = reader.readInt32()
var _4: Api.Reaction?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.Reaction
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.MessagePeerReaction.messagePeerReaction(flags: _1!, peerId: _2!, date: _3!, reaction: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessagePeerVote: TypeConstructorDescription {
case messagePeerVote(peer: Api.Peer, option: Buffer, date: Int32)
case messagePeerVoteInputOption(peer: Api.Peer, date: Int32)
case messagePeerVoteMultiple(peer: Api.Peer, options: [Buffer], date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messagePeerVote(let peer, let option, let date):
if boxed {
buffer.appendInt32(-1228133028)
}
peer.serialize(buffer, true)
serializeBytes(option, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
break
case .messagePeerVoteInputOption(let peer, let date):
if boxed {
buffer.appendInt32(1959634180)
}
peer.serialize(buffer, true)
serializeInt32(date, buffer: buffer, boxed: false)
break
case .messagePeerVoteMultiple(let peer, let options, let date):
if boxed {
buffer.appendInt32(1177089766)
}
peer.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(options.count))
for item in options {
serializeBytes(item, buffer: buffer, boxed: false)
}
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messagePeerVote(let peer, let option, let date):
return ("messagePeerVote", [("peer", peer as Any), ("option", option as Any), ("date", date as Any)])
case .messagePeerVoteInputOption(let peer, let date):
return ("messagePeerVoteInputOption", [("peer", peer as Any), ("date", date as Any)])
case .messagePeerVoteMultiple(let peer, let options, let date):
return ("messagePeerVoteMultiple", [("peer", peer as Any), ("options", options as Any), ("date", date as Any)])
}
}
public static func parse_messagePeerVote(_ reader: BufferReader) -> MessagePeerVote? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Buffer?
_2 = parseBytes(reader)
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessagePeerVote.messagePeerVote(peer: _1!, option: _2!, date: _3!)
}
else {
return nil
}
}
public static func parse_messagePeerVoteInputOption(_ reader: BufferReader) -> MessagePeerVote? {
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.MessagePeerVote.messagePeerVoteInputOption(peer: _1!, date: _2!)
}
else {
return nil
}
}
public static func parse_messagePeerVoteMultiple(_ reader: BufferReader) -> MessagePeerVote? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: [Buffer]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: -1255641564, elementType: Buffer.self)
}
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessagePeerVote.messagePeerVoteMultiple(peer: _1!, options: _2!, date: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageRange: TypeConstructorDescription {
case messageRange(minId: Int32, maxId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageRange(let minId, let maxId):
if boxed {
buffer.appendInt32(182649427)
}
serializeInt32(minId, buffer: buffer, boxed: false)
serializeInt32(maxId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageRange(let minId, let maxId):
return ("messageRange", [("minId", minId as Any), ("maxId", maxId as Any)])
}
}
public static func parse_messageRange(_ reader: BufferReader) -> MessageRange? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.MessageRange.messageRange(minId: _1!, maxId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageReactions: TypeConstructorDescription {
case messageReactions(flags: Int32, results: [Api.ReactionCount], recentReactions: [Api.MessagePeerReaction]?, topReactors: [Api.MessageReactor]?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReactions(let flags, let results, let recentReactions, let topReactors):
if boxed {
buffer.appendInt32(171155211)
}
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(results.count))
for item in results {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(recentReactions!.count))
for item in recentReactions! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 4) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(topReactors!.count))
for item in topReactors! {
item.serialize(buffer, true)
}}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageReactions(let flags, let results, let recentReactions, let topReactors):
return ("messageReactions", [("flags", flags as Any), ("results", results as Any), ("recentReactions", recentReactions as Any), ("topReactors", topReactors as Any)])
}
}
public static func parse_messageReactions(_ reader: BufferReader) -> MessageReactions? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.ReactionCount]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.ReactionCount.self)
}
var _3: [Api.MessagePeerReaction]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessagePeerReaction.self)
} }
var _4: [Api.MessageReactor]?
if Int(_1!) & Int(1 << 4) != 0 {if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageReactor.self)
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 4) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.MessageReactions.messageReactions(flags: _1!, results: _2!, recentReactions: _3, topReactors: _4)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageReactor: TypeConstructorDescription {
case messageReactor(flags: Int32, peerId: Api.Peer?, count: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReactor(let flags, let peerId, let count):
if boxed {
buffer.appendInt32(1269016922)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {peerId!.serialize(buffer, true)}
serializeInt32(count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageReactor(let flags, let peerId, let count):
return ("messageReactor", [("flags", flags as Any), ("peerId", peerId as Any), ("count", count as Any)])
}
}
public static func parse_messageReactor(_ reader: BufferReader) -> MessageReactor? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Peer?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Peer
} }
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.MessageReactor.messageReactor(flags: _1!, peerId: _2, count: _3!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageReplies: TypeConstructorDescription {
case messageReplies(flags: Int32, replies: Int32, repliesPts: Int32, recentRepliers: [Api.Peer]?, channelId: Int64?, maxId: Int32?, readMaxId: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReplies(let flags, let replies, let repliesPts, let recentRepliers, let channelId, let maxId, let readMaxId):
if boxed {
buffer.appendInt32(-2083123262)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(replies, buffer: buffer, boxed: false)
serializeInt32(repliesPts, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(recentRepliers!.count))
for item in recentRepliers! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 0) != 0 {serializeInt64(channelId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 3) != 0 {serializeInt32(readMaxId!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageReplies(let flags, let replies, let repliesPts, let recentRepliers, let channelId, let maxId, let readMaxId):
return ("messageReplies", [("flags", flags as Any), ("replies", replies as Any), ("repliesPts", repliesPts as Any), ("recentRepliers", recentRepliers as Any), ("channelId", channelId as Any), ("maxId", maxId as Any), ("readMaxId", readMaxId as Any)])
}
}
public static func parse_messageReplies(_ reader: BufferReader) -> MessageReplies? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: [Api.Peer]?
if Int(_1!) & Int(1 << 1) != 0 {if let _ = reader.readInt32() {
_4 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Peer.self)
} }
var _5: Int64?
if Int(_1!) & Int(1 << 0) != 0 {_5 = reader.readInt64() }
var _6: Int32?
if Int(_1!) & Int(1 << 2) != 0 {_6 = reader.readInt32() }
var _7: Int32?
if Int(_1!) & Int(1 << 3) != 0 {_7 = reader.readInt32() }
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 << 0) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 3) == 0) || _7 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 {
return Api.MessageReplies.messageReplies(flags: _1!, replies: _2!, repliesPts: _3!, recentRepliers: _4, channelId: _5, maxId: _6, readMaxId: _7)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum MessageReplyHeader: TypeConstructorDescription {
case messageReplyHeader(flags: Int32, replyToMsgId: Int32?, replyToPeerId: Api.Peer?, replyFrom: Api.MessageFwdHeader?, replyMedia: Api.MessageMedia?, replyToTopId: Int32?, quoteText: String?, quoteEntities: [Api.MessageEntity]?, quoteOffset: Int32?, todoItemId: Int32?)
case messageReplyStoryHeader(peer: Api.Peer, storyId: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReplyHeader(let flags, let replyToMsgId, let replyToPeerId, let replyFrom, let replyMedia, let replyToTopId, let quoteText, let quoteEntities, let quoteOffset, let todoItemId):
if boxed {
buffer.appendInt32(1763137035)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 4) != 0 {serializeInt32(replyToMsgId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {replyToPeerId!.serialize(buffer, true)}
if Int(flags) & Int(1 << 5) != 0 {replyFrom!.serialize(buffer, true)}
if Int(flags) & Int(1 << 8) != 0 {replyMedia!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(replyToTopId!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 6) != 0 {serializeString(quoteText!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 7) != 0 {buffer.appendInt32(481674261)
buffer.appendInt32(Int32(quoteEntities!.count))
for item in quoteEntities! {
item.serialize(buffer, true)
}}
if Int(flags) & Int(1 << 10) != 0 {serializeInt32(quoteOffset!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 11) != 0 {serializeInt32(todoItemId!, buffer: buffer, boxed: false)}
break
case .messageReplyStoryHeader(let peer, let storyId):
if boxed {
buffer.appendInt32(240843065)
}
peer.serialize(buffer, true)
serializeInt32(storyId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageReplyHeader(let flags, let replyToMsgId, let replyToPeerId, let replyFrom, let replyMedia, let replyToTopId, let quoteText, let quoteEntities, let quoteOffset, let todoItemId):
return ("messageReplyHeader", [("flags", flags as Any), ("replyToMsgId", replyToMsgId as Any), ("replyToPeerId", replyToPeerId as Any), ("replyFrom", replyFrom as Any), ("replyMedia", replyMedia as Any), ("replyToTopId", replyToTopId as Any), ("quoteText", quoteText as Any), ("quoteEntities", quoteEntities as Any), ("quoteOffset", quoteOffset as Any), ("todoItemId", todoItemId as Any)])
case .messageReplyStoryHeader(let peer, let storyId):
return ("messageReplyStoryHeader", [("peer", peer as Any), ("storyId", storyId as Any)])
}
}
public static func parse_messageReplyHeader(_ reader: BufferReader) -> MessageReplyHeader? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 4) != 0 {_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
} }
var _4: Api.MessageFwdHeader?
if Int(_1!) & Int(1 << 5) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.MessageFwdHeader
} }
var _5: Api.MessageMedia?
if Int(_1!) & Int(1 << 8) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.MessageMedia
} }
var _6: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_6 = reader.readInt32() }
var _7: String?
if Int(_1!) & Int(1 << 6) != 0 {_7 = parseString(reader) }
var _8: [Api.MessageEntity]?
if Int(_1!) & Int(1 << 7) != 0 {if let _ = reader.readInt32() {
_8 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageEntity.self)
} }
var _9: Int32?
if Int(_1!) & Int(1 << 10) != 0 {_9 = reader.readInt32() }
var _10: Int32?
if Int(_1!) & Int(1 << 11) != 0 {_10 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 4) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 5) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 8) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
let _c7 = (Int(_1!) & Int(1 << 6) == 0) || _7 != nil
let _c8 = (Int(_1!) & Int(1 << 7) == 0) || _8 != nil
let _c9 = (Int(_1!) & Int(1 << 10) == 0) || _9 != nil
let _c10 = (Int(_1!) & Int(1 << 11) == 0) || _10 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 && _c10 {
return Api.MessageReplyHeader.messageReplyHeader(flags: _1!, replyToMsgId: _2, replyToPeerId: _3, replyFrom: _4, replyMedia: _5, replyToTopId: _6, quoteText: _7, quoteEntities: _8, quoteOffset: _9, todoItemId: _10)
}
else {
return nil
}
}
public static func parse_messageReplyStoryHeader(_ reader: BufferReader) -> MessageReplyHeader? {
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.MessageReplyHeader.messageReplyStoryHeader(peer: _1!, storyId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageReportOption: TypeConstructorDescription {
case messageReportOption(text: String, option: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageReportOption(let text, let option):
if boxed {
buffer.appendInt32(2030298073)
}
serializeString(text, buffer: buffer, boxed: false)
serializeBytes(option, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageReportOption(let text, let option):
return ("messageReportOption", [("text", text as Any), ("option", option as Any)])
}
}
public static func parse_messageReportOption(_ reader: BufferReader) -> MessageReportOption? {
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.MessageReportOption.messageReportOption(text: _1!, option: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessageViews: TypeConstructorDescription {
case messageViews(flags: Int32, views: Int32?, forwards: Int32?, replies: Api.MessageReplies?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .messageViews(let flags, let views, let forwards, let replies):
if boxed {
buffer.appendInt32(1163625789)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(views!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(forwards!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {replies!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .messageViews(let flags, let views, let forwards, let replies):
return ("messageViews", [("flags", flags as Any), ("views", views as Any), ("forwards", forwards as Any), ("replies", replies as Any)])
}
}
public static func parse_messageViews(_ reader: BufferReader) -> MessageViews? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
var _3: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_3 = reader.readInt32() }
var _4: Api.MessageReplies?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.MessageReplies
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.MessageViews.messageViews(flags: _1!, views: _2, forwards: _3, replies: _4)
}
else {
return nil
}
}
}
}
public extension Api {
enum MessagesFilter: TypeConstructorDescription {
case inputMessagesFilterChatPhotos
case inputMessagesFilterContacts
case inputMessagesFilterDocument
case inputMessagesFilterEmpty
case inputMessagesFilterGeo
case inputMessagesFilterGif
case inputMessagesFilterMusic
case inputMessagesFilterMyMentions
case inputMessagesFilterPhoneCalls(flags: Int32)
case inputMessagesFilterPhotoVideo
case inputMessagesFilterPhotos
case inputMessagesFilterPinned
case inputMessagesFilterRoundVideo
case inputMessagesFilterRoundVoice
case inputMessagesFilterUrl
case inputMessagesFilterVideo
case inputMessagesFilterVoice
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputMessagesFilterChatPhotos:
if boxed {
buffer.appendInt32(975236280)
}
break
case .inputMessagesFilterContacts:
if boxed {
buffer.appendInt32(-530392189)
}
break
case .inputMessagesFilterDocument:
if boxed {
buffer.appendInt32(-1629621880)
}
break
case .inputMessagesFilterEmpty:
if boxed {
buffer.appendInt32(1474492012)
}
break
case .inputMessagesFilterGeo:
if boxed {
buffer.appendInt32(-419271411)
}
break
case .inputMessagesFilterGif:
if boxed {
buffer.appendInt32(-3644025)
}
break
case .inputMessagesFilterMusic:
if boxed {
buffer.appendInt32(928101534)
}
break
case .inputMessagesFilterMyMentions:
if boxed {
buffer.appendInt32(-1040652646)
}
break
case .inputMessagesFilterPhoneCalls(let flags):
if boxed {
buffer.appendInt32(-2134272152)
}
serializeInt32(flags, buffer: buffer, boxed: false)
break
case .inputMessagesFilterPhotoVideo:
if boxed {
buffer.appendInt32(1458172132)
}
break
case .inputMessagesFilterPhotos:
if boxed {
buffer.appendInt32(-1777752804)
}
break
case .inputMessagesFilterPinned:
if boxed {
buffer.appendInt32(464520273)
}
break
case .inputMessagesFilterRoundVideo:
if boxed {
buffer.appendInt32(-1253451181)
}
break
case .inputMessagesFilterRoundVoice:
if boxed {
buffer.appendInt32(2054952868)
}
break
case .inputMessagesFilterUrl:
if boxed {
buffer.appendInt32(2129714567)
}
break
case .inputMessagesFilterVideo:
if boxed {
buffer.appendInt32(-1614803355)
}
break
case .inputMessagesFilterVoice:
if boxed {
buffer.appendInt32(1358283666)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputMessagesFilterChatPhotos:
return ("inputMessagesFilterChatPhotos", [])
case .inputMessagesFilterContacts:
return ("inputMessagesFilterContacts", [])
case .inputMessagesFilterDocument:
return ("inputMessagesFilterDocument", [])
case .inputMessagesFilterEmpty:
return ("inputMessagesFilterEmpty", [])
case .inputMessagesFilterGeo:
return ("inputMessagesFilterGeo", [])
case .inputMessagesFilterGif:
return ("inputMessagesFilterGif", [])
case .inputMessagesFilterMusic:
return ("inputMessagesFilterMusic", [])
case .inputMessagesFilterMyMentions:
return ("inputMessagesFilterMyMentions", [])
case .inputMessagesFilterPhoneCalls(let flags):
return ("inputMessagesFilterPhoneCalls", [("flags", flags as Any)])
case .inputMessagesFilterPhotoVideo:
return ("inputMessagesFilterPhotoVideo", [])
case .inputMessagesFilterPhotos:
return ("inputMessagesFilterPhotos", [])
case .inputMessagesFilterPinned:
return ("inputMessagesFilterPinned", [])
case .inputMessagesFilterRoundVideo:
return ("inputMessagesFilterRoundVideo", [])
case .inputMessagesFilterRoundVoice:
return ("inputMessagesFilterRoundVoice", [])
case .inputMessagesFilterUrl:
return ("inputMessagesFilterUrl", [])
case .inputMessagesFilterVideo:
return ("inputMessagesFilterVideo", [])
case .inputMessagesFilterVoice:
return ("inputMessagesFilterVoice", [])
}
}
public static func parse_inputMessagesFilterChatPhotos(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterChatPhotos
}
public static func parse_inputMessagesFilterContacts(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterContacts
}
public static func parse_inputMessagesFilterDocument(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterDocument
}
public static func parse_inputMessagesFilterEmpty(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterEmpty
}
public static func parse_inputMessagesFilterGeo(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterGeo
}
public static func parse_inputMessagesFilterGif(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterGif
}
public static func parse_inputMessagesFilterMusic(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterMusic
}
public static func parse_inputMessagesFilterMyMentions(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterMyMentions
}
public static func parse_inputMessagesFilterPhoneCalls(_ reader: BufferReader) -> MessagesFilter? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.MessagesFilter.inputMessagesFilterPhoneCalls(flags: _1!)
}
else {
return nil
}
}
public static func parse_inputMessagesFilterPhotoVideo(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterPhotoVideo
}
public static func parse_inputMessagesFilterPhotos(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterPhotos
}
public static func parse_inputMessagesFilterPinned(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterPinned
}
public static func parse_inputMessagesFilterRoundVideo(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterRoundVideo
}
public static func parse_inputMessagesFilterRoundVoice(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterRoundVoice
}
public static func parse_inputMessagesFilterUrl(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterUrl
}
public static func parse_inputMessagesFilterVideo(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterVideo
}
public static func parse_inputMessagesFilterVoice(_ reader: BufferReader) -> MessagesFilter? {
return Api.MessagesFilter.inputMessagesFilterVoice
}
}
}
public extension Api {
enum MissingInvitee: TypeConstructorDescription {
case missingInvitee(flags: Int32, userId: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .missingInvitee(let flags, let userId):
if boxed {
buffer.appendInt32(1653379620)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .missingInvitee(let flags, let userId):
return ("missingInvitee", [("flags", flags as Any), ("userId", userId as Any)])
}
}
public static func parse_missingInvitee(_ reader: BufferReader) -> MissingInvitee? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.MissingInvitee.missingInvitee(flags: _1!, userId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum MyBoost: TypeConstructorDescription {
case myBoost(flags: Int32, slot: Int32, peer: Api.Peer?, date: Int32, expires: Int32, cooldownUntilDate: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .myBoost(let flags, let slot, let peer, let date, let expires, let cooldownUntilDate):
if boxed {
buffer.appendInt32(-1001897636)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt32(slot, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {peer!.serialize(buffer, true)}
serializeInt32(date, buffer: buffer, boxed: false)
serializeInt32(expires, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(cooldownUntilDate!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .myBoost(let flags, let slot, let peer, let date, let expires, let cooldownUntilDate):
return ("myBoost", [("flags", flags as Any), ("slot", slot as Any), ("peer", peer as Any), ("date", date as Any), ("expires", expires as Any), ("cooldownUntilDate", cooldownUntilDate as Any)])
}
}
public static func parse_myBoost(_ reader: BufferReader) -> MyBoost? {
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
} }
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_6 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = (Int(_1!) & Int(1 << 1) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.MyBoost.myBoost(flags: _1!, slot: _2!, peer: _3, date: _4!, expires: _5!, cooldownUntilDate: _6)
}
else {
return nil
}
}
}
}
public extension Api {
enum NearestDc: TypeConstructorDescription {
case nearestDc(country: String, thisDc: Int32, nearestDc: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .nearestDc(let country, let thisDc, let nearestDc):
if boxed {
buffer.appendInt32(-1910892683)
}
serializeString(country, buffer: buffer, boxed: false)
serializeInt32(thisDc, buffer: buffer, boxed: false)
serializeInt32(nearestDc, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .nearestDc(let country, let thisDc, let nearestDc):
return ("nearestDc", [("country", country as Any), ("thisDc", thisDc as Any), ("nearestDc", nearestDc as Any)])
}
}
public static func parse_nearestDc(_ reader: BufferReader) -> NearestDc? {
var _1: String?
_1 = parseString(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.NearestDc.nearestDc(country: _1!, thisDc: _2!, nearestDc: _3!)
}
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
+712
View File
@@ -0,0 +1,712 @@
public extension Api {
enum PrivacyRule: TypeConstructorDescription {
case privacyValueAllowAll
case privacyValueAllowBots
case privacyValueAllowChatParticipants(chats: [Int64])
case privacyValueAllowCloseFriends
case privacyValueAllowContacts
case privacyValueAllowPremium
case privacyValueAllowUsers(users: [Int64])
case privacyValueDisallowAll
case privacyValueDisallowBots
case privacyValueDisallowChatParticipants(chats: [Int64])
case privacyValueDisallowContacts
case privacyValueDisallowUsers(users: [Int64])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .privacyValueAllowAll:
if boxed {
buffer.appendInt32(1698855810)
}
break
case .privacyValueAllowBots:
if boxed {
buffer.appendInt32(558242653)
}
break
case .privacyValueAllowChatParticipants(let chats):
if boxed {
buffer.appendInt32(1796427406)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .privacyValueAllowCloseFriends:
if boxed {
buffer.appendInt32(-135735141)
}
break
case .privacyValueAllowContacts:
if boxed {
buffer.appendInt32(-123988)
}
break
case .privacyValueAllowPremium:
if boxed {
buffer.appendInt32(-320241333)
}
break
case .privacyValueAllowUsers(let users):
if boxed {
buffer.appendInt32(-1198497870)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .privacyValueDisallowAll:
if boxed {
buffer.appendInt32(-1955338397)
}
break
case .privacyValueDisallowBots:
if boxed {
buffer.appendInt32(-156895185)
}
break
case .privacyValueDisallowChatParticipants(let chats):
if boxed {
buffer.appendInt32(1103656293)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .privacyValueDisallowContacts:
if boxed {
buffer.appendInt32(-125240806)
}
break
case .privacyValueDisallowUsers(let users):
if boxed {
buffer.appendInt32(-463335103)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(users.count))
for item in users {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .privacyValueAllowAll:
return ("privacyValueAllowAll", [])
case .privacyValueAllowBots:
return ("privacyValueAllowBots", [])
case .privacyValueAllowChatParticipants(let chats):
return ("privacyValueAllowChatParticipants", [("chats", chats as Any)])
case .privacyValueAllowCloseFriends:
return ("privacyValueAllowCloseFriends", [])
case .privacyValueAllowContacts:
return ("privacyValueAllowContacts", [])
case .privacyValueAllowPremium:
return ("privacyValueAllowPremium", [])
case .privacyValueAllowUsers(let users):
return ("privacyValueAllowUsers", [("users", users as Any)])
case .privacyValueDisallowAll:
return ("privacyValueDisallowAll", [])
case .privacyValueDisallowBots:
return ("privacyValueDisallowBots", [])
case .privacyValueDisallowChatParticipants(let chats):
return ("privacyValueDisallowChatParticipants", [("chats", chats as Any)])
case .privacyValueDisallowContacts:
return ("privacyValueDisallowContacts", [])
case .privacyValueDisallowUsers(let users):
return ("privacyValueDisallowUsers", [("users", users as Any)])
}
}
public static func parse_privacyValueAllowAll(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowAll
}
public static func parse_privacyValueAllowBots(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowBots
}
public static func parse_privacyValueAllowChatParticipants(_ reader: BufferReader) -> PrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.PrivacyRule.privacyValueAllowChatParticipants(chats: _1!)
}
else {
return nil
}
}
public static func parse_privacyValueAllowCloseFriends(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowCloseFriends
}
public static func parse_privacyValueAllowContacts(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowContacts
}
public static func parse_privacyValueAllowPremium(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueAllowPremium
}
public static func parse_privacyValueAllowUsers(_ reader: BufferReader) -> PrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.PrivacyRule.privacyValueAllowUsers(users: _1!)
}
else {
return nil
}
}
public static func parse_privacyValueDisallowAll(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueDisallowAll
}
public static func parse_privacyValueDisallowBots(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueDisallowBots
}
public static func parse_privacyValueDisallowChatParticipants(_ reader: BufferReader) -> PrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.PrivacyRule.privacyValueDisallowChatParticipants(chats: _1!)
}
else {
return nil
}
}
public static func parse_privacyValueDisallowContacts(_ reader: BufferReader) -> PrivacyRule? {
return Api.PrivacyRule.privacyValueDisallowContacts
}
public static func parse_privacyValueDisallowUsers(_ reader: BufferReader) -> PrivacyRule? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.PrivacyRule.privacyValueDisallowUsers(users: _1!)
}
else {
return nil
}
}
}
}
public extension Api {
enum ProfileTab: TypeConstructorDescription {
case profileTabFiles
case profileTabGifs
case profileTabGifts
case profileTabLinks
case profileTabMedia
case profileTabMusic
case profileTabPosts
case profileTabVoice
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .profileTabFiles:
if boxed {
buffer.appendInt32(-1422681088)
}
break
case .profileTabGifs:
if boxed {
buffer.appendInt32(-1564412267)
}
break
case .profileTabGifts:
if boxed {
buffer.appendInt32(1296815210)
}
break
case .profileTabLinks:
if boxed {
buffer.appendInt32(-748329831)
}
break
case .profileTabMedia:
if boxed {
buffer.appendInt32(1925597525)
}
break
case .profileTabMusic:
if boxed {
buffer.appendInt32(-1624780178)
}
break
case .profileTabPosts:
if boxed {
buffer.appendInt32(-1181952362)
}
break
case .profileTabVoice:
if boxed {
buffer.appendInt32(-461960914)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .profileTabFiles:
return ("profileTabFiles", [])
case .profileTabGifs:
return ("profileTabGifs", [])
case .profileTabGifts:
return ("profileTabGifts", [])
case .profileTabLinks:
return ("profileTabLinks", [])
case .profileTabMedia:
return ("profileTabMedia", [])
case .profileTabMusic:
return ("profileTabMusic", [])
case .profileTabPosts:
return ("profileTabPosts", [])
case .profileTabVoice:
return ("profileTabVoice", [])
}
}
public static func parse_profileTabFiles(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabFiles
}
public static func parse_profileTabGifs(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabGifs
}
public static func parse_profileTabGifts(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabGifts
}
public static func parse_profileTabLinks(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabLinks
}
public static func parse_profileTabMedia(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabMedia
}
public static func parse_profileTabMusic(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabMusic
}
public static func parse_profileTabPosts(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabPosts
}
public static func parse_profileTabVoice(_ reader: BufferReader) -> ProfileTab? {
return Api.ProfileTab.profileTabVoice
}
}
}
public extension Api {
indirect enum PublicForward: TypeConstructorDescription {
case publicForwardMessage(message: Api.Message)
case publicForwardStory(peer: Api.Peer, story: Api.StoryItem)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .publicForwardMessage(let message):
if boxed {
buffer.appendInt32(32685898)
}
message.serialize(buffer, true)
break
case .publicForwardStory(let peer, let story):
if boxed {
buffer.appendInt32(-302797360)
}
peer.serialize(buffer, true)
story.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .publicForwardMessage(let message):
return ("publicForwardMessage", [("message", message as Any)])
case .publicForwardStory(let peer, let story):
return ("publicForwardStory", [("peer", peer as Any), ("story", story as Any)])
}
}
public static func parse_publicForwardMessage(_ reader: BufferReader) -> PublicForward? {
var _1: Api.Message?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Message
}
let _c1 = _1 != nil
if _c1 {
return Api.PublicForward.publicForwardMessage(message: _1!)
}
else {
return nil
}
}
public static func parse_publicForwardStory(_ reader: BufferReader) -> PublicForward? {
var _1: Api.Peer?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.Peer
}
var _2: Api.StoryItem?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.StoryItem
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.PublicForward.publicForwardStory(peer: _1!, story: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum QuickReply: TypeConstructorDescription {
case quickReply(shortcutId: Int32, shortcut: String, topMessage: Int32, count: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .quickReply(let shortcutId, let shortcut, let topMessage, let count):
if boxed {
buffer.appendInt32(110563371)
}
serializeInt32(shortcutId, buffer: buffer, boxed: false)
serializeString(shortcut, buffer: buffer, boxed: false)
serializeInt32(topMessage, buffer: buffer, boxed: false)
serializeInt32(count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .quickReply(let shortcutId, let shortcut, let topMessage, let count):
return ("quickReply", [("shortcutId", shortcutId as Any), ("shortcut", shortcut as Any), ("topMessage", topMessage as Any), ("count", count as Any)])
}
}
public static func parse_quickReply(_ reader: BufferReader) -> QuickReply? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.QuickReply.quickReply(shortcutId: _1!, shortcut: _2!, topMessage: _3!, count: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
enum Reaction: TypeConstructorDescription {
case reactionCustomEmoji(documentId: Int64)
case reactionEmoji(emoticon: String)
case reactionEmpty
case reactionPaid
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionCustomEmoji(let documentId):
if boxed {
buffer.appendInt32(-1992950669)
}
serializeInt64(documentId, buffer: buffer, boxed: false)
break
case .reactionEmoji(let emoticon):
if boxed {
buffer.appendInt32(455247544)
}
serializeString(emoticon, buffer: buffer, boxed: false)
break
case .reactionEmpty:
if boxed {
buffer.appendInt32(2046153753)
}
break
case .reactionPaid:
if boxed {
buffer.appendInt32(1379771627)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .reactionCustomEmoji(let documentId):
return ("reactionCustomEmoji", [("documentId", documentId as Any)])
case .reactionEmoji(let emoticon):
return ("reactionEmoji", [("emoticon", emoticon as Any)])
case .reactionEmpty:
return ("reactionEmpty", [])
case .reactionPaid:
return ("reactionPaid", [])
}
}
public static func parse_reactionCustomEmoji(_ reader: BufferReader) -> Reaction? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.Reaction.reactionCustomEmoji(documentId: _1!)
}
else {
return nil
}
}
public static func parse_reactionEmoji(_ reader: BufferReader) -> Reaction? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.Reaction.reactionEmoji(emoticon: _1!)
}
else {
return nil
}
}
public static func parse_reactionEmpty(_ reader: BufferReader) -> Reaction? {
return Api.Reaction.reactionEmpty
}
public static func parse_reactionPaid(_ reader: BufferReader) -> Reaction? {
return Api.Reaction.reactionPaid
}
}
}
public extension Api {
enum ReactionCount: TypeConstructorDescription {
case reactionCount(flags: Int32, chosenOrder: Int32?, reaction: Api.Reaction, count: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionCount(let flags, let chosenOrder, let reaction, let count):
if boxed {
buffer.appendInt32(-1546531968)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeInt32(chosenOrder!, buffer: buffer, boxed: false)}
reaction.serialize(buffer, true)
serializeInt32(count, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .reactionCount(let flags, let chosenOrder, let reaction, let count):
return ("reactionCount", [("flags", flags as Any), ("chosenOrder", chosenOrder as Any), ("reaction", reaction as Any), ("count", count as Any)])
}
}
public static func parse_reactionCount(_ reader: BufferReader) -> ReactionCount? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 0) != 0 {_2 = reader.readInt32() }
var _3: Api.Reaction?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Reaction
}
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.ReactionCount.reactionCount(flags: _1!, chosenOrder: _2, reaction: _3!, count: _4!)
}
else {
return nil
}
}
}
}
public extension Api {
enum ReactionNotificationsFrom: TypeConstructorDescription {
case reactionNotificationsFromAll
case reactionNotificationsFromContacts
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionNotificationsFromAll:
if boxed {
buffer.appendInt32(1268654752)
}
break
case .reactionNotificationsFromContacts:
if boxed {
buffer.appendInt32(-1161583078)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .reactionNotificationsFromAll:
return ("reactionNotificationsFromAll", [])
case .reactionNotificationsFromContacts:
return ("reactionNotificationsFromContacts", [])
}
}
public static func parse_reactionNotificationsFromAll(_ reader: BufferReader) -> ReactionNotificationsFrom? {
return Api.ReactionNotificationsFrom.reactionNotificationsFromAll
}
public static func parse_reactionNotificationsFromContacts(_ reader: BufferReader) -> ReactionNotificationsFrom? {
return Api.ReactionNotificationsFrom.reactionNotificationsFromContacts
}
}
}
public extension Api {
enum ReactionsNotifySettings: TypeConstructorDescription {
case reactionsNotifySettings(flags: Int32, messagesNotifyFrom: Api.ReactionNotificationsFrom?, storiesNotifyFrom: Api.ReactionNotificationsFrom?, sound: Api.NotificationSound, showPreviews: Api.Bool)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reactionsNotifySettings(let flags, let messagesNotifyFrom, let storiesNotifyFrom, let sound, let showPreviews):
if boxed {
buffer.appendInt32(1457736048)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {messagesNotifyFrom!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {storiesNotifyFrom!.serialize(buffer, true)}
sound.serialize(buffer, true)
showPreviews.serialize(buffer, true)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .reactionsNotifySettings(let flags, let messagesNotifyFrom, let storiesNotifyFrom, let sound, let showPreviews):
return ("reactionsNotifySettings", [("flags", flags as Any), ("messagesNotifyFrom", messagesNotifyFrom as Any), ("storiesNotifyFrom", storiesNotifyFrom as Any), ("sound", sound as Any), ("showPreviews", showPreviews as Any)])
}
}
public static func parse_reactionsNotifySettings(_ reader: BufferReader) -> ReactionsNotifySettings? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.ReactionNotificationsFrom?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom
} }
var _3: Api.ReactionNotificationsFrom?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.ReactionNotificationsFrom
} }
var _4: Api.NotificationSound?
if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.NotificationSound
}
var _5: Api.Bool?
if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.Bool
}
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.ReactionsNotifySettings.reactionsNotifySettings(flags: _1!, messagesNotifyFrom: _2, storiesNotifyFrom: _3, sound: _4!, showPreviews: _5!)
}
else {
return nil
}
}
}
}
public extension Api {
enum ReadParticipantDate: TypeConstructorDescription {
case readParticipantDate(userId: Int64, date: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .readParticipantDate(let userId, let date):
if boxed {
buffer.appendInt32(1246753138)
}
serializeInt64(userId, buffer: buffer, boxed: false)
serializeInt32(date, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .readParticipantDate(let userId, let date):
return ("readParticipantDate", [("userId", userId as Any), ("date", date as Any)])
}
}
public static func parse_readParticipantDate(_ reader: BufferReader) -> ReadParticipantDate? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ReadParticipantDate.readParticipantDate(userId: _1!, date: _2!)
}
else {
return nil
}
}
}
}
+874
View File
@@ -0,0 +1,874 @@
public extension Api {
enum ReceivedNotifyMessage: TypeConstructorDescription {
case receivedNotifyMessage(id: Int32, flags: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .receivedNotifyMessage(let id, let flags):
if boxed {
buffer.appendInt32(-1551583367)
}
serializeInt32(id, buffer: buffer, boxed: false)
serializeInt32(flags, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .receivedNotifyMessage(let id, let flags):
return ("receivedNotifyMessage", [("id", id as Any), ("flags", flags as Any)])
}
}
public static func parse_receivedNotifyMessage(_ reader: BufferReader) -> ReceivedNotifyMessage? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ReceivedNotifyMessage.receivedNotifyMessage(id: _1!, flags: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
indirect enum RecentMeUrl: TypeConstructorDescription {
case recentMeUrlChat(url: String, chatId: Int64)
case recentMeUrlChatInvite(url: String, chatInvite: Api.ChatInvite)
case recentMeUrlStickerSet(url: String, set: Api.StickerSetCovered)
case recentMeUrlUnknown(url: String)
case recentMeUrlUser(url: String, userId: Int64)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .recentMeUrlChat(let url, let chatId):
if boxed {
buffer.appendInt32(-1294306862)
}
serializeString(url, buffer: buffer, boxed: false)
serializeInt64(chatId, buffer: buffer, boxed: false)
break
case .recentMeUrlChatInvite(let url, let chatInvite):
if boxed {
buffer.appendInt32(-347535331)
}
serializeString(url, buffer: buffer, boxed: false)
chatInvite.serialize(buffer, true)
break
case .recentMeUrlStickerSet(let url, let set):
if boxed {
buffer.appendInt32(-1140172836)
}
serializeString(url, buffer: buffer, boxed: false)
set.serialize(buffer, true)
break
case .recentMeUrlUnknown(let url):
if boxed {
buffer.appendInt32(1189204285)
}
serializeString(url, buffer: buffer, boxed: false)
break
case .recentMeUrlUser(let url, let userId):
if boxed {
buffer.appendInt32(-1188296222)
}
serializeString(url, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .recentMeUrlChat(let url, let chatId):
return ("recentMeUrlChat", [("url", url as Any), ("chatId", chatId as Any)])
case .recentMeUrlChatInvite(let url, let chatInvite):
return ("recentMeUrlChatInvite", [("url", url as Any), ("chatInvite", chatInvite as Any)])
case .recentMeUrlStickerSet(let url, let set):
return ("recentMeUrlStickerSet", [("url", url as Any), ("set", set as Any)])
case .recentMeUrlUnknown(let url):
return ("recentMeUrlUnknown", [("url", url as Any)])
case .recentMeUrlUser(let url, let userId):
return ("recentMeUrlUser", [("url", url as Any), ("userId", userId as Any)])
}
}
public static func parse_recentMeUrlChat(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.RecentMeUrl.recentMeUrlChat(url: _1!, chatId: _2!)
}
else {
return nil
}
}
public static func parse_recentMeUrlChatInvite(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
var _2: Api.ChatInvite?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.ChatInvite
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.RecentMeUrl.recentMeUrlChatInvite(url: _1!, chatInvite: _2!)
}
else {
return nil
}
}
public static func parse_recentMeUrlStickerSet(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
var _2: Api.StickerSetCovered?
if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.StickerSetCovered
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.RecentMeUrl.recentMeUrlStickerSet(url: _1!, set: _2!)
}
else {
return nil
}
}
public static func parse_recentMeUrlUnknown(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
let _c1 = _1 != nil
if _c1 {
return Api.RecentMeUrl.recentMeUrlUnknown(url: _1!)
}
else {
return nil
}
}
public static func parse_recentMeUrlUser(_ reader: BufferReader) -> RecentMeUrl? {
var _1: String?
_1 = parseString(reader)
var _2: Int64?
_2 = reader.readInt64()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.RecentMeUrl.recentMeUrlUser(url: _1!, userId: _2!)
}
else {
return nil
}
}
}
}
public extension Api {
enum RecentStory: TypeConstructorDescription {
case recentStory(flags: Int32, maxId: Int32?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .recentStory(let flags, let maxId):
if boxed {
buffer.appendInt32(1897752877)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 1) != 0 {serializeInt32(maxId!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .recentStory(let flags, let maxId):
return ("recentStory", [("flags", flags as Any), ("maxId", maxId as Any)])
}
}
public static func parse_recentStory(_ reader: BufferReader) -> RecentStory? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
if Int(_1!) & Int(1 << 1) != 0 {_2 = reader.readInt32() }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 1) == 0) || _2 != nil
if _c1 && _c2 {
return Api.RecentStory.recentStory(flags: _1!, maxId: _2)
}
else {
return nil
}
}
}
}
public extension Api {
enum ReplyMarkup: TypeConstructorDescription {
case replyInlineMarkup(rows: [Api.KeyboardButtonRow])
case replyKeyboardForceReply(flags: Int32, placeholder: String?)
case replyKeyboardHide(flags: Int32)
case replyKeyboardMarkup(flags: Int32, rows: [Api.KeyboardButtonRow], placeholder: String?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .replyInlineMarkup(let rows):
if boxed {
buffer.appendInt32(1218642516)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(rows.count))
for item in rows {
item.serialize(buffer, true)
}
break
case .replyKeyboardForceReply(let flags, let placeholder):
if boxed {
buffer.appendInt32(-2035021048)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {serializeString(placeholder!, buffer: buffer, boxed: false)}
break
case .replyKeyboardHide(let flags):
if boxed {
buffer.appendInt32(-1606526075)
}
serializeInt32(flags, buffer: buffer, boxed: false)
break
case .replyKeyboardMarkup(let flags, let rows, let placeholder):
if boxed {
buffer.appendInt32(-2049074735)
}
serializeInt32(flags, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(rows.count))
for item in rows {
item.serialize(buffer, true)
}
if Int(flags) & Int(1 << 3) != 0 {serializeString(placeholder!, buffer: buffer, boxed: false)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .replyInlineMarkup(let rows):
return ("replyInlineMarkup", [("rows", rows as Any)])
case .replyKeyboardForceReply(let flags, let placeholder):
return ("replyKeyboardForceReply", [("flags", flags as Any), ("placeholder", placeholder as Any)])
case .replyKeyboardHide(let flags):
return ("replyKeyboardHide", [("flags", flags as Any)])
case .replyKeyboardMarkup(let flags, let rows, let placeholder):
return ("replyKeyboardMarkup", [("flags", flags as Any), ("rows", rows as Any), ("placeholder", placeholder as Any)])
}
}
public static func parse_replyInlineMarkup(_ reader: BufferReader) -> ReplyMarkup? {
var _1: [Api.KeyboardButtonRow]?
if let _ = reader.readInt32() {
_1 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButtonRow.self)
}
let _c1 = _1 != nil
if _c1 {
return Api.ReplyMarkup.replyInlineMarkup(rows: _1!)
}
else {
return nil
}
}
public static func parse_replyKeyboardForceReply(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
if Int(_1!) & Int(1 << 3) != 0 {_2 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
if _c1 && _c2 {
return Api.ReplyMarkup.replyKeyboardForceReply(flags: _1!, placeholder: _2)
}
else {
return nil
}
}
public static func parse_replyKeyboardHide(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return Api.ReplyMarkup.replyKeyboardHide(flags: _1!)
}
else {
return nil
}
}
public static func parse_replyKeyboardMarkup(_ reader: BufferReader) -> ReplyMarkup? {
var _1: Int32?
_1 = reader.readInt32()
var _2: [Api.KeyboardButtonRow]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.KeyboardButtonRow.self)
}
var _3: String?
if Int(_1!) & Int(1 << 3) != 0 {_3 = parseString(reader) }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 3) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.ReplyMarkup.replyKeyboardMarkup(flags: _1!, rows: _2!, placeholder: _3)
}
else {
return nil
}
}
}
}
public extension Api {
enum ReportReason: TypeConstructorDescription {
case inputReportReasonChildAbuse
case inputReportReasonCopyright
case inputReportReasonFake
case inputReportReasonGeoIrrelevant
case inputReportReasonIllegalDrugs
case inputReportReasonOther
case inputReportReasonPersonalDetails
case inputReportReasonPornography
case inputReportReasonSpam
case inputReportReasonViolence
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .inputReportReasonChildAbuse:
if boxed {
buffer.appendInt32(-1376497949)
}
break
case .inputReportReasonCopyright:
if boxed {
buffer.appendInt32(-1685456582)
}
break
case .inputReportReasonFake:
if boxed {
buffer.appendInt32(-170010905)
}
break
case .inputReportReasonGeoIrrelevant:
if boxed {
buffer.appendInt32(-606798099)
}
break
case .inputReportReasonIllegalDrugs:
if boxed {
buffer.appendInt32(177124030)
}
break
case .inputReportReasonOther:
if boxed {
buffer.appendInt32(-1041980751)
}
break
case .inputReportReasonPersonalDetails:
if boxed {
buffer.appendInt32(-1631091139)
}
break
case .inputReportReasonPornography:
if boxed {
buffer.appendInt32(777640226)
}
break
case .inputReportReasonSpam:
if boxed {
buffer.appendInt32(1490799288)
}
break
case .inputReportReasonViolence:
if boxed {
buffer.appendInt32(505595789)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .inputReportReasonChildAbuse:
return ("inputReportReasonChildAbuse", [])
case .inputReportReasonCopyright:
return ("inputReportReasonCopyright", [])
case .inputReportReasonFake:
return ("inputReportReasonFake", [])
case .inputReportReasonGeoIrrelevant:
return ("inputReportReasonGeoIrrelevant", [])
case .inputReportReasonIllegalDrugs:
return ("inputReportReasonIllegalDrugs", [])
case .inputReportReasonOther:
return ("inputReportReasonOther", [])
case .inputReportReasonPersonalDetails:
return ("inputReportReasonPersonalDetails", [])
case .inputReportReasonPornography:
return ("inputReportReasonPornography", [])
case .inputReportReasonSpam:
return ("inputReportReasonSpam", [])
case .inputReportReasonViolence:
return ("inputReportReasonViolence", [])
}
}
public static func parse_inputReportReasonChildAbuse(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonChildAbuse
}
public static func parse_inputReportReasonCopyright(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonCopyright
}
public static func parse_inputReportReasonFake(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonFake
}
public static func parse_inputReportReasonGeoIrrelevant(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonGeoIrrelevant
}
public static func parse_inputReportReasonIllegalDrugs(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonIllegalDrugs
}
public static func parse_inputReportReasonOther(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonOther
}
public static func parse_inputReportReasonPersonalDetails(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonPersonalDetails
}
public static func parse_inputReportReasonPornography(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonPornography
}
public static func parse_inputReportReasonSpam(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonSpam
}
public static func parse_inputReportReasonViolence(_ reader: BufferReader) -> ReportReason? {
return Api.ReportReason.inputReportReasonViolence
}
}
}
public extension Api {
enum ReportResult: TypeConstructorDescription {
case reportResultAddComment(flags: Int32, option: Buffer)
case reportResultChooseOption(title: String, options: [Api.MessageReportOption])
case reportResultReported
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .reportResultAddComment(let flags, let option):
if boxed {
buffer.appendInt32(1862904881)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeBytes(option, buffer: buffer, boxed: false)
break
case .reportResultChooseOption(let title, let options):
if boxed {
buffer.appendInt32(-253435722)
}
serializeString(title, buffer: buffer, boxed: false)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(options.count))
for item in options {
item.serialize(buffer, true)
}
break
case .reportResultReported:
if boxed {
buffer.appendInt32(-1917633461)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .reportResultAddComment(let flags, let option):
return ("reportResultAddComment", [("flags", flags as Any), ("option", option as Any)])
case .reportResultChooseOption(let title, let options):
return ("reportResultChooseOption", [("title", title as Any), ("options", options as Any)])
case .reportResultReported:
return ("reportResultReported", [])
}
}
public static func parse_reportResultAddComment(_ reader: BufferReader) -> ReportResult? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Buffer?
_2 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ReportResult.reportResultAddComment(flags: _1!, option: _2!)
}
else {
return nil
}
}
public static func parse_reportResultChooseOption(_ reader: BufferReader) -> ReportResult? {
var _1: String?
_1 = parseString(reader)
var _2: [Api.MessageReportOption]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.MessageReportOption.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return Api.ReportResult.reportResultChooseOption(title: _1!, options: _2!)
}
else {
return nil
}
}
public static func parse_reportResultReported(_ reader: BufferReader) -> ReportResult? {
return Api.ReportResult.reportResultReported
}
}
}
public extension Api {
enum RequestPeerType: TypeConstructorDescription {
case requestPeerTypeBroadcast(flags: Int32, hasUsername: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?)
case requestPeerTypeChat(flags: Int32, hasUsername: Api.Bool?, forum: Api.Bool?, userAdminRights: Api.ChatAdminRights?, botAdminRights: Api.ChatAdminRights?)
case requestPeerTypeUser(flags: Int32, bot: Api.Bool?, premium: Api.Bool?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .requestPeerTypeBroadcast(let flags, let hasUsername, let userAdminRights, let botAdminRights):
if boxed {
buffer.appendInt32(865857388)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {hasUsername!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {userAdminRights!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {botAdminRights!.serialize(buffer, true)}
break
case .requestPeerTypeChat(let flags, let hasUsername, let forum, let userAdminRights, let botAdminRights):
if boxed {
buffer.appendInt32(-906990053)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 3) != 0 {hasUsername!.serialize(buffer, true)}
if Int(flags) & Int(1 << 4) != 0 {forum!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {userAdminRights!.serialize(buffer, true)}
if Int(flags) & Int(1 << 2) != 0 {botAdminRights!.serialize(buffer, true)}
break
case .requestPeerTypeUser(let flags, let bot, let premium):
if boxed {
buffer.appendInt32(1597737472)
}
serializeInt32(flags, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {bot!.serialize(buffer, true)}
if Int(flags) & Int(1 << 1) != 0 {premium!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .requestPeerTypeBroadcast(let flags, let hasUsername, let userAdminRights, let botAdminRights):
return ("requestPeerTypeBroadcast", [("flags", flags as Any), ("hasUsername", hasUsername as Any), ("userAdminRights", userAdminRights as Any), ("botAdminRights", botAdminRights as Any)])
case .requestPeerTypeChat(let flags, let hasUsername, let forum, let userAdminRights, let botAdminRights):
return ("requestPeerTypeChat", [("flags", flags as Any), ("hasUsername", hasUsername as Any), ("forum", forum as Any), ("userAdminRights", userAdminRights as Any), ("botAdminRights", botAdminRights as Any)])
case .requestPeerTypeUser(let flags, let bot, let premium):
return ("requestPeerTypeUser", [("flags", flags as Any), ("bot", bot as Any), ("premium", premium as Any)])
}
}
public static func parse_requestPeerTypeBroadcast(_ reader: BufferReader) -> RequestPeerType? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Bool?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _3: Api.ChatAdminRights?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights
} }
var _4: Api.ChatAdminRights?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.RequestPeerType.requestPeerTypeBroadcast(flags: _1!, hasUsername: _2, userAdminRights: _3, botAdminRights: _4)
}
else {
return nil
}
}
public static func parse_requestPeerTypeChat(_ reader: BufferReader) -> RequestPeerType? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Bool?
if Int(_1!) & Int(1 << 3) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _3: Api.Bool?
if Int(_1!) & Int(1 << 4) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _4: Api.ChatAdminRights?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights
} }
var _5: Api.ChatAdminRights?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.ChatAdminRights
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 3) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 4) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 1) == 0) || _4 != nil
let _c5 = (Int(_1!) & Int(1 << 2) == 0) || _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.RequestPeerType.requestPeerTypeChat(flags: _1!, hasUsername: _2, forum: _3, userAdminRights: _4, botAdminRights: _5)
}
else {
return nil
}
}
public static func parse_requestPeerTypeUser(_ reader: BufferReader) -> RequestPeerType? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Api.Bool?
if Int(_1!) & Int(1 << 0) != 0 {if let signature = reader.readInt32() {
_2 = Api.parse(reader, signature: signature) as? Api.Bool
} }
var _3: Api.Bool?
if Int(_1!) & Int(1 << 1) != 0 {if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.Bool
} }
let _c1 = _1 != nil
let _c2 = (Int(_1!) & Int(1 << 0) == 0) || _2 != nil
let _c3 = (Int(_1!) & Int(1 << 1) == 0) || _3 != nil
if _c1 && _c2 && _c3 {
return Api.RequestPeerType.requestPeerTypeUser(flags: _1!, bot: _2, premium: _3)
}
else {
return nil
}
}
}
}
public extension Api {
enum RequestedPeer: TypeConstructorDescription {
case requestedPeerChannel(flags: Int32, channelId: Int64, title: String?, username: String?, photo: Api.Photo?)
case requestedPeerChat(flags: Int32, chatId: Int64, title: String?, photo: Api.Photo?)
case requestedPeerUser(flags: Int32, userId: Int64, firstName: String?, lastName: String?, username: String?, photo: Api.Photo?)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .requestedPeerChannel(let flags, let channelId, let title, let username, let photo):
if boxed {
buffer.appendInt32(-1952185372)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(channelId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(username!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
break
case .requestedPeerChat(let flags, let chatId, let title, let photo):
if boxed {
buffer.appendInt32(1929860175)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(chatId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(title!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
break
case .requestedPeerUser(let flags, let userId, let firstName, let lastName, let username, let photo):
if boxed {
buffer.appendInt32(-701500310)
}
serializeInt32(flags, buffer: buffer, boxed: false)
serializeInt64(userId, buffer: buffer, boxed: false)
if Int(flags) & Int(1 << 0) != 0 {serializeString(firstName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 0) != 0 {serializeString(lastName!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 1) != 0 {serializeString(username!, buffer: buffer, boxed: false)}
if Int(flags) & Int(1 << 2) != 0 {photo!.serialize(buffer, true)}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .requestedPeerChannel(let flags, let channelId, let title, let username, let photo):
return ("requestedPeerChannel", [("flags", flags as Any), ("channelId", channelId as Any), ("title", title as Any), ("username", username as Any), ("photo", photo as Any)])
case .requestedPeerChat(let flags, let chatId, let title, let photo):
return ("requestedPeerChat", [("flags", flags as Any), ("chatId", chatId as Any), ("title", title as Any), ("photo", photo as Any)])
case .requestedPeerUser(let flags, let userId, let firstName, let lastName, let username, let photo):
return ("requestedPeerUser", [("flags", flags as Any), ("userId", userId as Any), ("firstName", firstName as Any), ("lastName", lastName as Any), ("username", username as Any), ("photo", photo as Any)])
}
}
public static func parse_requestedPeerChannel(_ reader: BufferReader) -> RequestedPeer? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: String?
if Int(_1!) & Int(1 << 1) != 0 {_4 = parseString(reader) }
var _5: Api.Photo?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_5 = Api.parse(reader, signature: signature) as? Api.Photo
} }
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
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.RequestedPeer.requestedPeerChannel(flags: _1!, channelId: _2!, title: _3, username: _4, photo: _5)
}
else {
return nil
}
}
public static func parse_requestedPeerChat(_ reader: BufferReader) -> RequestedPeer? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: Api.Photo?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_4 = Api.parse(reader, signature: signature) as? Api.Photo
} }
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = (Int(_1!) & Int(1 << 0) == 0) || _3 != nil
let _c4 = (Int(_1!) & Int(1 << 2) == 0) || _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return Api.RequestedPeer.requestedPeerChat(flags: _1!, chatId: _2!, title: _3, photo: _4)
}
else {
return nil
}
}
public static func parse_requestedPeerUser(_ reader: BufferReader) -> RequestedPeer? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int64?
_2 = reader.readInt64()
var _3: String?
if Int(_1!) & Int(1 << 0) != 0 {_3 = parseString(reader) }
var _4: String?
if Int(_1!) & Int(1 << 0) != 0 {_4 = parseString(reader) }
var _5: String?
if Int(_1!) & Int(1 << 1) != 0 {_5 = parseString(reader) }
var _6: Api.Photo?
if Int(_1!) & Int(1 << 2) != 0 {if let signature = reader.readInt32() {
_6 = Api.parse(reader, signature: signature) as? Api.Photo
} }
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 << 1) == 0) || _5 != nil
let _c6 = (Int(_1!) & Int(1 << 2) == 0) || _6 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 {
return Api.RequestedPeer.requestedPeerUser(flags: _1!, userId: _2!, firstName: _3, lastName: _4, username: _5, photo: _6)
}
else {
return nil
}
}
}
}
public extension Api {
enum RequirementToContact: TypeConstructorDescription {
case requirementToContactEmpty
case requirementToContactPaidMessages(starsAmount: Int64)
case requirementToContactPremium
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .requirementToContactEmpty:
if boxed {
buffer.appendInt32(84580409)
}
break
case .requirementToContactPaidMessages(let starsAmount):
if boxed {
buffer.appendInt32(-1258914157)
}
serializeInt64(starsAmount, buffer: buffer, boxed: false)
break
case .requirementToContactPremium:
if boxed {
buffer.appendInt32(-444472087)
}
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .requirementToContactEmpty:
return ("requirementToContactEmpty", [])
case .requirementToContactPaidMessages(let starsAmount):
return ("requirementToContactPaidMessages", [("starsAmount", starsAmount as Any)])
case .requirementToContactPremium:
return ("requirementToContactPremium", [])
}
}
public static func parse_requirementToContactEmpty(_ reader: BufferReader) -> RequirementToContact? {
return Api.RequirementToContact.requirementToContactEmpty
}
public static func parse_requirementToContactPaidMessages(_ reader: BufferReader) -> RequirementToContact? {
var _1: Int64?
_1 = reader.readInt64()
let _c1 = _1 != nil
if _c1 {
return Api.RequirementToContact.requirementToContactPaidMessages(starsAmount: _1!)
}
else {
return nil
}
}
public static func parse_requirementToContactPremium(_ reader: BufferReader) -> RequirementToContact? {
return Api.RequirementToContact.requirementToContactPremium
}
}
}
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
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
+391
View File
@@ -0,0 +1,391 @@
import Foundation
public struct Int128 {
public var _0: Int64
public var _1: Int64
public init(_0: Int64, _1: Int64) {
self._0 = _0
self._1 = _1
}
}
public struct Int256: Equatable, CustomStringConvertible {
public var _0: Int64
public var _1: Int64
public var _2: Int64
public var _3: Int64
public init(_0: Int64, _1: Int64, _2: Int64, _3: Int64) {
self._0 = _0
self._1 = _1
self._2 = _2
self._3 = _3
}
public var description: String {
var data = Data(count: 32)
data.withUnsafeMutableBytes { buffer in
if let baseAddress = buffer.baseAddress {
let int64Buffer = baseAddress.assumingMemoryBound(to: Int64.self)
int64Buffer[0] = self._0
int64Buffer[1] = self._1
int64Buffer[2] = self._2
int64Buffer[3] = self._3
}
}
let hexString = NSMutableString()
data.withUnsafeBytes { rawBytes -> Void in
let bytes = rawBytes.baseAddress!.assumingMemoryBound(to: UInt8.self)
for i in 0 ..< data.count {
hexString.appendFormat("%02x", UInt(bytes.advanced(by: i).pointee))
}
}
return hexString as String
}
}
func serializeInt32(_ value: Int32, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(-1471112230)
}
buffer.appendInt32(value)
}
func serializeInt64(_ value: Int64, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(570911930)
}
buffer.appendInt64(value)
}
func serializeDouble(_ value: Double, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(571523412)
}
buffer.appendDouble(value)
}
func serializeString(_ value: String, buffer: Buffer, boxed: Bool) {
let stringBuffer = Buffer()
let data = value.data(using: .utf8, allowLossyConversion: true) ?? Data()
data.withUnsafeBytes { bytes in
stringBuffer.appendBytes(bytes.baseAddress!, length: UInt(bytes.count))
}
serializeBytes(stringBuffer, buffer: buffer, boxed: boxed)
}
public func serializeBytes(_ value: Buffer, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(-1255641564)
}
var length: Int32 = Int32(value.size)
var padding: Int32 = 0
if (length >= 254)
{
var tmp: UInt8 = 254
buffer.appendBytes(&tmp, length: 1)
buffer.appendBytes(&length, length: 3)
padding = (((length % 4) == 0 ? length : (length + 4 - (length % 4)))) - length;
}
else
{
buffer.appendBytes(&length, length: 1)
let e1 = (((length + 1) % 4) == 0 ? (length + 1) : ((length + 1) + 4 - ((length + 1) % 4)))
padding = (e1) - (length + 1)
}
if value.size != 0 {
buffer.appendBytes(value.data!, length: UInt(length))
}
var i: Int32 = 0
var tmp: UInt8 = 0
while i < padding {
buffer.appendBytes(&tmp, length: 1)
i += 1
}
}
func serializeInt128(_ value: Int128, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(1270167083)
}
buffer.appendInt64(value._0)
buffer.appendInt64(value._1)
}
func serializeInt256(_ value: Int256, buffer: Buffer, boxed: Bool) {
if boxed {
buffer.appendInt32(153731887)
}
buffer.appendInt64(value._0)
buffer.appendInt64(value._1)
buffer.appendInt64(value._2)
buffer.appendInt64(value._3)
}
func parseInt128(_ reader: BufferReader) -> Int128? {
let _0 = reader.readInt64()
let _1 = reader.readInt64()
if _0 != nil && _1 != nil {
return Int128(_0: _0!, _1: _1!)
}
return nil
}
func parseInt256(_ reader: BufferReader) -> Int256? {
let _0 = reader.readInt64()
let _1 = reader.readInt64()
let _2 = reader.readInt64()
let _3 = reader.readInt64()
if _0 != nil && _1 != nil && _2 != nil && _3 != nil {
return Int256(_0: _0!, _1: _1!, _2: _2!, _3: _3!)
}
return nil
}
private func roundUp(_ numToRound: Int, multiple: Int) -> Int
{
if multiple == 0 {
return numToRound
}
let remainder = numToRound % multiple
if remainder == 0 {
return numToRound;
}
return numToRound + multiple - remainder
}
public func parseBytes(_ reader: BufferReader) -> Buffer? {
if let tmp = reader.readBytesAsInt32(1) {
var paddingBytes: Int = 0
var length: Int = 0
if tmp == 254 {
if let len = reader.readBytesAsInt32(3) {
length = Int(len)
paddingBytes = roundUp(length, multiple: 4) - length
}
else {
return nil
}
}
else {
length = Int(tmp)
paddingBytes = roundUp(length + 1, multiple: 4) - (length + 1)
}
let buffer = reader.readBuffer(length)
reader.skip(paddingBytes)
return buffer
}
return nil
}
func parseString(_ reader: BufferReader) -> String? {
if let buffer = parseBytes(reader) {
return String(data: buffer.makeData(), encoding: .utf8) ?? ""
}
return nil
}
public class Buffer: CustomStringConvertible {
public var data: UnsafeMutableRawPointer?
public var _size: UInt = 0
private var capacity: UInt = 0
private let freeWhenDone: Bool
public var size: Int {
return Int(self._size)
}
deinit {
if self.freeWhenDone {
free(self.data)
}
}
public init(memory: UnsafeMutableRawPointer?, size: Int, capacity: Int, freeWhenDone: Bool) {
self.data = memory
self._size = UInt(size)
self.capacity = UInt(capacity)
self.freeWhenDone = freeWhenDone
}
public init() {
self.data = nil
self._size = 0
self.capacity = 0
self.freeWhenDone = true
}
convenience public init(data: Data?) {
self.init()
if let data = data {
data.withUnsafeBytes { bytes in
self.appendBytes(bytes.baseAddress!, length: UInt(bytes.count))
}
}
}
public func makeData() -> Data {
return self.withUnsafeMutablePointer { pointer, size -> Data in
if let pointer = pointer {
return Data(bytes: pointer.assumingMemoryBound(to: UInt8.self), count: Int(size))
} else {
return Data()
}
}
}
public var description: String {
get {
var string = ""
if let data = self.data {
var i: UInt = 0
let bytes = data.assumingMemoryBound(to: UInt8.self)
while i < _size && i < 8 {
string += String(format: "%02x", Int(bytes.advanced(by: Int(i)).pointee))
i += 1
}
if i < _size {
string += "...\(_size)b"
}
} else {
string += "<null>"
}
return string
}
}
public func appendBytes(_ bytes: UnsafeRawPointer, length: UInt) {
if self.capacity < self._size + length {
self.capacity = self._size + length + 128
if self.data == nil {
self.data = malloc(Int(self.capacity))!
}
else {
self.data = realloc(self.data, Int(self.capacity))!
}
}
memcpy(self.data?.advanced(by: Int(self._size)), bytes, Int(length))
self._size += length
}
public func appendBuffer(_ buffer: Buffer) {
if self.capacity < self._size + buffer._size {
self.capacity = self._size + buffer._size + 128
if self.data == nil {
self.data = malloc(Int(self.capacity))!
}
else {
self.data = realloc(self.data, Int(self.capacity))!
}
}
memcpy(self.data?.advanced(by: Int(self._size)), buffer.data, Int(buffer._size))
}
public func appendInt32(_ value: Int32) {
var v = value
self.appendBytes(&v, length: 4)
}
public func appendInt64(_ value: Int64) {
var v = value
self.appendBytes(&v, length: 8)
}
public func appendDouble(_ value: Double) {
var v = value
self.appendBytes(&v, length: 8)
}
public func withUnsafeMutablePointer<R>(_ f: (UnsafeMutableRawPointer?, UInt) -> R) -> R {
return f(self.data, self._size)
}
}
public class BufferReader {
private let buffer: Buffer
public private(set) var offset: UInt = 0
public init(_ buffer: Buffer) {
self.buffer = buffer
}
public func reset() {
self.offset = 0
}
public func skip(_ count: Int) {
self.offset = min(self.buffer._size, self.offset + UInt(count))
}
public func readInt32() -> Int32? {
if self.offset + 4 <= self.buffer._size {
let value: Int32 = buffer.data!.advanced(by: Int(self.offset)).assumingMemoryBound(to: Int32.self).pointee
self.offset += 4
return value
}
return nil
}
public func readInt64() -> Int64? {
if self.offset + 8 <= self.buffer._size {
let value: Int64 = buffer.data!.advanced(by: Int(self.offset)).assumingMemoryBound(to: Int64.self).pointee
self.offset += 8
return value
}
return nil
}
public func readDouble() -> Double? {
if self.offset + 8 <= self.buffer._size {
let value: Double = buffer.data!.advanced(by: Int(self.offset)).assumingMemoryBound(to: Double.self).pointee
self.offset += 8
return value
}
return nil
}
public func readBytesAsInt32(_ count: Int) -> Int32? {
if count == 0 {
return 0
}
else if count > 0 && count <= 4 || self.offset + UInt(count) <= self.buffer._size {
var value: Int32 = 0
memcpy(&value, self.buffer.data?.advanced(by: Int(self.offset)), count)
self.offset += UInt(count)
return value
}
return nil
}
public func readBuffer(_ count: Int) -> Buffer? {
if count >= 0 && self.offset + UInt(count) <= self.buffer._size {
let buffer = Buffer()
buffer.appendBytes((self.buffer.data?.advanced(by: Int(self.offset)))!, length: UInt(count))
self.offset += UInt(count)
return buffer
}
return nil
}
public func withReadBufferNoCopy<T>(_ count: Int, _ f: (Buffer) -> T) -> T? {
if count >= 0 && self.offset + UInt(count) <= self.buffer._size {
return f(Buffer(memory: self.buffer.data!.advanced(by: Int(self.offset)), size: count, capacity: count, freeWhenDone: false))
}
return nil
}
}
@@ -0,0 +1,27 @@
import Foundation
public final class FunctionDescription {
public let name: String
public let parameters: [(String, Any)]
init(name: String, parameters: [(String, Any)]) {
self.name = name
self.parameters = parameters
}
}
public final class DeserializeFunctionResponse<T> {
private let f: (Buffer) -> T?
public init(_ f: @escaping (Buffer) -> T?) {
self.f = f
}
public func parse(_ buffer: Buffer) -> T? {
return self.f(buffer)
}
}
public protocol TypeConstructorDescription {
func descriptionFields() -> (String, [(String, Any)])
}
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
@@ -0,0 +1,531 @@
fileprivate let parsers: [Int32 : (BufferReader) -> Any?] = {
var dict: [Int32 : (BufferReader) -> Any?] = [:]
dict[-1471112230] = { return $0.readInt32() }
dict[570911930] = { return $0.readInt64() }
dict[571523412] = { return $0.readDouble() }
dict[-1255641564] = { return parseString($0) }
dict[528568095] = { return SecretApi8.DecryptedMessage.parse_decryptedMessage($0) }
dict[-1438109059] = { return SecretApi8.DecryptedMessage.parse_decryptedMessageService($0) }
dict[144661578] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaEmpty($0) }
dict[846826124] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaPhoto($0) }
dict[1290694387] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaVideo($0) }
dict[893913689] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaGeoPoint($0) }
dict[1485441687] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaContact($0) }
dict[-1332395189] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaDocument($0) }
dict[1619031439] = { return SecretApi8.DecryptedMessageMedia.parse_decryptedMessageMediaAudio($0) }
dict[-1586283796] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionSetMessageTTL($0) }
dict[206520510] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionReadMessages($0) }
dict[1700872964] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionDeleteMessages($0) }
dict[-1967000459] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionScreenshotMessages($0) }
dict[1729750108] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionFlushHistory($0) }
dict[-217806717] = { return SecretApi8.DecryptedMessageAction.parse_decryptedMessageActionNotifyLayer($0) }
return dict
}()
public struct SecretApi8 {
public static func parse(_ buffer: Buffer) -> Any? {
let reader = BufferReader(buffer)
if let signature = reader.readInt32() {
return parse(reader, signature: signature)
}
return nil
}
fileprivate static func parse(_ reader: BufferReader, signature: Int32) -> Any? {
if let parser = parsers[signature] {
return parser(reader)
}
else {
telegramApiLog("Type constructor \(String(signature, radix: 16, uppercase: false)) not found")
return nil
}
}
fileprivate static func parseVector<T>(_ reader: BufferReader, elementSignature: Int32, elementType: T.Type) -> [T]? {
if let count = reader.readInt32() {
var array = [T]()
var i: Int32 = 0
while i < count {
var signature = elementSignature
if elementSignature == 0 {
if let unboxedSignature = reader.readInt32() {
signature = unboxedSignature
}
else {
return nil
}
}
if let item = SecretApi8.parse(reader, signature: signature) as? T {
array.append(item)
}
else {
return nil
}
i += 1
}
return array
}
return nil
}
public static func serializeObject(_ object: Any, buffer: Buffer, boxed: Swift.Bool) {
switch object {
case let _1 as SecretApi8.DecryptedMessage:
_1.serialize(buffer, boxed)
case let _1 as SecretApi8.DecryptedMessageMedia:
_1.serialize(buffer, boxed)
case let _1 as SecretApi8.DecryptedMessageAction:
_1.serialize(buffer, boxed)
default:
break
}
}
public enum DecryptedMessage {
case decryptedMessage(randomId: Int64, randomBytes: Buffer, message: String, media: SecretApi8.DecryptedMessageMedia)
case decryptedMessageService(randomId: Int64, randomBytes: Buffer, action: SecretApi8.DecryptedMessageAction)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .decryptedMessage(let randomId, let randomBytes, let message, let media):
if boxed {
buffer.appendInt32(528568095)
}
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeBytes(randomBytes, buffer: buffer, boxed: false)
serializeString(message, buffer: buffer, boxed: false)
media.serialize(buffer, true)
break
case .decryptedMessageService(let randomId, let randomBytes, let action):
if boxed {
buffer.appendInt32(-1438109059)
}
serializeInt64(randomId, buffer: buffer, boxed: false)
serializeBytes(randomBytes, buffer: buffer, boxed: false)
action.serialize(buffer, true)
break
}
}
fileprivate static func parse_decryptedMessage(_ reader: BufferReader) -> DecryptedMessage? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: String?
_3 = parseString(reader)
var _4: SecretApi8.DecryptedMessageMedia?
if let signature = reader.readInt32() {
_4 = SecretApi8.parse(reader, signature: signature) as? SecretApi8.DecryptedMessageMedia
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return SecretApi8.DecryptedMessage.decryptedMessage(randomId: _1!, randomBytes: _2!, message: _3!, media: _4!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageService(_ reader: BufferReader) -> DecryptedMessage? {
var _1: Int64?
_1 = reader.readInt64()
var _2: Buffer?
_2 = parseBytes(reader)
var _3: SecretApi8.DecryptedMessageAction?
if let signature = reader.readInt32() {
_3 = SecretApi8.parse(reader, signature: signature) as? SecretApi8.DecryptedMessageAction
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return SecretApi8.DecryptedMessage.decryptedMessageService(randomId: _1!, randomBytes: _2!, action: _3!)
}
else {
return nil
}
}
}
public enum DecryptedMessageMedia {
case decryptedMessageMediaEmpty
case decryptedMessageMediaPhoto(thumb: Buffer, thumbW: Int32, thumbH: Int32, w: Int32, h: Int32, size: Int32, key: Buffer, iv: Buffer)
case decryptedMessageMediaVideo(thumb: Buffer, thumbW: Int32, thumbH: Int32, duration: Int32, w: Int32, h: Int32, size: Int32, key: Buffer, iv: Buffer)
case decryptedMessageMediaGeoPoint(lat: Double, long: Double)
case decryptedMessageMediaContact(phoneNumber: String, firstName: String, lastName: String, userId: Int32)
case decryptedMessageMediaDocument(thumb: Buffer, thumbW: Int32, thumbH: Int32, fileName: String, mimeType: String, size: Int32, key: Buffer, iv: Buffer)
case decryptedMessageMediaAudio(duration: Int32, size: Int32, key: Buffer, iv: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .decryptedMessageMediaEmpty:
if boxed {
buffer.appendInt32(144661578)
}
break
case .decryptedMessageMediaPhoto(let thumb, let thumbW, let thumbH, let w, let h, let size, let key, let iv):
if boxed {
buffer.appendInt32(846826124)
}
serializeBytes(thumb, buffer: buffer, boxed: false)
serializeInt32(thumbW, buffer: buffer, boxed: false)
serializeInt32(thumbH, buffer: buffer, boxed: false)
serializeInt32(w, buffer: buffer, boxed: false)
serializeInt32(h, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeBytes(key, buffer: buffer, boxed: false)
serializeBytes(iv, buffer: buffer, boxed: false)
break
case .decryptedMessageMediaVideo(let thumb, let thumbW, let thumbH, let duration, let w, let h, let size, let key, let iv):
if boxed {
buffer.appendInt32(1290694387)
}
serializeBytes(thumb, buffer: buffer, boxed: false)
serializeInt32(thumbW, buffer: buffer, boxed: false)
serializeInt32(thumbH, buffer: buffer, boxed: false)
serializeInt32(duration, buffer: buffer, boxed: false)
serializeInt32(w, buffer: buffer, boxed: false)
serializeInt32(h, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeBytes(key, buffer: buffer, boxed: false)
serializeBytes(iv, buffer: buffer, boxed: false)
break
case .decryptedMessageMediaGeoPoint(let lat, let long):
if boxed {
buffer.appendInt32(893913689)
}
serializeDouble(lat, buffer: buffer, boxed: false)
serializeDouble(long, buffer: buffer, boxed: false)
break
case .decryptedMessageMediaContact(let phoneNumber, let firstName, let lastName, let userId):
if boxed {
buffer.appendInt32(1485441687)
}
serializeString(phoneNumber, buffer: buffer, boxed: false)
serializeString(firstName, buffer: buffer, boxed: false)
serializeString(lastName, buffer: buffer, boxed: false)
serializeInt32(userId, buffer: buffer, boxed: false)
break
case .decryptedMessageMediaDocument(let thumb, let thumbW, let thumbH, let fileName, let mimeType, let size, let key, let iv):
if boxed {
buffer.appendInt32(-1332395189)
}
serializeBytes(thumb, buffer: buffer, boxed: false)
serializeInt32(thumbW, buffer: buffer, boxed: false)
serializeInt32(thumbH, buffer: buffer, boxed: false)
serializeString(fileName, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeBytes(key, buffer: buffer, boxed: false)
serializeBytes(iv, buffer: buffer, boxed: false)
break
case .decryptedMessageMediaAudio(let duration, let size, let key, let iv):
if boxed {
buffer.appendInt32(1619031439)
}
serializeInt32(duration, buffer: buffer, boxed: false)
serializeInt32(size, buffer: buffer, boxed: false)
serializeBytes(key, buffer: buffer, boxed: false)
serializeBytes(iv, buffer: buffer, boxed: false)
break
}
}
fileprivate static func parse_decryptedMessageMediaEmpty(_ reader: BufferReader) -> DecryptedMessageMedia? {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaEmpty
}
fileprivate static func parse_decryptedMessageMediaPhoto(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
_6 = reader.readInt32()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Buffer?
_8 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaPhoto(thumb: _1!, thumbW: _2!, thumbH: _3!, w: _4!, h: _5!, size: _6!, key: _7!, iv: _8!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageMediaVideo(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: Int32?
_4 = reader.readInt32()
var _5: Int32?
_5 = reader.readInt32()
var _6: Int32?
_6 = reader.readInt32()
var _7: Int32?
_7 = reader.readInt32()
var _8: Buffer?
_8 = parseBytes(reader)
var _9: Buffer?
_9 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
let _c9 = _9 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 && _c9 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaVideo(thumb: _1!, thumbW: _2!, thumbH: _3!, duration: _4!, w: _5!, h: _6!, size: _7!, key: _8!, iv: _9!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageMediaGeoPoint(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: Double?
_1 = reader.readDouble()
var _2: Double?
_2 = reader.readDouble()
let _c1 = _1 != nil
let _c2 = _2 != nil
if _c1 && _c2 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaGeoPoint(lat: _1!, long: _2!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageMediaContact(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: String?
_1 = parseString(reader)
var _2: String?
_2 = parseString(reader)
var _3: String?
_3 = parseString(reader)
var _4: Int32?
_4 = reader.readInt32()
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaContact(phoneNumber: _1!, firstName: _2!, lastName: _3!, userId: _4!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageMediaDocument(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: Buffer?
_1 = parseBytes(reader)
var _2: Int32?
_2 = reader.readInt32()
var _3: Int32?
_3 = reader.readInt32()
var _4: String?
_4 = parseString(reader)
var _5: String?
_5 = parseString(reader)
var _6: Int32?
_6 = reader.readInt32()
var _7: Buffer?
_7 = parseBytes(reader)
var _8: Buffer?
_8 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
let _c6 = _6 != nil
let _c7 = _7 != nil
let _c8 = _8 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 && _c6 && _c7 && _c8 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaDocument(thumb: _1!, thumbW: _2!, thumbH: _3!, fileName: _4!, mimeType: _5!, size: _6!, key: _7!, iv: _8!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageMediaAudio(_ reader: BufferReader) -> DecryptedMessageMedia? {
var _1: Int32?
_1 = reader.readInt32()
var _2: Int32?
_2 = reader.readInt32()
var _3: Buffer?
_3 = parseBytes(reader)
var _4: Buffer?
_4 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
if _c1 && _c2 && _c3 && _c4 {
return SecretApi8.DecryptedMessageMedia.decryptedMessageMediaAudio(duration: _1!, size: _2!, key: _3!, iv: _4!)
}
else {
return nil
}
}
}
public enum DecryptedMessageAction {
case decryptedMessageActionSetMessageTTL(ttlSeconds: Int32)
case decryptedMessageActionReadMessages(randomIds: [Int64])
case decryptedMessageActionDeleteMessages(randomIds: [Int64])
case decryptedMessageActionScreenshotMessages(randomIds: [Int64])
case decryptedMessageActionFlushHistory
case decryptedMessageActionNotifyLayer(layer: Int32)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .decryptedMessageActionSetMessageTTL(let ttlSeconds):
if boxed {
buffer.appendInt32(-1586283796)
}
serializeInt32(ttlSeconds, buffer: buffer, boxed: false)
break
case .decryptedMessageActionReadMessages(let randomIds):
if boxed {
buffer.appendInt32(206520510)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(randomIds.count))
for item in randomIds {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .decryptedMessageActionDeleteMessages(let randomIds):
if boxed {
buffer.appendInt32(1700872964)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(randomIds.count))
for item in randomIds {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .decryptedMessageActionScreenshotMessages(let randomIds):
if boxed {
buffer.appendInt32(-1967000459)
}
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(randomIds.count))
for item in randomIds {
serializeInt64(item, buffer: buffer, boxed: false)
}
break
case .decryptedMessageActionFlushHistory:
if boxed {
buffer.appendInt32(1729750108)
}
break
case .decryptedMessageActionNotifyLayer(let layer):
if boxed {
buffer.appendInt32(-217806717)
}
serializeInt32(layer, buffer: buffer, boxed: false)
break
}
}
fileprivate static func parse_decryptedMessageActionSetMessageTTL(_ reader: BufferReader) -> DecryptedMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionSetMessageTTL(ttlSeconds: _1!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageActionReadMessages(_ reader: BufferReader) -> DecryptedMessageAction? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = SecretApi8.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionReadMessages(randomIds: _1!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageActionDeleteMessages(_ reader: BufferReader) -> DecryptedMessageAction? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = SecretApi8.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionDeleteMessages(randomIds: _1!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageActionScreenshotMessages(_ reader: BufferReader) -> DecryptedMessageAction? {
var _1: [Int64]?
if let _ = reader.readInt32() {
_1 = SecretApi8.parseVector(reader, elementSignature: 570911930, elementType: Int64.self)
}
let _c1 = _1 != nil
if _c1 {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionScreenshotMessages(randomIds: _1!)
}
else {
return nil
}
}
fileprivate static func parse_decryptedMessageActionFlushHistory(_ reader: BufferReader) -> DecryptedMessageAction? {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionFlushHistory
}
fileprivate static func parse_decryptedMessageActionNotifyLayer(_ reader: BufferReader) -> DecryptedMessageAction? {
var _1: Int32?
_1 = reader.readInt32()
let _c1 = _1 != nil
if _c1 {
return SecretApi8.DecryptedMessageAction.decryptedMessageActionNotifyLayer(layer: _1!)
}
else {
return nil
}
}
}
public struct functions {
}
}
@@ -0,0 +1,19 @@
//
// TelegramApi.h
// TelegramApi
//
// Created by Peter on 6/16/19.
// Copyright © 2019 Telegram LLP. All rights reserved.
//
#import <UIKit/UIKit.h>
//! Project version number for TelegramApi.
FOUNDATION_EXPORT double TelegramApiVersionNumber;
//! Project version string for TelegramApi.
FOUNDATION_EXPORT const unsigned char TelegramApiVersionString[];
// In this header, you should import all the public headers of your framework using statements like #import <TelegramApi/PublicHeader.h>
@@ -0,0 +1,11 @@
import Foundation
private var telegramApiLogger: (String) -> Void = { _ in }
public func setTelegramApiLogger(_ f: @escaping (String) -> Void) {
telegramApiLogger = f
}
func telegramApiLog(_ what: @autoclosure () -> String) {
telegramApiLogger(what())
}