Make TL classes partial so we can extend them with helpers in Helpers.TL.cs

This commit is contained in:
Wizou 2021-08-10 03:12:33 +02:00
parent 9e7d85ec1d
commit 3d540cdb8f
7 changed files with 1266 additions and 1108 deletions

View file

@ -69,7 +69,7 @@ To find which derived classes are available for a given base class, the fastest
The Telegram [API object classes](https://core.telegram.org/schema) are defined in the `TL` namespace, and the [API functions](https://core.telegram.org/methods) are available as async methods of `Client`.
Below is an example of calling the [messages.getAllChats](https://core.telegram.org/method/messages.getAllChats) API function and enumerating the various groups/channels the user is in:
Below is an example of calling the [messages.getAllChats](https://core.telegram.org/method/messages.getAllChats) API function and enumerating the various groups/channels the user is in, and then using `client.SendMessageAsync` helper function to easily send a message:
```csharp
using TL;
...
@ -89,6 +89,10 @@ foreach (var chat in chats)
Console.WriteLine($"{group.id}: Group {group.username}: {group.title}");
break;
}
Console.Write("Type a chat ID to send a message: ");
var id = int.Parse(Console.ReadLine());
var target = chats.First(chat => chat.ID == id);
await client.SendMessageAsync(target, "Hello, World");
```
# Other things to know

View file

@ -11,8 +11,7 @@ namespace WTelegram
{
public class Generator
{
//TODO: generate BinaryReader/Writer serialization directly to avoid using Reflection
//TODO: generate partial class with methods for functions instead of exposing request classes
//TODO: generate BinaryReader/Writer serialization for objects too?
readonly Dictionary<int, string> ctorToTypes = new();
readonly HashSet<string> allTypes = new();
readonly Dictionary<int, Dictionary<string, TypeInfo>> typeInfosByLayer = new();
@ -24,13 +23,12 @@ namespace WTelegram
public async Task FromWeb()
{
Console.WriteLine("Fetch web pages...");
//using var http = new HttpClient();
//var html = await http.GetStringAsync("https://core.telegram.org/api/layers");
var html = await Task.FromResult("#layer-121");
using var http = new HttpClient();
var html = await http.GetStringAsync("https://core.telegram.org/api/layers");
currentLayer = int.Parse(Regex.Match(html, @"#layer-(\d+)").Groups[1].Value);
//await File.WriteAllBytesAsync("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json"));
//await File.WriteAllBytesAsync("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json"));
//await File.WriteAllBytesAsync("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json"));
await File.WriteAllBytesAsync("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json"));
await File.WriteAllBytesAsync("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json"));
await File.WriteAllBytesAsync("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json"));
FromJson("TL.MTProto.json", "TL.MTProto.cs", @"TL.Table.cs", true);
FromJson("TL.Schema.json", "TL.Schema.cs", @"TL.Table.cs");
FromJson("TL.Secret.json", "TL.Secret.cs", @"TL.Table.cs");
@ -187,7 +185,7 @@ namespace WTelegram
{
needNewLine = false;
sw.WriteLine();
sw.WriteLine($"{tabIndent}public abstract class {parentClass} : ITLObject {{ }}");
sw.WriteLine($"{tabIndent}public abstract partial class {parentClass} : ITLObject {{ }}");
}
int skipParams = 0;
foreach (var ctor in typeInfo.Structs)
@ -198,14 +196,14 @@ namespace WTelegram
if (!allTypes.Add(layerPrefix + className)) continue;
if (needNewLine) { needNewLine = false; sw.WriteLine(); }
if (ctor.id == null)
sw.Write($"{tabIndent}public abstract class {className} : ITLObject");
sw.Write($"{tabIndent}public abstract partial class {className} : ITLObject");
else
{
sw.Write($"{tabIndent}[TLDef(0x{ctor.ID:X8})] //{ctor.predicate}#{ctor.ID:x8} ");
if (genericType != null) sw.Write($"{{{typeInfo.ReturnName}:Type}} ");
foreach (var parm in ctor.@params) sw.Write($"{parm.name}:{parm.type} ");
sw.WriteLine($"= {ctor.type}");
sw.Write($"{tabIndent}public class {className} : ");
sw.Write($"{tabIndent}public partial class {className} : ");
sw.Write(skipParams == 0 && typeInfo.NeedAbstract > 0 ? "ITLObject" : parentClass);
}
var parms = ctor.@params.Skip(skipParams).ToArray();
@ -269,8 +267,6 @@ namespace WTelegram
if (multiline) sw.WriteLine();
}
if (ctorNeedClone.Contains(className))
sw.WriteLine($"{tabIndent}\tpublic {className} Clone() => ({className})MemberwiseClone();");
if (multiline)
sw.WriteLine(tabIndent + "}");
else
@ -489,8 +485,6 @@ namespace WTelegram
File.Replace(tableCs + ".new", tableCs, null);
}
static readonly HashSet<string> ctorNeedClone = new() { /*"User"*/ };
private static bool HasPrefix(Constructor ctor, IList<Param> prefixParams)
{
if (ctor.@params.Length < prefixParams.Count) return false;

157
src/Helpers.TL.cs Normal file
View file

@ -0,0 +1,157 @@
namespace TL
{
partial class InputChannel { public static InputPeerChannel Empty => new(); }
partial class InputDocument { public static InputDocumentEmpty Empty => new(); }
partial class InputPeer { public static InputPeerEmpty Empty => new(); }
partial class InputPhoto { public static InputPhotoEmpty Empty => new(); }
partial class InputEncryptedFile{ public static InputEncryptedFileEmpty Empty => new(); }
partial class InputStickerSet { public static InputStickerSetEmpty Empty => new(); }
partial class InputUser { public static InputUserEmpty Empty => new(); }
partial class InputUser { public static InputUserSelf Self => new(); }
partial class ChatBase
{
public abstract int ID { get; }
public abstract string Title { get; }
protected abstract InputPeer ToInputPeer();
public static implicit operator InputPeer(ChatBase chat) => chat.ToInputPeer();
}
partial class ChatEmpty
{
public override int ID => id;
public override string Title => null;
protected override InputPeer ToInputPeer() => InputPeer.Empty;
}
partial class Chat
{
public override int ID => id;
public override string Title => title;
protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id };
}
partial class ChatForbidden
{
public override int ID => id;
public override string Title => title;
protected override InputPeer ToInputPeer() => new InputPeerChat { chat_id = id };
}
partial class Channel
{
public override int ID => id;
public override string Title => title;
protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash };
public static implicit operator InputChannel(Channel channel) => new() { channel_id = channel.id, access_hash = channel.access_hash };
}
partial class ChannelForbidden
{
public override int ID => id;
public override string Title => title;
protected override InputPeer ToInputPeer() => new InputPeerChannel { channel_id = id, access_hash = access_hash };
}
partial class UserBase
{
public abstract int ID { get; }
protected abstract InputPeer ToInputPeer();
protected abstract InputUserBase ToInputUser();
public static implicit operator InputPeer(UserBase user) => user.ToInputPeer();
public static implicit operator InputUserBase(UserBase user) => user.ToInputUser();
}
partial class UserEmpty
{
public override int ID => id;
protected override InputPeer ToInputPeer() => InputPeer.Empty;
protected override InputUserBase ToInputUser() => InputUser.Empty;
}
partial class User
{
public override int ID => id;
protected override InputPeer ToInputPeer() => new InputPeerUser { user_id = id, access_hash = access_hash };
protected override InputUserBase ToInputUser() => new InputUser { user_id = id, access_hash = access_hash };
}
partial class PhotoBase
{
public abstract long ID { get; }
protected abstract InputPhotoBase ToInputPhoto();
public static implicit operator InputPhotoBase(PhotoBase photo) => photo.ToInputPhoto();
}
partial class PhotoEmpty
{
public override long ID => id;
protected override InputPhotoBase ToInputPhoto() => InputPhoto.Empty;
}
partial class Photo
{
public override long ID => id;
protected override InputPhotoBase ToInputPhoto() => new InputPhoto() { id = id, access_hash = access_hash, file_reference = file_reference };
public InputPhotoFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type };
}
partial class PhotoSizeBase { public abstract string Type { get; } }
partial class PhotoSizeEmpty { public override string Type => type; }
partial class PhotoSize { public override string Type => type; }
partial class PhotoCachedSize { public override string Type => type; }
partial class PhotoStrippedSize { public override string Type => type; }
partial class PhotoSizeProgressive { public override string Type => type; }
partial class PhotoPathSize { public override string Type => type; }
partial class DocumentBase
{
public abstract long ID { get; }
protected abstract InputDocumentBase ToInputDocument();
public static implicit operator InputDocumentBase(DocumentBase document) => document.ToInputDocument();
}
partial class DocumentEmpty
{
public override long ID => id;
protected override InputDocumentBase ToInputDocument() => InputDocument.Empty;
}
partial class Document
{
public override long ID => id;
protected override InputDocumentBase ToInputDocument() => new InputDocument() { id = id, access_hash = access_hash, file_reference = file_reference };
public InputDocumentFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type };
}
partial class EncryptedFileBase
{
protected abstract InputEncryptedFileBase ToInputEncryptedFile();
public static implicit operator InputEncryptedFileBase(EncryptedFileBase file) => file.ToInputEncryptedFile();
}
partial class EncryptedFileEmpty
{
protected override InputEncryptedFileBase ToInputEncryptedFile() => InputEncryptedFile.Empty;
}
partial class EncryptedFile
{
protected override InputEncryptedFileBase ToInputEncryptedFile() => new InputEncryptedFile { id = id, access_hash = access_hash };
public InputEncryptedFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash };
}
partial class SecureFile
{
public static implicit operator InputSecureFile(SecureFile file) => new() { id = file.id, access_hash = file.access_hash };
public InputSecureFileLocation ToFileLocation() => new() { id = id, access_hash = access_hash };
}
partial class InputFileBase
{
public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint);
public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret);
}
partial class InputFile
{
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, key_fingerprint = key_fingerprint };
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, file_hash = file_hash, secret = secret };
}
partial class InputFileBig
{
public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileBigUploaded { id = id, parts = parts, key_fingerprint = key_fingerprint };
public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, file_hash = file_hash, secret = secret };
}
partial class StickerSet
{
public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash };
}
}

