Update API

This commit is contained in:
Ilya Laktyushin
2025-08-12 13:12:07 +04:00
parent b9e104bf2d
commit b83e7d81ee
20 changed files with 1210 additions and 563 deletions

View File

@@ -1,3 +1,123 @@
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