Complete XML documentation of the Telegram API !

This commit is contained in:
Wizou 2021-11-03 03:53:48 +01:00
parent 3ad36f3e56
commit a197573258
4 changed files with 8926 additions and 2435 deletions

View file

@ -17,6 +17,8 @@ namespace WTelegram
readonly Dictionary<string, int> knownStyles = new() { ["InitConnection"] = 1, ["Help_GetConfig"] = 0, ["HttpWait"] = -1 };
readonly Dictionary<string, TypeInfo> typeInfos = new();
readonly HashSet<string> enumTypes = new();
readonly Dictionary<string, string> enumValues = new();
readonly HashSet<string> nullableCtor = new();
int currentLayer;
string tabIndent;
private string currentJson;
@ -114,7 +116,7 @@ namespace WTelegram
ctorToTypes[ctor.ID] = ctor.layer == 0 ? structName : $"Layer{ctor.layer}.{structName}";
var typeInfo = typeInfos.GetOrCreate(ctor.type);
if (ctor.ID == 0x5BB8E511) { ctorToTypes[ctor.ID] = structName = ctor.predicate = ctor.type = "_Message"; }
else if (ctor.ID == TL.Layer.NullCtor) { ctorToTypes[ctor.ID] += "=null"; typeInfo.Nullable = ctor; }
else if (ctor.ID == TL.Layer.NullCtor) { ctorToTypes[ctor.ID] += "=null"; typeInfo.Nullable = ctor; nullableCtor.Add(ctor.predicate); }
if (typeInfo.ReturnName == null) typeInfo.ReturnName = CSharpName(ctor.type);
typeInfo.Structs.Add(ctor);
if (structName == typeInfo.ReturnName) typeInfo.MainClass = ctor;
@ -140,6 +142,7 @@ namespace WTelegram
typeInfo.Nullable = nullable[0];
typeInfo.Structs.Remove(typeInfo.Nullable);
ctorToTypes[typeInfo.Nullable.ID] += "=null";
nullableCtor.Add(typeInfo.Nullable.predicate);
}
if (typeInfo.MainClass == null)
{
@ -191,7 +194,7 @@ namespace WTelegram
int autoPropsCount = 0;
foreach (var str in typeInfo.Structs)
{
if (str.ID == 0 ||str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue;
if (str.ID == 0 || str.predicate.EndsWith("Empty") || str.predicate.EndsWith("TooLong") || str.predicate.EndsWith("NotModified")) continue;
for (int i = autoProps.Count - 1; i >= 0; i--)
if (!str.@params.Contains(autoProps[i]))
autoProps.RemoveAt(i);
@ -202,6 +205,25 @@ namespace WTelegram
typeInfo.AutoProps = autoProps;
}
}
if (typeInfo.AsEnum && typeInfo.MainClass.id == null)
{
enumTypes.Add(typeInfo.ReturnName);
bool lowercase = typeInfo.ReturnName == "Storage_FileType";
string prefix = "";
while ((prefix += typeInfo.Structs[1].predicate[prefix.Length]) != null)
if (!typeInfo.Structs.All(ctor => ctor.id == null || ctor.predicate.StartsWith(prefix)))
break;
int prefixLen = CSharpName(prefix).Length - 1;
foreach (var ctor in typeInfo.Structs)
{
if (ctor.id == null) continue;
string className = CSharpName(ctor.predicate);
if (!allTypes.Add(className)) continue;
if (lowercase) className = className.ToLowerInvariant();
enumValues.Add(ctor.predicate, $"{typeInfo.ReturnName}.{className[prefixLen..]}");
ctorToTypes.Remove(ctor.ID);
}
}
}
var layers = schema.constructors.Select(c => c.layer).Distinct().ToList();
if (layers.Count > 1) // multi-layer file => generate abstract classes out of layer namespaces first
@ -273,18 +295,21 @@ namespace WTelegram
if (needNewLine) { needNewLine = false; sw.WriteLine(); }
var parentClass = ctor == typeInfo.MainClass ? "ITLObject" : typeInfo.ReturnName;
var parms = ctor.@params;
var webDoc = WriteXmlDoc(sw, typeInfo, ctor);
if (ctorId == 0) // abstract parent
{
if (currentJson != "TL.MTProto")
sw.WriteLine($"{tabIndent}///<summary>See <a href=\"https://corefork.telegram.org/type/{typeInfo.Structs[0].type}\"/></summary>");
if (typeInfo.Nullable != null)
sw.WriteLine($"{tabIndent}///<remarks>a <c>null</c> value means <a href=\"https://corefork.telegram.org/constructor/{typeInfo.Nullable.predicate}\">{typeInfo.Nullable.predicate}</a></remarks>");
if (typeInfo.AsEnum)
{
WriteTypeAsEnum(sw, typeInfo);
WriteTypeAsEnum(sw, typeInfo, webDoc);
return;
}
sw.Write($"{tabIndent}public abstract partial class {ctor.predicate}");
if (webDoc != null && (parms.Length > 0 || typeInfo.AutoProps != null))
{
var len = Math.Max(parms.Length, typeInfo.AutoProps?.Count ?? 0);
var webDoc2 = ParseWebDoc($"constructor/{typeInfo.Structs.Skip(1).First(s => s.@params.Length >= len).predicate}");
webDoc["Parameters"] = webDoc2["Parameters"];
}
}
else
{
@ -323,12 +348,7 @@ namespace WTelegram
}
}
if (currentJson != "TL.MTProto")
{
sw.WriteLine($"{tabIndent}///<summary>See <a href=\"https://corefork.telegram.org/constructor/{ctor.predicate}\"/></summary>");
if (typeInfo.Nullable != null && ctor == typeInfo.MainClass)
sw.WriteLine($"{tabIndent}///<remarks>a <c>null</c> value means <a href=\"https://corefork.telegram.org/constructor/{typeInfo.Nullable.predicate}\">{typeInfo.Nullable.predicate}</a></remarks>");
sw.WriteLine($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})]");
}
else
{
sw.Write($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})] //{ctor.predicate}#{ctor.ID:x8} ");
@ -347,63 +367,64 @@ namespace WTelegram
commonFields = typeInfo.CommonFields;
continue;
}
var paramDoc = webDoc?.GetValueOrDefault("Parameters").table;
var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags."));
bool multiline = hasFlagEnum || parms.Length > 1 || typeInfo.AbstractUserOrChat || typeInfo.AutoProps != null;
if (multiline)
{
sw.WriteLine();
sw.WriteLine(tabIndent + "{");
foreach (var parm in parms)
{
if (parm.type.EndsWith("?true")) continue;
var doc = paramDoc?.GetValueOrDefault(parm.name);
if (doc != null) sw.WriteLine($"{tabIndent}\t/// <summary>{doc}</summary>");
if (parm.type == "#")
sw.WriteLine($"{tabIndent}\tpublic {(hasFlagEnum ? "Flags" : "int")} {parm.name};");
else
{
if (parm.type.StartsWith("flags."))
{
int qm = parm.type.IndexOf('?');
sw.WriteLine($"{tabIndent}\t[IfFlag({parm.type[6..qm]})] public {MapType(parm.type[(qm + 1)..], parm.name)} {MapName(parm.name)};");
}
else
sw.Write(" { ");
sw.WriteLine($"{tabIndent}\tpublic {MapType(parm.type, parm.name)} {MapName(parm.name)};");
}
}
if (hasFlagEnum)
{
sw.WriteLine();
var list = new SortedList<int, string>();
var flagDoc = new Dictionary<int, string>();
foreach (var parm in parms)
{
if (!parm.type.StartsWith("flags.") || !parm.type.EndsWith("?true")) continue;
var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]);
if (!list.ContainsKey(mask)) list[mask] = MapName(parm.name);
if (list.ContainsKey(mask)) continue;
var doc = paramDoc?.GetValueOrDefault(parm.name);
if (doc != null) flagDoc[mask] = doc;
list[mask] = MapName(parm.name);
}
foreach (var parm in parms)
{
if (!parm.type.StartsWith("flags.") || parm.type.EndsWith("?true")) continue;
var mask = 1 << int.Parse(parm.type[6..parm.type.IndexOf('?')]);
if (list.ContainsKey(mask)) continue;
flagDoc[mask] = $"Field <see cref=\"{parm.name}\"/> has a value";
var name = MapName("has_" + parm.name);
if (list.Values.Contains(name)) name += "_field";
list[mask] = name;
}
string line = tabIndent + "\t[Flags] public enum Flags { ";
sw.WriteLine(tabIndent + "\t[Flags] public enum Flags");
sw.WriteLine(tabIndent + "\t{");
foreach (var (mask, name) in list)
{
var str = $"{name} = 0x{mask:X}, ";
if (line.Length + str.Length + tabIndent.Length * 3 >= 134) { sw.WriteLine(line); line = tabIndent + "\t\t"; }
line += str;
if (flagDoc.TryGetValue(mask, out var summary)) sw.WriteLine($"{tabIndent}\t\t/// <summary>{summary}</summary>");
sw.WriteLine($"{tabIndent}\t\t{name} = 0x{mask:X},");
}
sw.WriteLine(line.TrimEnd(',', ' ') + " }");
}
foreach (var parm in parms)
{
if (parm.type.EndsWith("?true")) continue;
if (multiline) sw.Write(tabIndent + "\t");
if (parm.type == "#")
sw.Write($"public {(hasFlagEnum ? "Flags" : "int")} {parm.name};");
else
{
if (parm.type.StartsWith("flags."))
{
int qm = parm.type.IndexOf('?');
sw.Write($"[IfFlag({parm.type[6..qm]})] public {MapType(parm.type[(qm + 1)..], parm.name)} {MapName(parm.name)};");
}
else
sw.Write($"public {MapType(parm.type, parm.name)} {MapName(parm.name)};");
}
if (multiline) sw.WriteLine();
sw.WriteLine(tabIndent + "\t}");
}
if (typeInfo.AutoProps != null)
{
bool firstLine = parms.Length != 0;
bool firstLine = parms.Length != 0 || hasFlagEnum;
string format = $"{tabIndent}\tpublic ";
if (ctorId == 0)
format += "abstract {0} {1} {{ get; }}";
@ -422,6 +443,8 @@ namespace WTelegram
string csName = CSharpName(parm.name);
if (csName.EndsWith("Id") && parm.type != "int" && parm.type != "long") csName = csName[..^2];
if (firstLine) { sw.WriteLine(); firstLine = false; }
var doc = paramDoc?.GetValueOrDefault(parm.name);
if (doc != null) sw.WriteLine($"{tabIndent}\t/// <summary>{doc}</summary>");
sw.WriteLine(string.Format(format, MapType(parm.type, parm.name), csName, value));
}
}
@ -429,8 +452,10 @@ namespace WTelegram
if (hasUsersChats || (typeInfo.AbstractUserOrChat && (ctor == typeInfo.MainClass || parentClass == typeInfo.ReturnName)))
{
var modifier = !typeInfo.AbstractUserOrChat ? null : ctorId == 0 ? "abstract " : "override ";
bool withArg = !hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer);
sw.WriteLine($"{tabIndent}\t/// <summary>returns a <see cref=\"UserBase\"/> or <see cref=\"ChatBase\"/> for {(withArg ? "the given Peer" : "the result")}</summary>");
sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat");
if (!hasUsersChats || ctor.@params.Length != 3 || !parms.Contains(ParamPeer))
if (withArg)
sw.Write("(Peer peer)");
if (modifier == "abstract ")
sw.WriteLine(";");
@ -440,13 +465,131 @@ namespace WTelegram
sw.WriteLine(" => null;");
}
if (multiline)
sw.WriteLine(tabIndent + "}");
else
sw.WriteLine(" }");
commonFields = typeInfo.CommonFields;
}
}
private Dictionary<string, (string descr, Dictionary<string, string> table)> WriteXmlDoc(StreamWriter sw, TypeInfo typeInfo, Constructor ctor)
{
if (currentJson == "TL.MTProto") return null;
var url = ctor.id == null ? $"type/{ctor.type}" : $"constructor/{ctor.predicate}";
var webDoc = ParseWebDoc(url);
var summary = webDoc?.GetValueOrDefault(ctor.predicate).descr;
var derived = webDoc?.GetValueOrDefault("Constructors").table;
if (derived != null && !typeInfo.AsEnum)
summary += $"\t\t<br/>Derived classes: {string.Join(", ", derived.Keys.Where(k => k != "<see langword=\"null\"/>"))}";
summary += $"\t\t<br/>See <a href=\"https://corefork.telegram.org/{url}\"/>";
sw.WriteLine($"{tabIndent}/// <summary>{summary.Trim()}</summary>");
if (typeInfo.Nullable != null && ctor == typeInfo.MainClass)
sw.WriteLine($"{tabIndent}/// <remarks>a <c>null</c> value means <a href=\"https://corefork.telegram.org/constructor/{typeInfo.Nullable.predicate}\">{typeInfo.Nullable.predicate}</a></remarks>");
return webDoc;
}
private void WriteXmlDoc(StreamWriter sw, Method method)
{
if (currentJson == "TL.MTProto") return;
var webDoc = ParseWebDoc($"method/{method.method}");
var summary = webDoc?.GetValueOrDefault(method.method).descr;
var paramDoc = webDoc?.GetValueOrDefault("Parameters").table;
var excepDoc = webDoc?.GetValueOrDefault("Possible errors").table;
summary += $"\t\t<br/>See <a href=\"https://corefork.telegram.org/method/{method.method}\"/>";
sw.WriteLine($"{tabIndent}/// <summary>{summary.Trim()}</summary>");
if (paramDoc != null)
foreach (var (name, doc) in paramDoc)
if (name != "flags")
sw.WriteLine($"{tabIndent}/// <param name=\"{MapName(name)}\">{doc}</param>");
if (typeInfos.GetValueOrDefault(method.type)?.Nullable is Constructor nullable)
sw.WriteLine($"{tabIndent}/// <returns>a <c>null</c> value means <a href=\"https://corefork.telegram.org/constructor/{nullable.predicate}\">{nullable.predicate}</a></returns>");
}
///
private Dictionary<string, (string descr, Dictionary<string, string> table)> ParseWebDoc(string url)
{
var path = $@"{Environment.GetEnvironmentVariable("telegram-crawler")}\data\corefork.telegram.org\{url}";
if (!File.Exists(path))
if (!File.Exists(path += ".html"))
return null;
var result = new Dictionary<string, (string descr, Dictionary<string, string> table)>();
var html = File.ReadAllText(path);
foreach (var section in html[html.IndexOf("<h1")..].Split(new[] { "<h3>" }, StringSplitOptions.None))
{
var index = 0;
do { index = section.IndexOf('>', index) + 1; } while (section[index] == '<');
var title = section[index..section.IndexOf("</h")];
var rest = section[(index + title.Length + 5)..].Trim();
string descr = null;
if ((index = rest.IndexOf("<p>")) >= 0)
{
descr = rest[(index + 3)..rest.IndexOf("</p>", index)];
rest = rest[(index + 7 + descr.Length)..].Trim();
descr = ProcessDescr(descr);
}
Dictionary<string, string> table = null;
if (rest.StartsWith("<table "))
{
table = new();
int rowIndex = 0;
while ((rowIndex = rest.IndexOf("<tr>", rowIndex)) >= 0)
{
var row = rest[(rowIndex + 4)..rest.IndexOf("</tr>", rowIndex)];
rowIndex += row.Length;
index = row.IndexOf("<td");
if (index < 0) continue;
index = row.IndexOf('>', index) + 1;
var name = row[index..row.IndexOf("</td", index)];
if (name.StartsWith("<strong>") && name.EndsWith("</strong>")) name = name[8..^9];
index = row.IndexOf("<td", index);
index = row.IndexOf('>', index) + 1;
var value = row[index..row.IndexOf("</td", index)];
index = row.IndexOf("<td", index);
if (index >= 0)
{
index = row.IndexOf('>', index) + 1;
value = row[index..row.IndexOf("</td", index)];
}
table[ProcessDescr(name)] = ProcessDescr(value);
}
}
if (descr != null || table != null)
result[title] = (descr, table);
}
return result;
string ProcessDescr(string str)
{
int index = -1;
while ((index = str.IndexOf("<a href=\"", index + 1)) >= 0)
{
var url = str[(index + 9)..str.IndexOf('"', index + 9)];
var close = str.IndexOf("</a>", index) + 4;
if (url.StartsWith("/constructor/"))
if (url == "/constructor/decryptedMessageActionSetMessageTTL")
str = $"{str[0..index]}<see cref=\"Layer8.DecryptedMessageActionSetMessageTTL\"/>{str[close..]}";
else if (nullableCtor.Contains(url[13..]))
str = $"{str[0..index]}<see langword=\"null\"/>{str[close..]}";
else
str = $"{str[0..index]}<see cref=\"{MapType(url[13..], "")}\"/>{str[close..]}";
else if (url.StartsWith("/type/"))
if (url == "/type/DecryptedMessage")
str = $"{str[0..index]}<see cref=\"DecryptedMessageBase\"/>{str[close..]}";
else
str = $"{str[0..index]}<see cref=\"{MapType(url[6..], "")}\"/>{str[close..]}";
else if (url.StartsWith("/"))
str = str.Insert(index + 9, "https://corefork.telegram.org");
}
index = -1;
while ((index = str.IndexOf("<img ", index + 1)) >= 0)
{
var close = str.IndexOf("/>", index) + 2;
var tag = str[index..close];
var alt = tag.IndexOf(" alt=\"");
if (alt > 0) str = $"{str[0..index]}{tag[(alt + 6)..tag.IndexOf('"', alt + 6)]}{str[close..]}";
}
return str.Replace("\r", "").Replace("\n", "").Replace("<br>", "<br/>").Replace("code>", "c>");
}
}
static readonly Param ParamFlags = new() { name = "flags", type = "#" };
static readonly Param ParamPeer = new() { name = "peer", type = "Peer" };
static readonly Param ParamUsers = new() { name = "users", type = "Vector<User>" };
@ -470,26 +613,18 @@ namespace WTelegram
return left + right > basename.Length;
}
private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo)
private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo, Dictionary<string, (string descr, Dictionary<string, string> table)> webDoc)
{
enumTypes.Add(typeInfo.ReturnName);
bool lowercase = typeInfo.ReturnName == "Storage_FileType";
var valuesDoc = webDoc?["Constructors"].table;
sw.WriteLine($"{tabIndent}public enum {typeInfo.ReturnName} : uint");
sw.WriteLine($"{tabIndent}{{");
string prefix = "";
while ((prefix += typeInfo.Structs[1].predicate[prefix.Length]) != null)
if (!typeInfo.Structs.All(ctor => ctor.id == null || ctor.predicate.StartsWith(prefix)))
break;
int prefixLen = CSharpName(prefix).Length - 1;
foreach (var ctor in typeInfo.Structs)
{
if (ctor.id == null) continue;
string className = CSharpName(ctor.predicate);
if (!allTypes.Add(className)) continue;
if (lowercase) className = className.ToLowerInvariant();
ctorToTypes.Remove(ctor.ID);
sw.WriteLine($"{tabIndent}\t///<summary>See <a href=\"https://corefork.telegram.org/constructor/{ctor.predicate}\"/></summary>");
sw.WriteLine($"{tabIndent}\t{className[prefixLen..]} = 0x{ctor.ID:X8},");
string enumValue = enumValues[ctor.predicate];
var summary = valuesDoc?[$"<see cref=\"{enumValue}\"/>"] ?? $"See <a href=\"https://corefork.telegram.org/constructor/{ctor.predicate}\"/>";
sw.WriteLine($"{tabIndent}\t///<summary>{summary}</summary>");
sw.WriteLine($"{tabIndent}\t{enumValue[(enumValue.IndexOf('.') + 1)..]} = 0x{ctor.ID:X8},");
}
sw.WriteLine($"{tabIndent}}}");
}
@ -545,6 +680,8 @@ namespace WTelegram
return type;
else if (typeInfos.TryGetValue(type, out var typeInfo))
return typeInfo.ReturnName;
else if (enumValues.TryGetValue(type, out var enumValue))
return enumValue;
else
{ // try to find type in a lower layer
/*foreach (var layer in typeInfosByLayer.OrderByDescending(kvp => kvp.Key))
@ -587,12 +724,11 @@ namespace WTelegram
// styles: 0 = static string, 1 = static ITLFunction<>, 2 = Task<>, -1 = skip method
if (style == -1) return;
sw.WriteLine();
WriteXmlDoc(sw, method);
var callAsync = "CallAsync";
if (method.type.Length == 1 && style != 1) funcName += $"<{returnType}>";
if (currentJson != "TL.MTProto")
sw.WriteLine($"{tabIndent}///<summary>See <a href=\"https://corefork.telegram.org/method/{method.method}\"/></summary>");
else
if (currentJson == "TL.MTProto")
{
if (method.type is not "FutureSalts" and not "Pong") callAsync = "CallBareAsync";
sw.Write($"{tabIndent}//{method.method}#{ctorNb:x8} ");

View file

@ -28,9 +28,15 @@ 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 partial class PQInnerDataDc : PQInnerData { public int dc; }
public partial class PQInnerDataDc : PQInnerData
{
public int dc;
}
[TLDef(0x3C6A84D4)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data
public partial class PQInnerDataTemp : PQInnerData { public int expires_in; }
public partial class PQInnerDataTemp : PQInnerData
{
public int expires_in;
}
[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 partial class PQInnerDataTempDc : PQInnerData
{
@ -54,9 +60,15 @@ namespace TL
public Int128 server_nonce;
}
[TLDef(0x79CB045D)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params
public partial 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 partial 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 partial class ServerDHInnerData : ITLObject
@ -84,11 +96,20 @@ namespace TL
public Int128 server_nonce;
}
[TLDef(0x3BCBF734)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer
public partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; }
public partial class DhGenOk : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash1;
}
[TLDef(0x46DC1FB9)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer
public partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; }
public partial class DhGenRetry : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash2;
}
[TLDef(0xA69DAE02)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer
public partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; }
public partial class DhGenFail : SetClientDHParamsAnswer
{
public Int128 new_nonce_hash3;
}
public enum DestroyAuthKeyRes : uint
{
@ -101,7 +122,10 @@ namespace TL
}
[TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector<long> = MsgsAck
public partial 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 partial class BadMsgNotification : ITLObject
@ -111,10 +135,16 @@ namespace TL
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 partial class BadServerSalt : BadMsgNotification { public long new_server_salt; }
public partial class BadServerSalt : BadMsgNotification
{
public long new_server_salt;
}
[TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector<long> = MsgsStateReq
public partial 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 partial class MsgsStateInfo : ITLObject
@ -161,7 +191,10 @@ namespace TL
}
[TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector<long> = MsgResendReq
public partial class MsgResendReq : ITLObject { public long[] msg_ids; }
public partial class MsgResendReq : ITLObject
{
public long[] msg_ids;
}
[TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError
public partial class RpcError : ITLObject
@ -206,7 +239,10 @@ namespace TL
public long ping_id;
}
public abstract partial 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 partial class DestroySessionOk : DestroySessionRes { }
[TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes
@ -236,7 +272,10 @@ namespace TL
public int port;
}
[TLDef(0x37982646)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort
public partial class IpPortSecret : IpPort { public byte[] secret; }
public partial class IpPortSecret : IpPort
{
public byte[] secret;
}
[TLDef(0x4679B65F)] //accessPointRule#4679b65f phone_prefix_rules:bytes dc_id:int ips:vector<IpPort> = AccessPointRule
public partial class AccessPointRule : ITLObject
@ -255,7 +294,10 @@ namespace TL
}
[TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong
public partial class Ping : ITLObject { public long ping_id; }
public partial class Ping : ITLObject
{
public long ping_id;
}
// ---functions---

File diff suppressed because it is too large Load diff

View file

@ -7,457 +7,691 @@ namespace TL
using BinaryWriter = System.IO.BinaryWriter;
using Client = WTelegram.Client;
///<summary>See <a href="https://corefork.telegram.org/type/DecryptedMessage"/></summary>
/// <summary><br/>See <a href="https://corefork.telegram.org/type/DecryptedMessage"/></summary>
public abstract partial class DecryptedMessageBase : ITLObject
{
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public abstract long RandomId { get; }
}
///<summary>See <a href="https://corefork.telegram.org/type/DecryptedMessageMedia"/></summary>
///<remarks>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaEmpty">decryptedMessageMediaEmpty</a></remarks>
/// <summary>Object describes media contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/type/DecryptedMessageMedia"/></summary>
/// <remarks>a <c>null</c> value means <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaEmpty">decryptedMessageMediaEmpty</a></remarks>
public abstract partial class DecryptedMessageMedia : ITLObject { }
///<summary>See <a href="https://corefork.telegram.org/type/DecryptedMessageAction"/></summary>
/// <summary>Object describes the action to which a service message is linked. <br/>See <a href="https://corefork.telegram.org/type/DecryptedMessageAction"/></summary>
public abstract partial class DecryptedMessageAction : ITLObject { }
///<summary>See <a href="https://corefork.telegram.org/type/FileLocation"/></summary>
/// <summary><br/>See <a href="https://corefork.telegram.org/type/FileLocation"/></summary>
public abstract partial class FileLocationBase : ITLObject
{
/// <summary>Server volume</summary>
public abstract long VolumeId { get; }
/// <summary>File ID</summary>
public abstract int LocalId { get; }
/// <summary>Checksum to access the file</summary>
public abstract long Secret { get; }
}
namespace Layer8
{
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
/// <summary>Contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
[TLDef(0x1F814F1F)]
public partial class DecryptedMessage : DecryptedMessageBase
{
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
public byte[] random_bytes;
/// <summary>Message text</summary>
public string message;
/// <summary>Media content</summary>
public DecryptedMessageMedia media;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public override long RandomId => random_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageService"/></summary>
/// <summary>Contents of an encrypted service message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageService"/></summary>
[TLDef(0xAA48327D)]
public partial class DecryptedMessageService : DecryptedMessageBase
{
/// <summary>Random message ID, assigned by the message author.<br/>Must be equal to the ID passed to the sending method.</summary>
public long random_id;
public byte[] random_bytes;
/// <summary>Action relevant to the service message</summary>
public DecryptedMessageAction action;
/// <summary>Random message ID, assigned by the message author.<br/>Must be equal to the ID passed to the sending method.</summary>
public override long RandomId => random_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaPhoto"/></summary>
/// <summary>Photo attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaPhoto"/></summary>
[TLDef(0x32798A8C)]
public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia
{
/// <summary>Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>Photo width</summary>
public int w;
/// <summary>Photo height</summary>
public int h;
/// <summary>Size of the photo in bytes</summary>
public int size;
/// <summary>Key to decrypt an attached file with a full version</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
/// <summary>Video attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
[TLDef(0x4CEE6EF3)]
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
/// <summary>Content of thumbnail file (JPEG file, quality 55, set in a square 90x90)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>Duration of video in seconds</summary>
public int duration;
/// <summary>Image width</summary>
public int w;
/// <summary>Image height</summary>
public int h;
/// <summary>File size</summary>
public int size;
/// <summary>Key to decrypt the attached video file</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaGeoPoint"/></summary>
/// <summary>GeoPont attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaGeoPoint"/></summary>
[TLDef(0x35480A59)]
public partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia
{
/// <summary>Latitude of point</summary>
public double lat;
/// <summary>Longtitude of point</summary>
public double long_;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaContact"/></summary>
/// <summary>Contact attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaContact"/></summary>
[TLDef(0x588A0A97)]
public partial class DecryptedMessageMediaContact : DecryptedMessageMedia
{
/// <summary>Phone number</summary>
public string phone_number;
/// <summary>Contact's first name</summary>
public string first_name;
/// <summary>Contact's last name</summary>
public string last_name;
/// <summary>Telegram User ID of signed-up contact</summary>
public int user_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaDocument"/></summary>
/// <summary>Document attached to a message in a secret chat. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaDocument"/></summary>
[TLDef(0xB095434B)]
public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia
{
/// <summary>Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
public string file_name;
/// <summary>File MIME-type</summary>
public string mime_type;
/// <summary>Document size</summary>
public int size;
/// <summary>Key to decrypt the attached document file</summary>
public byte[] key;
/// <summary>Initialization</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaAudio"/></summary>
/// <summary>Audio file attached to a secret chat message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaAudio"/></summary>
[TLDef(0x6080758F)]
public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia
{
/// <summary>Audio duration in seconds</summary>
public int duration;
/// <summary>File size</summary>
public int size;
/// <summary>Key to decrypt the attached media file</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionSetMessageTTL"/></summary>
/// <summary>Setting of a message lifetime after reading. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionSetMessageTTL"/></summary>
[TLDef(0xA1733AEC)]
public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { public int ttl_seconds; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionReadMessages"/></summary>
public partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction
{
/// <summary>Lifetime in seconds</summary>
public int ttl_seconds;
}
/// <summary>Messages marked as read. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionReadMessages"/></summary>
[TLDef(0x0C4F40BE)]
public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction { public long[] random_ids; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionDeleteMessages"/></summary>
public partial class DecryptedMessageActionReadMessages : DecryptedMessageAction
{
/// <summary>List of message IDs</summary>
public long[] random_ids;
}
/// <summary>Deleted messages. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionDeleteMessages"/></summary>
[TLDef(0x65614304)]
public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { public long[] random_ids; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionScreenshotMessages"/></summary>
public partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction
{
/// <summary>List of deleted message IDs</summary>
public long[] random_ids;
}
/// <summary>A screenshot was taken. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionScreenshotMessages"/></summary>
[TLDef(0x8AC1F475)]
public partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { public long[] random_ids; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionFlushHistory"/></summary>
public partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction
{
/// <summary>List of affected message ids (that appeared on the screenshot)</summary>
public long[] random_ids;
}
/// <summary>The entire message history has been deleted. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionFlushHistory"/></summary>
[TLDef(0x6719E45C)]
public partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { }
}
namespace Layer17
{
///<summary>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadVideoAction"/></summary>
/// <summary>User is uploading a video. <br/>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadVideoAction"/></summary>
[TLDef(0x92042FF7)]
public partial class SendMessageUploadVideoAction : SendMessageAction { }
///<summary>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadAudioAction"/></summary>
/// <summary>User is uploading a voice message. <br/>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadAudioAction"/></summary>
[TLDef(0xE6AC8A6F)]
public partial class SendMessageUploadAudioAction : SendMessageAction { }
///<summary>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadPhotoAction"/></summary>
/// <summary>User is uploading a photo. <br/>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadPhotoAction"/></summary>
[TLDef(0x990A3C1A)]
public partial class SendMessageUploadPhotoAction : SendMessageAction { }
///<summary>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadDocumentAction"/></summary>
/// <summary>User is uploading a file. <br/>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadDocumentAction"/></summary>
[TLDef(0x8FAEE98E)]
public partial class SendMessageUploadDocumentAction : SendMessageAction { }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
/// <summary>Contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
[TLDef(0x204D3878)]
public partial class DecryptedMessage : DecryptedMessageBase
{
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;
/// <summary>Media content</summary>
public DecryptedMessageMedia media;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public override long RandomId => random_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageService"/></summary>
/// <summary>Contents of an encrypted service message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageService"/></summary>
[TLDef(0x73164160)]
public partial class DecryptedMessageService : DecryptedMessageBase
{
/// <summary>Random message ID, assigned by the message author.<br/>Must be equal to the ID passed to the sending method.</summary>
public long random_id;
/// <summary>Action relevant to the service message</summary>
public DecryptedMessageAction action;
/// <summary>Random message ID, assigned by the message author.<br/>Must be equal to the ID passed to the sending method.</summary>
public override long RandomId => random_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
/// <summary>Video attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
[TLDef(0x524A415D)]
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
/// <summary>Content of thumbnail file (JPEG file, quality 55, set in a square 90x90)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>Duration of video in seconds</summary>
public int duration;
/// <summary>MIME-type of the video file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public string mime_type;
/// <summary>Image width</summary>
public int w;
/// <summary>Image height</summary>
public int h;
/// <summary>File size</summary>
public int size;
/// <summary>Key to decrypt the attached video file</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaAudio"/></summary>
/// <summary>Audio file attached to a secret chat message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaAudio"/></summary>
[TLDef(0x57E0A9CB)]
public partial class DecryptedMessageMediaAudio : DecryptedMessageMedia
{
/// <summary>Audio duration in seconds</summary>
public int duration;
/// <summary>MIME-type of the audio file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-13">Layer 13</a>.</summary>
public string mime_type;
/// <summary>File size</summary>
public int size;
/// <summary>Key to decrypt the attached media file</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionResend"/></summary>
/// <summary>Request for the other party in a Secret Chat to automatically resend a contiguous range of previously sent messages, as explained in <a href="https://corefork.telegram.org/api/end-to-end/seq_no">Sequence number is Secret Chats</a>. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionResend"/></summary>
[TLDef(0x511110B0)]
public partial class DecryptedMessageActionResend : DecryptedMessageAction
{
/// <summary><c>out_seq_no</c> of the first message to be resent, with correct parity</summary>
public int start_seq_no;
/// <summary><c>out_seq_no</c> of the last message to be resent, with same parity.</summary>
public int end_seq_no;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionNotifyLayer"/></summary>
/// <summary>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. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionNotifyLayer"/></summary>
[TLDef(0xF3048883)]
public partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { public int layer; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionTyping"/></summary>
public partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction
{
/// <summary>Layer number, must be <strong>17</strong> or higher (this contructor was introduced in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>).</summary>
public int layer;
}
/// <summary>User is preparing a message: typing, recording, uploading, etc. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionTyping"/></summary>
[TLDef(0xCCB27641)]
public partial class DecryptedMessageActionTyping : DecryptedMessageAction { public SendMessageAction action; }
public partial class DecryptedMessageActionTyping : DecryptedMessageAction
{
/// <summary>Type of action</summary>
public SendMessageAction action;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageLayer"/></summary>
/// <summary>Sets the layer number for the contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageLayer"/></summary>
[TLDef(0x1BE31789)]
public partial class DecryptedMessageLayer : ITLObject
{
/// <summary>Set of random bytes to prevent content recognition in short encrypted messages.<br/>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.<br/>Parameter moved here from <see cref="DecryptedMessage"/> in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public byte[] random_bytes;
/// <summary>Layer number. Mimimal value - <strong>17</strong> (the layer in which the constructor was added).</summary>
public int layer;
/// <summary>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<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public int in_seq_no;
/// <summary>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<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public int out_seq_no;
/// <summary>The content of message itself</summary>
public DecryptedMessageBase message;
}
}
namespace Layer45
{
///<summary>See <a href="https://corefork.telegram.org/constructor/documentAttributeSticker"/></summary>
/// <summary>Defines a sticker <br/>See <a href="https://corefork.telegram.org/constructor/documentAttributeSticker"/></summary>
[TLDef(0x3A556302)]
public partial class DocumentAttributeSticker : DocumentAttribute
{
/// <summary>Alternative emoji representation of sticker</summary>
public string alt;
/// <summary>Associated stickerset</summary>
public InputStickerSet stickerset;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/documentAttributeAudio"/></summary>
/// <summary>Represents an audio file <br/>See <a href="https://corefork.telegram.org/constructor/documentAttributeAudio"/></summary>
[TLDef(0xDED218E0)]
public partial class DocumentAttributeAudio : DocumentAttribute
{
/// <summary>Duration in seconds</summary>
public int duration;
/// <summary>Name of song</summary>
public string title;
/// <summary>Performer</summary>
public string performer;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
/// <summary>Contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
[TLDef(0x36B091DE)]
public partial class DecryptedMessage : DecryptedMessageBase
{
[Flags] public enum Flags { has_reply_to_random_id = 0x8, has_entities = 0x80, has_media = 0x200, has_via_bot_name = 0x800 }
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a> (added in layer 45)</summary>
public Flags flags;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;
/// <summary>Media content</summary>
[IfFlag(9)] public DecryptedMessageMedia media;
/// <summary>Message <a href="https://corefork.telegram.org/api/entities">entities</a> for styled text (parameter added in layer 45)</summary>
[IfFlag(7)] public MessageEntity[] entities;
/// <summary>Specifies the ID of the inline bot that generated the message (parameter added in layer 45)</summary>
[IfFlag(11)] public string via_bot_name;
/// <summary>Random message ID of the message this message replies to (parameter added in layer 45)</summary>
[IfFlag(3)] public long reply_to_random_id;
[Flags] public enum Flags
{
/// <summary>Field <see cref="reply_to_random_id"/> has a value</summary>
has_reply_to_random_id = 0x8,
/// <summary>Field <see cref="entities"/> has a value</summary>
has_entities = 0x80,
/// <summary>Field <see cref="media"/> has a value</summary>
has_media = 0x200,
/// <summary>Field <see cref="via_bot_name"/> has a value</summary>
has_via_bot_name = 0x800,
}
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public override long RandomId => random_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaPhoto"/></summary>
/// <summary>Photo attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaPhoto"/></summary>
[TLDef(0xF1FA8D78)]
public partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia
{
/// <summary>Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>Photo width</summary>
public int w;
/// <summary>Photo height</summary>
public int h;
/// <summary>Size of the photo in bytes</summary>
public int size;
/// <summary>Key to decrypt an attached file with a full version</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
/// <summary>Caption</summary>
public string caption;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
/// <summary>Video attached to an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVideo"/></summary>
[TLDef(0x970C8C0E)]
public partial class DecryptedMessageMediaVideo : DecryptedMessageMedia
{
/// <summary>Content of thumbnail file (JPEG file, quality 55, set in a square 90x90)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>Duration of video in seconds</summary>
public int duration;
/// <summary>MIME-type of the video file<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public string mime_type;
/// <summary>Image width</summary>
public int w;
/// <summary>Image height</summary>
public int h;
/// <summary>File size</summary>
public int size;
/// <summary>Key to decrypt the attached video file</summary>
public byte[] key;
/// <summary>Initialization vector</summary>
public byte[] iv;
/// <summary>Caption</summary>
public string caption;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaDocument"/></summary>
/// <summary>Document attached to a message in a secret chat. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaDocument"/></summary>
[TLDef(0x7AFE8AE2)]
public partial class DecryptedMessageMediaDocument : DecryptedMessageMedia
{
/// <summary>Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square)</summary>
public byte[] thumb;
/// <summary>Thumbnail width</summary>
public int thumb_w;
/// <summary>Thumbnail height</summary>
public int thumb_h;
/// <summary>File MIME-type</summary>
public string mime_type;
/// <summary>Document size</summary>
public int size;
/// <summary>Key to decrypt the attached document file</summary>
public byte[] key;
/// <summary>Initialization</summary>
public byte[] iv;
/// <summary>Document attributes for media types</summary>
public DocumentAttribute[] attributes;
/// <summary>Caption</summary>
public string caption;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVenue"/></summary>
/// <summary>Venue <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaVenue"/></summary>
[TLDef(0x8A0DF56F)]
public partial class DecryptedMessageMediaVenue : DecryptedMessageMedia
{
/// <summary>Latitude of venue</summary>
public double lat;
/// <summary>Longitude of venue</summary>
public double long_;
/// <summary>Venue name</summary>
public string title;
/// <summary>Address</summary>
public string address;
/// <summary>Venue provider: currently only "foursquare" needs to be supported</summary>
public string provider;
/// <summary>Venue ID in the provider's database</summary>
public string venue_id;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaWebPage"/></summary>
/// <summary>Webpage preview <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaWebPage"/></summary>
[TLDef(0xE50511D8)]
public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia { public string url; }
public partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia
{
/// <summary>URL of webpage</summary>
public string url;
}
}
namespace Layer73
{
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
/// <summary>Contents of an encrypted message. <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessage"/></summary>
[TLDef(0x91CC4674)]
public partial class DecryptedMessage : DecryptedMessageBase
{
[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 }
/// <summary>Flags, see <a href="https://corefork.telegram.org/mtproto/TL-combinators#conditional-fields">TL conditional fields</a> (added in layer 45)</summary>
public Flags flags;
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public long random_id;
/// <summary>Message lifetime. Has higher priority than <see cref="Layer8.DecryptedMessageActionSetMessageTTL"/>.<br/>Parameter added in <a href="https://corefork.telegram.org/api/layers#layer-17">Layer 17</a>.</summary>
public int ttl;
/// <summary>Message text</summary>
public string message;
/// <summary>Media content</summary>
[IfFlag(9)] public DecryptedMessageMedia media;
/// <summary>Message <a href="https://corefork.telegram.org/api/entities">entities</a> for styled text (parameter added in layer 45)</summary>
[IfFlag(7)] public MessageEntity[] entities;
/// <summary>Specifies the ID of the inline bot that generated the message (parameter added in layer 45)</summary>
[IfFlag(11)] public string via_bot_name;
/// <summary>Random message ID of the message this message replies to (parameter added in layer 45)</summary>
[IfFlag(3)] public long reply_to_random_id;
/// <summary>Random group ID, assigned by the author of message.<br/>Multiple encrypted messages with a photo attached and with the same group ID indicate an <a href="https://corefork.telegram.org/api/files#albums-grouped-media">album or grouped media</a> (parameter added in layer 45)</summary>
[IfFlag(17)] public long grouped_id;
[Flags] public enum Flags
{
/// <summary>Field <see cref="reply_to_random_id"/> has a value</summary>
has_reply_to_random_id = 0x8,
/// <summary>Field <see cref="entities"/> has a value</summary>
has_entities = 0x80,
/// <summary>Field <see cref="media"/> has a value</summary>
has_media = 0x200,
/// <summary>Field <see cref="via_bot_name"/> has a value</summary>
has_via_bot_name = 0x800,
/// <summary>Field <see cref="grouped_id"/> has a value</summary>
has_grouped_id = 0x20000,
}
/// <summary>Random message ID, assigned by the author of message.<br/>Must be equal to the ID passed to sending method.</summary>
public override long RandomId => random_id;
}
}
namespace Layer20
{
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionRequestKey"/></summary>
/// <summary>Request rekeying, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a> <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionRequestKey"/></summary>
[TLDef(0xF3C9611B)]
public partial class DecryptedMessageActionRequestKey : DecryptedMessageAction
{
/// <summary>Exchange ID</summary>
public long exchange_id;
/// <summary>g_a, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a></summary>
public byte[] g_a;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionAcceptKey"/></summary>
/// <summary>Accept new key <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionAcceptKey"/></summary>
[TLDef(0x6FE1735B)]
public partial class DecryptedMessageActionAcceptKey : DecryptedMessageAction
{
/// <summary>Exchange ID</summary>
public long exchange_id;
/// <summary>B parameter, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a></summary>
public byte[] g_b;
/// <summary>Key fingerprint, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a></summary>
public long key_fingerprint;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionAbortKey"/></summary>
/// <summary>Abort rekeying <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionAbortKey"/></summary>
[TLDef(0xDD05EC6B)]
public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction { public long exchange_id; }
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionCommitKey"/></summary>
public partial class DecryptedMessageActionAbortKey : DecryptedMessageAction
{
/// <summary>Exchange ID</summary>
public long exchange_id;
}
/// <summary>Commit new key, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a> <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionCommitKey"/></summary>
[TLDef(0xEC2E0B9B)]
public partial class DecryptedMessageActionCommitKey : DecryptedMessageAction
{
/// <summary>Exchange ID, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a></summary>
public long exchange_id;
/// <summary>Key fingerprint, see <a href="https://corefork.telegram.org/api/end-to-end/pfs">rekeying process</a></summary>
public long key_fingerprint;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionNoop"/></summary>
/// <summary>NOOP action <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageActionNoop"/></summary>
[TLDef(0xA82FDD63)]
public partial class DecryptedMessageActionNoop : DecryptedMessageAction { }
}
namespace Layer23
{
///<summary>See <a href="https://corefork.telegram.org/constructor/photoSize"/></summary>
/// <summary>Image description. <br/>See <a href="https://corefork.telegram.org/constructor/photoSize"/></summary>
[TLDef(0x77BFB61B)]
public partial class PhotoSize : PhotoSizeBase
{
/// <summary>Thumbnail type</summary>
public string type;
public FileLocationBase location;
/// <summary>Image width</summary>
public int w;
/// <summary>Image height</summary>
public int h;
/// <summary>File size</summary>
public int size;
/// <summary>Thumbnail type</summary>
public override string Type => type;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/photoCachedSize"/></summary>
/// <summary>Description of an image and its content. <br/>See <a href="https://corefork.telegram.org/constructor/photoCachedSize"/></summary>
[TLDef(0xE9A734FA)]
public partial class PhotoCachedSize : PhotoSizeBase
{
/// <summary>Thumbnail type</summary>
public string type;
public FileLocationBase location;
/// <summary>Image width</summary>
public int w;
/// <summary>Image height</summary>
public int h;
/// <summary>Binary data, file content</summary>
public byte[] bytes;
/// <summary>Thumbnail type</summary>
public override string Type => type;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/documentAttributeSticker"/></summary>
/// <summary>Defines a sticker <br/>See <a href="https://corefork.telegram.org/constructor/documentAttributeSticker"/></summary>
[TLDef(0xFB0A5727)]
public partial class DocumentAttributeSticker : DocumentAttribute { }
///<summary>See <a href="https://corefork.telegram.org/constructor/documentAttributeVideo"/></summary>
/// <summary>Defines a video <br/>See <a href="https://corefork.telegram.org/constructor/documentAttributeVideo"/></summary>
[TLDef(0x5910CCCB)]
public partial class DocumentAttributeVideo : DocumentAttribute
{
/// <summary>Duration in seconds</summary>
public int duration;
/// <summary>Video width</summary>
public int w;
/// <summary>Video height</summary>
public int h;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/documentAttributeAudio"/></summary>
/// <summary>Represents an audio file <br/>See <a href="https://corefork.telegram.org/constructor/documentAttributeAudio"/></summary>
[TLDef(0x051448E5)]
public partial class DocumentAttributeAudio : DocumentAttribute { public int duration; }
public partial class DocumentAttributeAudio : DocumentAttribute
{
/// <summary>Duration in seconds</summary>
public int duration;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaExternalDocument"/></summary>
/// <summary>Non-e2e documented forwarded from non-secret chat <br/>See <a href="https://corefork.telegram.org/constructor/decryptedMessageMediaExternalDocument"/></summary>
[TLDef(0xFA95B0DD)]
public partial class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia
{
/// <summary>Document ID</summary>
public long id;
/// <summary>access hash</summary>
public long access_hash;
/// <summary>Date</summary>
public DateTime date;
/// <summary>Mime type</summary>
public string mime_type;
/// <summary>Size</summary>
public int size;
/// <summary>Thumbnail</summary>
public PhotoSizeBase thumb;
/// <summary>DC ID</summary>
public int dc_id;
/// <summary>Attributes for media types</summary>
public DocumentAttribute[] attributes;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/fileLocationUnavailable"/></summary>
/// <summary>File is currently unavailable. <br/>See <a href="https://corefork.telegram.org/constructor/fileLocationUnavailable"/></summary>
[TLDef(0x7C596B46)]
public partial class FileLocationUnavailable : FileLocationBase
{
/// <summary>Server volume</summary>
public long volume_id;
/// <summary>File ID</summary>
public int local_id;
/// <summary>Checksum to access the file</summary>
public long secret;
/// <summary>Server volume</summary>
public override long VolumeId => volume_id;
/// <summary>File ID</summary>
public override int LocalId => local_id;
/// <summary>Checksum to access the file</summary>
public override long Secret => secret;
}
///<summary>See <a href="https://corefork.telegram.org/constructor/fileLocation"/></summary>
/// <summary>File location. <br/>See <a href="https://corefork.telegram.org/constructor/fileLocation"/></summary>
[TLDef(0x53D69076)]
public partial class FileLocation : FileLocationBase
{
/// <summary>Number of the data center holding the file</summary>
public int dc_id;
/// <summary>Server volume</summary>
public long volume_id;
/// <summary>File ID</summary>
public int local_id;
/// <summary>Checksum to access the file</summary>
public long secret;
/// <summary>Server volume</summary>
public override long VolumeId => volume_id;
/// <summary>File ID</summary>
public override int LocalId => local_id;
/// <summary>Checksum to access the file</summary>
public override long Secret => secret;
}
}
namespace Layer66
{
///<summary>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadRoundAction"/></summary>
/// <summary>User is uploading a round video <br/>See <a href="https://corefork.telegram.org/constructor/sendMessageUploadRoundAction"/></summary>
[TLDef(0xBB718624)]
public partial class SendMessageUploadRoundAction : SendMessageAction { }
}