View file

@ -5,7 +5,7 @@ using System.Threading.Tasks;
namespace TL
{
[TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector<long> = ResPQ
public class ResPQ : ITLObject
public partial class ResPQ : ITLObject
{
public Int128 nonce;
public Int128 server_nonce;
@ -14,7 +14,7 @@ namespace TL
}
[TLDef(0x83C95AEC)] //p_q_inner_data#83c95aec pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data
public class PQInnerData : ITLObject
public partial class PQInnerData : ITLObject
{
public byte[] pq;
public byte[] p;
@ -24,26 +24,26 @@ namespace TL
public Int256 new_nonce;
}
[TLDef(0xA9F55F95)] //p_q_inner_data_DC#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data
public class PQInnerDataDC : PQInnerData { public int dc; }
public partial class PQInnerDataDC : PQInnerData { public int dc; }
[TLDef(0x56FDDF88)] //p_q_inner_data_temp_DC#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data
public class PQInnerDataTempDC : PQInnerData
public partial class PQInnerDataTempDC : PQInnerData
{
public int dc;
public int expires_in; // seconds
}
public abstract class ServerDHParams : ITLObject
public abstract partial class ServerDHParams : ITLObject
{
public Int128 nonce;
public Int128 server_nonce;
}
[TLDef(0x79CB045D)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params
public class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; }
public partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; }
[TLDef(0xD0E8075C)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params
public class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; }
public partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; }
[TLDef(0xB5890DBA)] //server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:bytes g_a:bytes server_time:int = Server_DH_inner_data
public class ServerDHInnerData : ITLObject
public partial class ServerDHInnerData : ITLObject
{
public Int128 nonce;
public Int128 server_nonce;
@ -54,7 +54,7 @@ namespace TL
}
[TLDef(0x6643B654)] //client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:bytes = Client_DH_Inner_Data
public class ClientDHInnerData : ITLObject
public partial class ClientDHInnerData : ITLObject
{
public Int128 nonce;
public Int128 server_nonce;
@ -62,21 +62,21 @@ namespace TL
public byte[] g_b;
}
public abstract class SetClientDHParamsAnswer : ITLObject
public abstract partial class SetClientDHParamsAnswer : ITLObject
{
public Int128 nonce;
public Int128 server_nonce;
public Int128 new_nonce_hashN; // 16 low order bytes from SHA1(new_nonce + (01=ok, 02=retry, 03=fail) + 8 high order bytes from SHA1(auth_key))
}
[TLDef(0x3BCBF734)] //DH_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hashN:int128 = Set_client_DH_params_answer
public class DHGenOk : SetClientDHParamsAnswer { }
public partial class DHGenOk : SetClientDHParamsAnswer { }
[TLDef(0x46DC1FB9)] //DH_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hashN:int128 = Set_client_DH_params_answer
public class DHGenRetry : SetClientDHParamsAnswer { }
public partial class DHGenRetry : SetClientDHParamsAnswer { }
[TLDef(0xA69DAE02)] //DH_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hashN:int128 = Set_client_DH_params_answer
public class DHGenFail : SetClientDHParamsAnswer { }
public partial class DHGenFail : SetClientDHParamsAnswer { }
[TLDef(0x75A3F765)] //bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner
public class BindAuthKeyInner : ITLObject
public partial class BindAuthKeyInner : ITLObject
{
public long nonce;
public long temp_auth_key_id;
@ -86,26 +86,26 @@ namespace TL
}
[TLDef(0xF35C6D01)] //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult
public class RpcResult : ITLObject
public partial class RpcResult : ITLObject
{
internal long req_msg_id;
internal object result;
}
[TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError
public class RpcError : ITLObject
public partial class RpcError : ITLObject
{
public int error_code;
public string error_message;
}
public abstract class RpcDropAnswer : ITLObject { }
public abstract partial class RpcDropAnswer : ITLObject { }
[TLDef(0x5E2AD36E)] //rpc_answer_unknown#5e2ad36e = RpcDropAnswer
public class RpcAnswerUnknown : RpcDropAnswer { }
public partial class RpcAnswerUnknown : RpcDropAnswer { }
[TLDef(0xCD78E586)] //rpc_answer_dropped_running#cd78e586 = RpcDropAnswer
public class RpcAnswerDroppedRunning : RpcDropAnswer { }
public partial class RpcAnswerDroppedRunning : RpcDropAnswer { }
[TLDef(0xA43AD8B7)] //rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer
public class RpcAnswerDropped : RpcDropAnswer
public partial class RpcAnswerDropped : RpcDropAnswer
{
public long msg_id;
public int seq_no;
@ -113,7 +113,7 @@ namespace TL
}
[TLDef(0x0949D9DC)] //future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt
public class FutureSalt : ITLObject
public partial class FutureSalt : ITLObject
{
public DateTime valid_since;
public DateTime valid_until;
@ -121,7 +121,7 @@ namespace TL
}
[TLDef(0xAE500895)] //future_salts#ae500895 req_msg_id:long now:int salts:Vector<FutureSalt> = FutureSalts
public class FutureSalts : ITLObject
public partial class FutureSalts : ITLObject
{
public long req_msg_id;
public DateTime now;
@ -129,34 +129,34 @@ namespace TL
}
[TLDef(0x347773C5)] //pong#347773c5 msg_id:long ping_id:long = Pong
public class Pong : ITLObject
public partial class Pong : ITLObject
{
public long msg_id;
public long ping_id;
}
public abstract class DestroySessionRes : ITLObject { public long session_id; }
public abstract partial class DestroySessionRes : ITLObject { public long session_id; }
[TLDef(0xE22045FC)] //destroy_session_ok#e22045fc session_id:long = DestroySessionRes
public class DestroySessionOk : DestroySessionRes { }
public partial class DestroySessionOk : DestroySessionRes { }
[TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes
public class DestroySessionNone : DestroySessionRes { }
public partial class DestroySessionNone : DestroySessionRes { }
public abstract class NewSession : ITLObject { }
public abstract partial class NewSession : ITLObject { }
[TLDef(0x9EC20908)] //new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession
public class NewSessionCreated : NewSession
public partial class NewSessionCreated : NewSession
{
public long first_msg_id;
public long unique_id;
public long server_salt;
}
public abstract class MessageContainer : ITLObject { }
public abstract partial class MessageContainer : ITLObject { }
[TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer
public class MsgContainer : MessageContainer { public _Message[] messages; }
public partial class MsgContainer : MessageContainer { public _Message[] messages; }
[System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006")]
[TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message
public class _Message
public partial class _Message
{
public long msg_id;
public int seqno;
@ -164,49 +164,49 @@ namespace TL
public ITLObject body;
}
public abstract class MessageCopy : ITLObject { }
public abstract partial class MessageCopy : ITLObject { }
[TLDef(0xE06046B2)] //msg_copy#e06046b2 orig_message:Message = MessageCopy
public class MsgCopy : MessageCopy { public _Message orig_message; }
public partial class MsgCopy : MessageCopy { public _Message orig_message; }
[TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object
public class GzipPacked : ITLObject { public byte[] packed_data; }
public partial class GzipPacked : ITLObject { public byte[] packed_data; }
[TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck
public class MsgsAck : ITLObject { public long[] msg_ids; }
public partial class MsgsAck : ITLObject { public long[] msg_ids; }
[TLDef(0xA7EFF811)] //bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification
public class BadMsgNotification : ITLObject
public partial class BadMsgNotification : ITLObject
{
public long bad_msg_id;
public int bad_msg_seqno;
public int error_code;
}
[TLDef(0xEDAB447B)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification
public class BadServerSalt : BadMsgNotification { public long new_server_salt; }
public partial class BadServerSalt : BadMsgNotification { public long new_server_salt; }
[TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq
public class MsgResendReq : ITLObject { public long[] msg_ids; }
public partial class MsgResendReq : ITLObject { public long[] msg_ids; }
[TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq
public class MsgsStateReq : ITLObject { public long[] msg_ids; }
public partial class MsgsStateReq : ITLObject { public long[] msg_ids; }
[TLDef(0x04DEB57D)] //msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo
public class MsgsStateInfo : ITLObject
public partial class MsgsStateInfo : ITLObject
{
public long req_msg_id;
public byte[] info;
}
[TLDef(0x8CC0D131)] //msgs_all_info#8cc0d131 msg_ids:Vector<long> info:bytes = MsgsAllInfo
public class MsgsAllInfo : ITLObject
public partial class MsgsAllInfo : ITLObject
{
public long[] msg_ids;
public byte[] info;
}
public abstract class MsgDetailedInfoBase : ITLObject { }
public abstract partial class MsgDetailedInfoBase : ITLObject { }
[TLDef(0x276D3EC6)] //msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo
public class MsgDetailedInfo : MsgDetailedInfoBase
public partial class MsgDetailedInfo : MsgDetailedInfoBase
{
public long msg_id;
public long answer_msg_id;
@ -214,7 +214,7 @@ namespace TL
public int status;
}
[TLDef(0x809DB6DF)] //msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo
public class MsgNewDetailedInfo : MsgDetailedInfoBase
public partial class MsgNewDetailedInfo : MsgDetailedInfoBase
{
public long answer_msg_id;
public int bytes;
@ -222,19 +222,19 @@ namespace TL
}
[TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey
public class RSAPublicKey : ITLObject
public partial class RSAPublicKey : ITLObject
{
public byte[] n;
public byte[] e;
}
public abstract class DestroyAuthKeyRes : ITLObject { }
public abstract partial class DestroyAuthKeyRes : ITLObject { }
[TLDef(0xF660E1D4)] //destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes
public class DestroyAuthKeyOk : DestroyAuthKeyRes { }
public partial class DestroyAuthKeyOk : DestroyAuthKeyRes { }
[TLDef(0x0A9F2259)] //destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes
public class DestroyAuthKeyNone : DestroyAuthKeyRes { }
public partial class DestroyAuthKeyNone : DestroyAuthKeyRes { }
[TLDef(0xEA109B13)] //destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes
public class DestroyAuthKeyFail : DestroyAuthKeyRes { }
public partial class DestroyAuthKeyFail : DestroyAuthKeyRes { }
}
namespace WTelegram // ---functions---

File diff suppressed because it is too large Load diff

View file

@ -5,9 +5,9 @@ namespace TL
{
namespace Layer8
{
public abstract class DecryptedMessageBase : ITLObject { }
public abstract partial class DecryptedMessageBase : ITLObject { }
[TLDef(0x1F814F1F)] //decryptedMessage#1f814f1f random_id:long random_bytes:bytes message:string media:DecryptedMessageMedia = DecryptedMessage
public class DecryptedMessage : DecryptedMessageBase
public partial class DecryptedMessage : DecryptedMessageBase
{
public long random_id;
public byte[] random_bytes;
@ -15,18 +15,18 @@ namespace TL
public DecryptedMessageMedia media;
}
[TLDef(0xAA48327D)] //decryptedMessageService#aa48327d random_id:long random_bytes:bytes action:DecryptedMessageAction = DecryptedMessage
public class DecryptedMessageService : DecryptedMessageBase
public partial class DecryptedMessageService : DecryptedMessageBase
{
public long random_id;
public byte[] random_bytes;
public DecryptedMessageAction action;
}
public abstract class DecryptedMessageMedia : ITLObject { }
public abstract partial class DecryptedMessageMedia : ITLObject { }
[TLDef(0x089F5C4A)] //decryptedMessageMediaEmpty#089f5c4a = DecryptedMessageMedia
public class DecryptedMessageMediaEmpty : DecryptedMessageMedia { }
public partial class DecryptedMessageMediaEmpty : DecryptedMessageMedia { }
[TLDef(0x32798A8C)] //decryptedMessageMediaPhoto#32798a8c thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaPhoto : DecryptedMessageMedia
public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -38,7 +38,7 @@ namespace TL
public byte[] iv;
}
[TLDef(0x4CEE6EF3)] //decryptedMessageMediaVideo#4cee6ef3 thumb:bytes thumb_w:int thumb_h:int duration:int w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaVideo : DecryptedMessageMedia
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -51,13 +51,13 @@ namespace TL
public byte[] iv;
}
[TLDef(0x35480A59)] //decryptedMessageMediaGeoPoint#35480a59 lat:double long:double = DecryptedMessageMedia
public class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia
public partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia
{
public double lat;
public double long_;
}
[TLDef(0x588A0A97)] //decryptedMessageMediaContact#588a0a97 phone_number:string first_name:string last_name:string user_id:int = DecryptedMessageMedia
public class DecryptedMessageMediaContact : DecryptedMessageMedia
public partial class DecryptedMessageMediaContact : DecryptedMessageMedia
{
public string phone_number;
public string first_name;
@ -65,7 +65,7 @@ namespace TL
public int user_id;
}
[TLDef(0xB095434B)] //decryptedMessageMediaDocument#b095434b thumb:bytes thumb_w:int thumb_h:int file_name:string mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaDocument : DecryptedMessageMedia
public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -77,7 +77,7 @@ namespace TL
public byte[] iv;
}
[TLDef(0x6080758F)] //decryptedMessageMediaAudio#6080758f duration:int size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaAudio : DecryptedMessageMedia
public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia
{
public int duration;
public int size;
@ -85,24 +85,24 @@ namespace TL
public byte[] iv;
}
public abstract class DecryptedMessageAction : ITLObject { }
public abstract partial class DecryptedMessageAction : ITLObject { }
[TLDef(0xA1733AEC)] //decryptedMessageActionSetMessageTTL#a1733aec ttl_seconds:int = DecryptedMessageAction
public class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { public int ttl_seconds; }
public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { public int ttl_seconds; }
[TLDef(0x0C4F40BE)] //decryptedMessageActionReadMessages#0c4f40be random_ids:Vector<long> = DecryptedMessageAction
public class DecryptedMessageActionReadMessages : DecryptedMessageAction { public long[] random_ids; }
public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction { public long[] random_ids; }
[TLDef(0x65614304)] //decryptedMessageActionDeleteMessages#65614304 random_ids:Vector<long> = DecryptedMessageAction
public class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { public long[] random_ids; }
public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { public long[] random_ids; }
[TLDef(0x8AC1F475)] //decryptedMessageActionScreenshotMessages#8ac1f475 random_ids:Vector<long> = DecryptedMessageAction
public class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { public long[] random_ids; }
public partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { public long[] random_ids; }
[TLDef(0x6719E45C)] //decryptedMessageActionFlushHistory#6719e45c = DecryptedMessageAction
public class DecryptedMessageActionFlushHistory : DecryptedMessageAction { }
public partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { }
}
namespace Layer17
{
public abstract class DecryptedMessageBase : ITLObject { }
public abstract partial class DecryptedMessageBase : ITLObject { }
[TLDef(0x204D3878)] //decryptedMessage#204d3878 random_id:long ttl:int message:string media:DecryptedMessageMedia = DecryptedMessage
public class DecryptedMessage : DecryptedMessageBase
public partial class DecryptedMessage : DecryptedMessageBase
{
public long random_id;
public int ttl;
@ -110,15 +110,15 @@ namespace TL
public DecryptedMessageMedia media;
}
[TLDef(0x73164160)] //decryptedMessageService#73164160 random_id:long action:DecryptedMessageAction = DecryptedMessage
public class DecryptedMessageService : DecryptedMessageBase
public partial class DecryptedMessageService : DecryptedMessageBase
{
public long random_id;
public DecryptedMessageAction action;
}
public abstract class DecryptedMessageMedia : ITLObject { }
public abstract partial class DecryptedMessageMedia : ITLObject { }
[TLDef(0x524A415D)] //decryptedMessageMediaVideo#524a415d thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaVideo : DecryptedMessageMedia
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -132,7 +132,7 @@ namespace TL
public byte[] iv;
}
[TLDef(0x57E0A9CB)] //decryptedMessageMediaAudio#57e0a9cb duration:int mime_type:string size:int key:bytes iv:bytes = DecryptedMessageMedia
public class DecryptedMessageMediaAudio : DecryptedMessageMedia
public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia
{
public int duration;
public string mime_type;
@ -142,7 +142,7 @@ namespace TL
}
[TLDef(0x1BE31789)] //decryptedMessageLayer#1be31789 random_bytes:bytes layer:int in_seq_no:int out_seq_no:int message:DecryptedMessage = DecryptedMessageLayer
public class DecryptedMessageLayer : ITLObject
public partial class DecryptedMessageLayer : ITLObject
{
public byte[] random_bytes;
public int layer;
@ -152,78 +152,78 @@ namespace TL
}
[TLDef(0x92042FF7)] //sendMessageUploadVideoAction#92042ff7 = SendMessageAction
public class SendMessageUploadVideoAction : SendMessageAction { }
public partial class SendMessageUploadVideoAction : SendMessageAction { }
[TLDef(0xE6AC8A6F)] //sendMessageUploadAudioAction#e6ac8a6f = SendMessageAction
public class SendMessageUploadAudioAction : SendMessageAction { }
public partial class SendMessageUploadAudioAction : SendMessageAction { }
[TLDef(0x990A3C1A)] //sendMessageUploadPhotoAction#990a3c1a = SendMessageAction
public class SendMessageUploadPhotoAction : SendMessageAction { }
public partial class SendMessageUploadPhotoAction : SendMessageAction { }
[TLDef(0x8FAEE98E)] //sendMessageUploadDocumentAction#8faee98e = SendMessageAction
public class SendMessageUploadDocumentAction : SendMessageAction { }
public partial class SendMessageUploadDocumentAction : SendMessageAction { }
public abstract class DecryptedMessageAction : ITLObject { }
public abstract partial class DecryptedMessageAction : ITLObject { }
[TLDef(0x511110B0)] //decryptedMessageActionResend#511110b0 start_seq_no:int end_seq_no:int = DecryptedMessageAction
public class DecryptedMessageActionResend : DecryptedMessageAction
public partial class DecryptedMessageActionResend : DecryptedMessageAction
{
public int start_seq_no;
public int end_seq_no;
}
[TLDef(0xF3048883)] //decryptedMessageActionNotifyLayer#f3048883 layer:int = DecryptedMessageAction
public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { public int layer; }
public partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { public int layer; }
[TLDef(0xCCB27641)] //decryptedMessageActionTyping#ccb27641 action:SendMessageAction = DecryptedMessageAction
public class DecryptedMessageActionTyping : DecryptedMessageAction { public SendMessageAction action; }
public partial class DecryptedMessageActionTyping : DecryptedMessageAction { public SendMessageAction action; }
}
namespace Layer20
{
public abstract class DecryptedMessageAction : ITLObject { }
public abstract partial class DecryptedMessageAction : ITLObject { }
[TLDef(0xF3C9611B)] //decryptedMessageActionRequestKey#f3c9611b exchange_id:long g_a:bytes = DecryptedMessageAction
public class DecryptedMessageActionRequestKey : DecryptedMessageAction
public partial class DecryptedMessageActionRequestKey : DecryptedMessageAction
{
public long exchange_id;
public byte[] g_a;
}
[TLDef(0x6FE1735B)] //decryptedMessageActionAcceptKey#6fe1735b exchange_id:long g_b:bytes key_fingerprint:long = DecryptedMessageAction
public class DecryptedMessageActionAcceptKey : DecryptedMessageAction
public partial class DecryptedMessageActionAcceptKey : DecryptedMessageAction
{
public long exchange_id;
public byte[] g_b;
public long key_fingerprint;
}
[TLDef(0xDD05EC6B)] //decryptedMessageActionAbortKey#dd05ec6b exchange_id:long = DecryptedMessageAction
public class DecryptedMessageActionAbortKey : DecryptedMessageAction { public long exchange_id; }
public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction { public long exchange_id; }
[TLDef(0xEC2E0B9B)] //decryptedMessageActionCommitKey#ec2e0b9b exchange_id:long key_fingerprint:long = DecryptedMessageAction
public class DecryptedMessageActionCommitKey : DecryptedMessageAction
public partial class DecryptedMessageActionCommitKey : DecryptedMessageAction
{
public long exchange_id;
public long key_fingerprint;
}
[TLDef(0xA82FDD63)] //decryptedMessageActionNoop#a82fdd63 = DecryptedMessageAction
public class DecryptedMessageActionNoop : DecryptedMessageAction { }
public partial class DecryptedMessageActionNoop : DecryptedMessageAction { }
}
namespace Layer23
{
[TLDef(0xFB0A5727)] //documentAttributeSticker#fb0a5727 = DocumentAttribute
public class DocumentAttributeSticker : DocumentAttribute { }
public partial class DocumentAttributeSticker : DocumentAttribute { }
[TLDef(0x5910CCCB)] //documentAttributeVideo#5910cccb duration:int w:int h:int = DocumentAttribute
public class DocumentAttributeVideo : DocumentAttribute
public partial class DocumentAttributeVideo : DocumentAttribute
{
public int duration;
public int w;
public int h;
}
[TLDef(0x051448E5)] //documentAttributeAudio#051448e5 duration:int = DocumentAttribute
public class DocumentAttributeAudio : DocumentAttribute { public int duration; }
public partial class DocumentAttributeAudio : DocumentAttribute { public int duration; }
[TLDef(0x7C596B46)] //fileLocationUnavailable#7c596b46 volume_id:long local_id:int secret:long = FileLocation
public class FileLocationUnavailable : FileLocation
public partial class FileLocationUnavailable : FileLocation
{
public long volume_id;
public int local_id;
public long secret;
}
[TLDef(0x53D69076)] //fileLocation#53d69076 dc_id:int volume_id:long local_id:int secret:long = FileLocation
public class FileLocation_ : FileLocation
public partial class FileLocation_ : FileLocation
{
public int dc_id;
public long volume_id;
@ -231,9 +231,9 @@ namespace TL
public long secret;
}
public abstract class DecryptedMessageMedia : ITLObject { }
public abstract partial class DecryptedMessageMedia : ITLObject { }
[TLDef(0xFA95B0DD)] //decryptedMessageMediaExternalDocument#fa95b0dd id:long access_hash:long date:int mime_type:string size:int thumb:PhotoSize dc_id:int attributes:Vector<DocumentAttribute> = DecryptedMessageMedia
public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia
public partial class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia
{
public long id;
public long access_hash;
@ -249,7 +249,7 @@ namespace TL
namespace Layer45
{
[TLDef(0x36B091DE)] //decryptedMessage#36b091de flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector<MessageEntity> via_bot_name:flags.11?string reply_to_random_id:flags.3?long = DecryptedMessage
public class DecryptedMessage : ITLObject
public partial class DecryptedMessage : ITLObject
{
[Flags] public enum Flags { has_reply_to_random_id = 0x8, has_entities = 0x80, has_media = 0x200, has_via_bot_name = 0x800 }
public Flags flags;
@ -262,9 +262,9 @@ namespace TL
[IfFlag(3)] public long reply_to_random_id;
}
public abstract class DecryptedMessageMedia : ITLObject { }
public abstract partial class DecryptedMessageMedia : ITLObject { }
[TLDef(0xF1FA8D78)] //decryptedMessageMediaPhoto#f1fa8d78 thumb:bytes thumb_w:int thumb_h:int w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia
public class DecryptedMessageMediaPhoto : DecryptedMessageMedia
public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -277,7 +277,7 @@ namespace TL
public string caption;
}
[TLDef(0x970C8C0E)] //decryptedMessageMediaVideo#970c8c0e thumb:bytes thumb_w:int thumb_h:int duration:int mime_type:string w:int h:int size:int key:bytes iv:bytes caption:string = DecryptedMessageMedia
public class DecryptedMessageMediaVideo : DecryptedMessageMedia
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -292,7 +292,7 @@ namespace TL
public string caption;
}
[TLDef(0x7AFE8AE2)] //decryptedMessageMediaDocument#7afe8ae2 thumb:bytes thumb_w:int thumb_h:int mime_type:string size:int key:bytes iv:bytes attributes:Vector<DocumentAttribute> caption:string = DecryptedMessageMedia
public class DecryptedMessageMediaDocument : DecryptedMessageMedia
public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia
{
public byte[] thumb;
public int thumb_w;
@ -305,7 +305,7 @@ namespace TL
public string caption;
}
[TLDef(0x8A0DF56F)] //decryptedMessageMediaVenue#8a0df56f lat:double long:double title:string address:string provider:string venue_id:string = DecryptedMessageMedia
public class DecryptedMessageMediaVenue : DecryptedMessageMedia
public partial class DecryptedMessageMediaVenue : DecryptedMessageMedia
{
public double lat;
public double long_;
@ -315,16 +315,16 @@ namespace TL
public string venue_id;
}
[TLDef(0xE50511D8)] //decryptedMessageMediaWebPage#e50511d8 url:string = DecryptedMessageMedia
public class DecryptedMessageMediaWebPage : DecryptedMessageMedia { public string url; }
public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia { public string url; }
[TLDef(0x3A556302)] //documentAttributeSticker#3a556302 alt:string stickerset:InputStickerSet = DocumentAttribute
public class DocumentAttributeSticker : DocumentAttribute
public partial class DocumentAttributeSticker : DocumentAttribute
{
public string alt;
public InputStickerSet stickerset;
}
[TLDef(0xDED218E0)] //documentAttributeAudio#ded218e0 duration:int title:string performer:string = DocumentAttribute
public class DocumentAttributeAudio : DocumentAttribute
public partial class DocumentAttributeAudio : DocumentAttribute
{
public int duration;
public string title;
@ -338,13 +338,13 @@ namespace TL
namespace Layer66
{
[TLDef(0xBB718624)] //sendMessageUploadRoundAction#bb718624 = SendMessageAction
public class SendMessageUploadRoundAction : SendMessageAction { }
public partial class SendMessageUploadRoundAction : SendMessageAction { }
}
namespace Layer73
{
[TLDef(0x91CC4674)] //decryptedMessage#91cc4674 flags:# random_id:long ttl:int message:string media:flags.9?DecryptedMessageMedia entities:flags.7?Vector<MessageEntity> via_bot_name:flags.11?string reply_to_random_id:flags.3?long grouped_id:flags.17?long = DecryptedMessage
public class DecryptedMessage : ITLObject
public partial class DecryptedMessage : ITLObject
{
[Flags] public enum Flags { has_reply_to_random_id = 0x8, has_entities = 0x80, has_media = 0x200, has_via_bot_name = 0x800,
has_grouped_id = 0x20000 }

View file

@ -6,7 +6,7 @@ namespace TL
{
static partial class Schema
{
public const int Layer = 121; // fetched 07/08/2021 01:34:33
public const int Layer = 121; // fetched 09/08/2021 22:59:12
public const int VectorCtor = 0x1CB5C415;
public const int NullCtor = 0x56730BCC;
@ -14,8 +14,10 @@ namespace TL
{
// from TL.MTProto:
[0x05162463] = typeof(ResPQ),
[0x83C95AEC] = typeof(PQInnerData),
[0xA9F55F95] = typeof(PQInnerDataDC),
[0x56FDDF88] = typeof(PQInnerDataTempDC),
[0x79CB045D] = typeof(ServerDHParamsFail),
[0xD0E8075C] = typeof(ServerDHParamsOk),
[0xB5890DBA] = typeof(ServerDHInnerData),
[0x6643B654] = typeof(ClientDHInnerData),
@ -47,6 +49,7 @@ namespace TL
[0x8CC0D131] = typeof(MsgsAllInfo),
[0x276D3EC6] = typeof(MsgDetailedInfo),
[0x809DB6DF] = typeof(MsgNewDetailedInfo),
[0x7A19CB76] = typeof(RSAPublicKey),
[0xF660E1D4] = typeof(DestroyAuthKeyOk),
[0x0A9F2259] = typeof(DestroyAuthKeyNone),
[0xEA109B13] = typeof(DestroyAuthKeyFail),