2023-09-08 13:35:08 +04:00

113 lines
4.3 KiB
Swift

public extension Api.upload {
enum WebFile: TypeConstructorDescription {
case webFile(size: Int32, mimeType: String, fileType: Api.storage.FileType, mtime: Int32, bytes: Buffer)
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
if boxed {
buffer.appendInt32(568808380)
}
serializeInt32(size, buffer: buffer, boxed: false)
serializeString(mimeType, buffer: buffer, boxed: false)
fileType.serialize(buffer, true)
serializeInt32(mtime, buffer: buffer, boxed: false)
serializeBytes(bytes, buffer: buffer, boxed: false)
break
}
}
public func descriptionFields() -> (String, [(String, Any)]) {
switch self {
case .webFile(let size, let mimeType, let fileType, let mtime, let bytes):
return ("webFile", [("size", size as Any), ("mimeType", mimeType as Any), ("fileType", fileType as Any), ("mtime", mtime as Any), ("bytes", bytes as Any)])
}
}
public static func parse_webFile(_ reader: BufferReader) -> WebFile? {
var _1: Int32?
_1 = reader.readInt32()
var _2: String?
_2 = parseString(reader)
var _3: Api.storage.FileType?
if let signature = reader.readInt32() {
_3 = Api.parse(reader, signature: signature) as? Api.storage.FileType
}
var _4: Int32?
_4 = reader.readInt32()
var _5: Buffer?
_5 = parseBytes(reader)
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
let _c4 = _4 != nil
let _c5 = _5 != nil
if _c1 && _c2 && _c3 && _c4 && _c5 {
return Api.upload.WebFile.webFile(size: _1!, mimeType: _2!, fileType: _3!, mtime: _4!, bytes: _5!)
}
else {
return nil
}
}
}
}
public extension Api.users {
enum UserFull: TypeConstructorDescription {
case userFull(fullUser: Api.UserFull, chats: [Api.Chat], users: [Api.User])
public func serialize(_ buffer: Buffer, _ boxed: Swift.Bool) {
switch self {
case .userFull(let fullUser, let chats, let users):
if boxed {
buffer.appendInt32(997004590)
}
fullUser.serialize(buffer, true)
buffer.appendInt32(481674261)
buffer.appendInt32(Int32(chats.count))
for item in chats {
item.serialize(buffer, true)
}
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 .userFull(let fullUser, let chats, let users):
return ("userFull", [("fullUser", fullUser as Any), ("chats", chats as Any), ("users", users as Any)])
}
}
public static func parse_userFull(_ reader: BufferReader) -> UserFull? {
var _1: Api.UserFull?
if let signature = reader.readInt32() {
_1 = Api.parse(reader, signature: signature) as? Api.UserFull
}
var _2: [Api.Chat]?
if let _ = reader.readInt32() {
_2 = Api.parseVector(reader, elementSignature: 0, elementType: Api.Chat.self)
}
var _3: [Api.User]?
if let _ = reader.readInt32() {
_3 = Api.parseVector(reader, elementSignature: 0, elementType: Api.User.self)
}
let _c1 = _1 != nil
let _c2 = _2 != nil
let _c3 = _3 != nil
if _c1 && _c2 && _c3 {
return Api.users.UserFull.userFull(fullUser: _1!, chats: _2!, users: _3!)
}
else {
return nil
}
}
}
}