using System; namespace TL { /// Object describes the contents of an encrypted message. See public abstract class DecryptedMessageBase : IObject { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public abstract long RandomId { get; } } ///
Object describes media contents of an encrypted message. See /// a null value means decryptedMessageMediaEmpty public abstract class DecryptedMessageMedia : IObject { } /// Object describes the action to which a service message is linked. See public abstract class DecryptedMessageAction : IObject { } /// Indicates the location of a photo, will be deprecated soon See public abstract class FileLocationBase : IObject { /// Server volume public abstract long VolumeId { get; } /// File ID public abstract int LocalId { get; } /// Checksum to access the file public abstract long Secret { get; } } namespace Layer8 { /// Contents of an encrypted message. See [TLDef(0x1F814F1F)] public class DecryptedMessage : DecryptedMessageBase { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; public byte[] random_bytes; /// Message text public string message; /// Media content public DecryptedMessageMedia media; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } ///
Contents of an encrypted service message. See [TLDef(0xAA48327D)] public class DecryptedMessageService : DecryptedMessageBase { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; public byte[] random_bytes; /// Action relevant to the service message public DecryptedMessageAction action; /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public override long RandomId => random_id; } ///
Photo attached to an encrypted message. See [TLDef(0x32798A8C)] public class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// Photo width public int w; /// Photo height public int h; /// Size of the photo in bytes public int size; /// Key to decrypt an attached file with a full version public byte[] key; /// Initialization vector public byte[] iv; } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// Duration of video in seconds public int duration; /// Image width public int w; /// Image height public int h; /// File size public int size; /// Key to decrypt the attached video file public byte[] key; /// Initialization vector public byte[] iv; } /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] public class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { /// Latitude of point public double lat; /// Longitude of point public double lon; } /// Contact attached to an encrypted message. See [TLDef(0x588A0A97)] public class DecryptedMessageMediaContact : DecryptedMessageMedia { /// Phone number public string phone_number; /// Contact's first name public string first_name; /// Contact's last name public string last_name; /// Telegram User ID of signed-up contact public int user_id; } /// Document attached to a message in a secret chat. See [TLDef(0xB095434B)] public class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; public string file_name; /// File MIME-type public string mime_type; /// Document size ( on layer <143, on layer >=143) public int size; /// Key to decrypt the attached document file public byte[] key; /// Initialization public byte[] iv; } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] public class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; /// File size public int size; /// Key to decrypt the attached media file public byte[] key; /// Initialization vector public byte[] iv; } /// Setting of a message lifetime after reading. See [TLDef(0xA1733AEC)] public class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { /// Lifetime in seconds public int ttl_seconds; } /// Messages marked as read. See [TLDef(0x0C4F40BE)] public class DecryptedMessageActionReadMessages : DecryptedMessageAction { /// List of message IDs public long[] random_ids; } /// Deleted messages. See [TLDef(0x65614304)] public class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { /// List of deleted message IDs public long[] random_ids; } /// A screenshot was taken. See [TLDef(0x8AC1F475)] public class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { /// List of affected message ids (that appeared on the screenshot) public long[] random_ids; } /// The entire message history has been deleted. See [TLDef(0x6719E45C)] public class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } namespace Layer17 { /// User is uploading a video. See [TLDef(0x92042FF7)] public class SendMessageUploadVideoAction : SendMessageAction { } /// User is uploading a voice message. See [TLDef(0xE6AC8A6F)] public class SendMessageUploadAudioAction : SendMessageAction { } /// User is uploading a photo. See [TLDef(0x990A3C1A)] public class SendMessageUploadPhotoAction : SendMessageAction { } /// User is uploading a file. See [TLDef(0x8FAEE98E)] public class SendMessageUploadDocumentAction : SendMessageAction { } /// Contents of an encrypted message. See [TLDef(0x204D3878)] public class DecryptedMessage : DecryptedMessageBase { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; ///
Message lifetime. Has higher priority than .
Parameter added in
Layer 17.
public int ttl; /// Message text public string message; /// Media content public DecryptedMessageMedia media; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } /// Contents of an encrypted service message. See [TLDef(0x73164160)] public class DecryptedMessageService : DecryptedMessageBase { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; /// Action relevant to the service message public DecryptedMessageAction action; /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public override long RandomId => random_id; } ///
Video attached to an encrypted message. See [TLDef(0x524A415D)] public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// Duration of video in seconds public int duration; /// MIME-type of the video file
Parameter added in
Layer 17.
public string mime_type; /// Image width public int w; /// Image height public int h; /// File size public int size; /// Key to decrypt the attached video file public byte[] key; /// Initialization vector public byte[] iv; } /// Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] public class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; /// MIME-type of the audio file
Parameter added in
Layer 13.
public string mime_type; /// File size public int size; /// Key to decrypt the attached media file public byte[] key; /// Initialization vector public byte[] iv; } /// Request for the other party in a Secret Chat to automatically resend a contiguous range of previously sent messages, as explained in Sequence number is Secret Chats. See [TLDef(0x511110B0)] public class DecryptedMessageActionResend : DecryptedMessageAction { /// out_seq_no of the first message to be resent, with correct parity public int start_seq_no; /// out_seq_no of the last message to be resent, with same parity. public int end_seq_no; } /// A notification stating the API layer that is used by the client. You should use your current layer and take notice of the layer used on the other side of a conversation when sending messages. See [TLDef(0xF3048883)] public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { /// Layer number, must be 17 or higher (this constructor was introduced in Layer 17). public int layer; } /// User is preparing a message: typing, recording, uploading, etc. See [TLDef(0xCCB27641)] public class DecryptedMessageActionTyping : DecryptedMessageAction { /// Type of action public SendMessageAction action; } /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] public class DecryptedMessageLayer : IObject { /// Set of random bytes to prevent content recognition in short encrypted messages.
Clients are required to check that there are at least 15 random bytes included in each message. Messages with less than 15 random bytes must be ignored.
Parameter moved here from in
Layer 17.
public byte[] random_bytes; /// Layer number. Mimimal value - 17 (the layer in which the constructor was added). public int layer; /// 2x the number of messages in the sender's inbox (including deleted and service messages), incremented by 1 if current user was not the chat creator
Parameter added in Layer 17.
public int in_seq_no; /// 2x the number of messages in the recipient's inbox (including deleted and service messages), incremented by 1 if current user was the chat creator
Parameter added in Layer 17.
public int out_seq_no; /// The content of message itself public DecryptedMessageBase message; } } namespace Layer45 { /// Defines a sticker See [TLDef(0x3A556302)] public class DocumentAttributeSticker : DocumentAttribute { /// Alternative emoji representation of sticker public string alt; /// Associated stickerset public InputStickerSet stickerset; } /// Represents an audio file See [TLDef(0xDED218E0)] public class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; /// Name of song public string title; /// Performer public string performer; } /// Contents of an encrypted message. See [TLDef(0x36B091DE)] public class DecryptedMessage : DecryptedMessageBase { /// Flags, see TL conditional fields (added in layer 45) public Flags flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; /// Message text public string message; /// Media content [IfFlag(9)] public DecryptedMessageMedia media; /// Message entities for styled text (parameter added in layer 45) [IfFlag(7)] public MessageEntity[] entities; /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) [IfFlag(11)] public string via_bot_name; /// Random message ID of the message this message replies to (parameter added in layer 45) [IfFlag(3)] public long reply_to_random_id; [Flags] public enum Flags : uint { /// Field has a value has_reply_to_random_id = 0x8, /// Field has a value has_entities = 0x80, /// Field has a value has_media = 0x200, /// Field has a value has_via_bot_name = 0x800, } /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } /// Photo attached to an encrypted message. See [TLDef(0xF1FA8D78)] public class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// Photo width public int w; /// Photo height public int h; /// Size of the photo in bytes public int size; /// Key to decrypt an attached file with a full version public byte[] key; /// Initialization vector public byte[] iv; /// Caption public string caption; } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] public class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// Duration of video in seconds public int duration; /// MIME-type of the video file
Parameter added in
Layer 17.
public string mime_type; /// Image width public int w; /// Image height public int h; /// File size public int size; /// Key to decrypt the attached video file public byte[] key; /// Initialization vector public byte[] iv; /// Caption public string caption; } /// Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] public class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; /// Thumbnail width public int thumb_w; /// Thumbnail height public int thumb_h; /// File MIME-type public string mime_type; /// Document size ( on layer <143, on layer >=143) public int size; /// Key to decrypt the attached document file public byte[] key; /// Initialization public byte[] iv; /// Document attributes for media types public DocumentAttribute[] attributes; /// Caption public string caption; } /// Venue See [TLDef(0x8A0DF56F)] public class DecryptedMessageMediaVenue : DecryptedMessageMedia { /// Latitude of venue public double lat; /// Longitude of venue public double lon; /// Venue name public string title; /// Address public string address; /// Venue provider: currently only "foursquare" needs to be supported public string provider; /// Venue ID in the provider's database public string venue_id; } /// Webpage preview See [TLDef(0xE50511D8)] public class DecryptedMessageMediaWebPage : DecryptedMessageMedia { /// URL of webpage public string url; } } namespace Layer73 { /// Contents of an encrypted message. See [TLDef(0x91CC4674)] public class DecryptedMessage : DecryptedMessageBase { /// Flags, see TL conditional fields (added in layer 45) public Flags flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
public int ttl; /// Message text public string message; /// Media content [IfFlag(9)] public DecryptedMessageMedia media; /// Message entities for styled text (parameter added in layer 45) [IfFlag(7)] public MessageEntity[] entities; /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) [IfFlag(11)] public string via_bot_name; /// Random message ID of the message this message replies to (parameter added in layer 45) [IfFlag(3)] public long reply_to_random_id; /// Random group ID, assigned by the author of message.
Multiple encrypted messages with a photo attached and with the same group ID indicate an album or grouped media (parameter added in layer 45)
[IfFlag(17)] public long grouped_id; [Flags] public enum Flags : uint { /// Field has a value has_reply_to_random_id = 0x8, /// Field has a value has_entities = 0x80, /// Field has a value has_media = 0x200, /// Field has a value has_via_bot_name = 0x800, /// Field has a value has_grouped_id = 0x20000, } /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public override long RandomId => random_id; } } namespace Layer20 { /// Request rekeying, see rekeying process See [TLDef(0xF3C9611B)] public class DecryptedMessageActionRequestKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; /// g_a, see rekeying process public byte[] g_a; } /// Accept new key See [TLDef(0x6FE1735B)] public class DecryptedMessageActionAcceptKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; /// B parameter, see rekeying process public byte[] g_b; /// Key fingerprint, see rekeying process public long key_fingerprint; } /// Abort rekeying See [TLDef(0xDD05EC6B)] public class DecryptedMessageActionAbortKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; } /// Commit new key, see rekeying process See [TLDef(0xEC2E0B9B)] public class DecryptedMessageActionCommitKey : DecryptedMessageAction { /// Exchange ID, see rekeying process public long exchange_id; /// Key fingerprint, see rekeying process public long key_fingerprint; } /// NOOP action See [TLDef(0xA82FDD63)] public class DecryptedMessageActionNoop : DecryptedMessageAction { } } namespace Layer23 { /// Image description. See [TLDef(0x77BFB61B)] public partial class PhotoSize : PhotoSizeBase { /// Thumbnail type public string type; public FileLocationBase location; /// Image width public int w; /// Image height public int h; /// File size public int size; /// Thumbnail type public override string Type => type; } /// Description of an image and its content. See [TLDef(0xE9A734FA)] public partial class PhotoCachedSize : PhotoSizeBase { /// Thumbnail type public string type; public FileLocationBase location; /// Image width public int w; /// Image height public int h; /// Binary data, file content public byte[] bytes; /// Thumbnail type public override string Type => type; } /// Defines a sticker See [TLDef(0xFB0A5727)] public class DocumentAttributeSticker : DocumentAttribute { } /// Defines a video See [TLDef(0x5910CCCB)] public class DocumentAttributeVideo : DocumentAttribute { /// Duration in seconds public int duration; /// Video width public int w; /// Video height public int h; } /// Represents an audio file See [TLDef(0x051448E5)] public class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; } /// Non-e2e documented forwarded from non-secret chat See [TLDef(0xFA95B0DD)] public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia { /// Document ID public long id; /// access hash public long access_hash; /// Date public DateTime date; /// Mime type public string mime_type; /// Size public int size; /// Thumbnail public PhotoSizeBase thumb; /// DC ID public int dc_id; /// Attributes for media types public DocumentAttribute[] attributes; } /// File is currently unavailable. See [TLDef(0x7C596B46)] public class FileLocationUnavailable : FileLocationBase { /// Server volume public long volume_id; /// File ID public int local_id; /// Checksum to access the file public long secret; /// Server volume public override long VolumeId => volume_id; /// File ID public override int LocalId => local_id; /// Checksum to access the file public override long Secret => secret; } /// File location. See [TLDef(0x53D69076)] public class FileLocation : FileLocationBase { /// Number of the data center holding the file public int dc_id; /// Server volume public long volume_id; /// File ID public int local_id; /// Checksum to access the file public long secret; /// Server volume public override long VolumeId => volume_id; /// File ID public override int LocalId => local_id; /// Checksum to access the file public override long Secret => secret; } } namespace Layer66 { /// User is uploading a round video See [TLDef(0xBB718624)] public class SendMessageUploadRoundAction : SendMessageAction { } } namespace Layer46 { } }