diff --git a/src/Generator.cs b/src/Generator.cs deleted file mode 100644 index 009be0d..0000000 --- a/src/Generator.cs +++ /dev/null @@ -1,967 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Net.Http; -using System.Text; -using System.Text.Json; -using System.Text.RegularExpressions; -using System.Threading.Tasks; - -namespace WTelegram -{ - public class Generator - { - readonly Dictionary ctorToTypes = new(); - readonly HashSet allTypes = new(); - readonly Dictionary knownStyles = new() { ["InitConnection"] = 1, ["Help_GetConfig"] = 0, ["HttpWait"] = -1 }; - readonly Dictionary typeInfos = new(); - readonly HashSet enumTypes = new(); - readonly Dictionary enumValues = new(); - readonly HashSet nullableCtor = new(); - int currentLayer; - string tabIndent; - private string currentJson; - - public async Task FromWeb() - { - Console.WriteLine("Fetch web pages..."); -#if DEBUG - currentLayer = await Task.FromResult(TL.Layer.Version); -#else - 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); - //File.WriteAllBytes("TL.MTProto.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/mtproto-json")); - //File.WriteAllBytes("TL.Schema.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/json")); - File.WriteAllBytes("TL.MTProto.tl", await http.GetByteArrayAsync("https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/mtproto.tl")); - File.WriteAllBytes("TL.Schema.tl", await http.GetByteArrayAsync("https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/tl/api.tl")); - File.WriteAllBytes("TL.Secret.json", await http.GetByteArrayAsync("https://core.telegram.org/schema/end-to-end-json")); -#endif - //FromJson("TL.MTProto.json", "TL.MTProto.cs", @"TL.Table.cs"); - //FromJson("TL.Schema.json", "TL.Schema.cs", @"TL.Table.cs"); - FromTL("TL.MTProto.tl", "TL.MTProto.cs"); - FromTL("TL.Schema.tl", "TL.Schema.cs"); - FromJson("TL.Secret.json", "TL.Secret.cs"); - } - - private void FromTL(string tlPath, string outputCs) - { - using var sr = new StreamReader(tlPath); - var schema = new SchemaJson { constructors = new(), methods = new() }; - string line; - bool inFunctions = false; - while ((line = sr.ReadLine()) != null) - { - line = line.Trim(); - if (line == "---functions---") - inFunctions = true; - else if (line == "---types---") - inFunctions = false; - else if (line.StartsWith("// LAYER ")) - currentLayer = int.Parse(line[9..]); - else if (line != "" && !line.StartsWith("//")) - { - if (!line.EndsWith(";")) System.Diagnostics.Debugger.Break(); - var words = line.Split(' '); - int hash = words[0].IndexOf('#'); - if (hash == -1) { Console.WriteLine(line); continue; } - if (words[^2] != "=") { Console.WriteLine(line); continue; } - string name = words[0][0..hash]; - int id = int.Parse(words[0][(hash + 1)..], System.Globalization.NumberStyles.HexNumber); - string type = words[^1].TrimEnd(';'); - var @params = words[1..^2].Where(word => word != "{X:Type}").Select(word => - { - int colon = word.IndexOf(':'); - string name = word[0..colon]; - string type = word[(colon + 1)..]; - if (type == "string" && outputCs == "TL.MTProto.cs" && !name.Contains("message")) type = "bytes"; - return new Param { name = name, type = type }; - }).ToArray(); - if (inFunctions) - schema.methods.Add(new Method { id = id.ToString(), method = name, type = type, @params = @params }); - else - schema.constructors.Add(new Constructor { id = id.ToString(), predicate = name, type = type, @params = @params }); - } - } - FromSchema(schema, outputCs); - } - - public void FromJson(string jsonPath, string outputCs) - { - Console.WriteLine("Parsing " + jsonPath); - var schema = JsonSerializer.Deserialize(File.ReadAllText(jsonPath)); - FromSchema(schema, outputCs); - } - - internal void FromSchema(SchemaJson schema, string outputCs) - { - currentJson = Path.GetFileNameWithoutExtension(outputCs); - using var sw = new StreamWriter(outputCs, false, Encoding.UTF8); - sw.WriteLine("// This file is generated automatically using the Generator class"); - sw.WriteLine("using System;"); - sw.WriteLine("using System.Collections.Generic;"); - if (schema.methods.Count != 0) sw.WriteLine("using System.Threading.Tasks;"); - sw.WriteLine(); - sw.WriteLine("namespace TL"); - sw.WriteLine("{"); - sw.WriteLine("\tusing BinaryWriter = System.IO.BinaryWriter;"); - sw.WriteLine("\tusing Client = WTelegram.Client;"); - tabIndent = "\t"; - foreach (var ctor in schema.constructors) - { - if (ctorToTypes.ContainsKey(ctor.ID)) continue; - if (ctor.type == "Vector t") continue; - var structName = CSharpName(ctor.predicate); - 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; nullableCtor.Add(ctor.predicate); } - if (typeInfo.ReturnName == null) typeInfo.ReturnName = CSharpName(ctor.type); - typeInfo.Structs.Add(ctor); - if (structName == typeInfo.ReturnName) typeInfo.MainClass = ctor; - } - foreach (var (name, typeInfo) in typeInfos) - { - if (allTypes.Contains(typeInfo.ReturnName)) - { - if (typeInfos.TryGetValue(typeInfo.ReturnName, out var existingType)) - { - typeInfo.ReturnName = existingType.ReturnName; - typeInfo.MainClass = existingType.MainClass; - } - continue; - } - - if (typeInfo.Structs.All(ctor => ctor.@params.Length == 0)) - typeInfo.AsEnum = true; - var nullable = typeInfo.Structs.Where(c => c.predicate == "help.noAppUpdate" || - c.predicate.EndsWith("Empty") || c.predicate.EndsWith("Unknown") || c.predicate.EndsWith("NotModified")).ToList(); - if (nullable.Count == 1 && nullable[0].@params.Length == 0 && !typeInfo.AsEnum) - { - typeInfo.Nullable = nullable[0]; - typeInfo.Structs.Remove(typeInfo.Nullable); - ctorToTypes[typeInfo.Nullable.ID] += "=null"; - nullableCtor.Add(typeInfo.Nullable.predicate); - } - if (typeInfo.MainClass == null) - { - List fakeCtorParams = new(); - if (typeInfo.Structs.Count > 1) - { - while (typeInfo.Structs[0].@params.Length > fakeCtorParams.Count) - { - fakeCtorParams.Add(typeInfo.Structs[0].@params[fakeCtorParams.Count]); - if (!typeInfo.Structs.All(ctor => HasPrefix(ctor, fakeCtorParams))) - { - fakeCtorParams.RemoveAt(fakeCtorParams.Count - 1); - break; - } - } - if (fakeCtorParams.Count == 0) - while (typeInfo.Structs[0].@params.Length > fakeCtorParams.Count) - { - fakeCtorParams.Insert(0, typeInfo.Structs[0].@params[^(fakeCtorParams.Count + 1)]); - if (!typeInfo.Structs.All(ctor => HasSuffix(ctor, fakeCtorParams))) - { - fakeCtorParams.RemoveAt(0); - break; - } - } - } - typeInfo.MainClass = new Constructor { id = null, @params = fakeCtorParams.ToArray(), predicate = typeInfo.ReturnName, type = name }; - typeInfo.Structs.Insert(0, typeInfo.MainClass); - typeInfo.CommonFields = fakeCtorParams.Count; // generation of abstract main class with some common fields - } - else if (typeInfo.Structs.Count > 1) - { - if (typeInfo.Structs.All(ctor => ctor == typeInfo.MainClass || HasPrefix(ctor, typeInfo.MainClass.@params) || HasSuffix(ctor, typeInfo.MainClass.@params))) - typeInfo.CommonFields = typeInfo.MainClass.@params.Length; - else - { - // the previous MainClass (ctor have the same name as ReturnName) is incompatible with other classes fields - typeInfo.MainClass = new Constructor { id = null, @params = Array.Empty(), predicate = typeInfo.ReturnName + "Base", type = name }; - typeInfo.Structs.Insert(0, typeInfo.MainClass); - typeInfo.ReturnName = typeInfo.MainClass.predicate; - } - typeInfo.AbstractUserOrChat = AbstractUserOrChatTypes.Contains(typeInfo.ReturnName); - if (typeInfo.CommonFields == 0) - { - var autoProps = typeInfo.Structs.OrderByDescending(s => s.@params.Length).First().@params - .Where(p => !p.type.EndsWith("?true")).ToList(); - if (typeInfo.AbstractUserOrChat) { autoProps.Remove(ParamUsers); autoProps.Remove(ParamChats); } - autoProps.Remove(ParamFlags); - 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; - for (int i = autoProps.Count - 1; i >= 0; i--) - if (!str.@params.Contains(autoProps[i])) - autoProps.RemoveAt(i); - if (autoProps.Count == 0) break; - ++autoPropsCount; - } - if (autoProps.Count > 0 && autoPropsCount > 1) - 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 - foreach (var typeInfo in typeInfos.Values) - WriteTypeInfo(sw, typeInfo, 0); - foreach (var layer in layers) - { - if (layer != 0) - { - sw.WriteLine(); - sw.WriteLine("\tnamespace Layer" + layer); - sw.Write("\t{"); - tabIndent += "\t"; - } - foreach (var typeInfo in typeInfos.Values) - WriteTypeInfo(sw, typeInfo, layer); - if (layer != 0) - { - sw.WriteLine("\t}"); - tabIndent = tabIndent[1..]; - } - } - if (typeInfos.GetValueOrDefault("Message")?.MainClass.ID == 0x5BB8E511) typeInfos.Remove("Message"); - - if (schema.methods.Count != 0) - { - var ping = schema.methods.FirstOrDefault(m => m.method == "ping"); - if (ping != null) - { - var typeInfo = new TypeInfo { ReturnName = ping.type, MainClass = - new Constructor { id = ping.id, @params = ping.@params, predicate = ping.method, type = ping.type } }; - typeInfo.Structs.Add(typeInfo.MainClass); - ctorToTypes[int.Parse(ping.id)] = CSharpName(ping.method); - WriteTypeInfo(sw, typeInfo, 0); - } - sw.WriteLine(); - sw.WriteLine("\t// ---functions---"); - sw.WriteLine(); - sw.WriteLine($"\tpublic static class {currentJson[3..]}"); - //sw.WriteLine("\tpublic static partial class Fn // ---functions---"); - sw.Write("\t{"); - tabIndent = "\t\t"; - foreach (var method in schema.methods) - { - WriteMethod(sw, method); - //var typeInfo = new TypeInfo { ReturnName = method.type }; - //typeInfo.Structs.Add(new Constructor { id = method.id, @params = method.@params, predicate = method.method, type = method.type }); - //methods.Add(typeInfo); - //WriteTypeInfo(sw, typeInfo, "", true); - } - sw.WriteLine("\t}"); - } - sw.WriteLine("}"); - - UpdateTable("TL.Table.cs"); - } - - void WriteTypeInfo(StreamWriter sw, TypeInfo typeInfo, int layer) - { - var genericType = typeInfo.ReturnName.Length == 1 ? $"<{typeInfo.ReturnName}>" : null; - bool needNewLine = true; - int commonFields = 0; - foreach (var ctor in typeInfo.Structs) - { - if (ctor.layer != layer) continue; - int ctorId = ctor.ID; - string className = CSharpName(ctor.predicate) + genericType; - if (!allTypes.Add((layer == 0 ? "" : $"Layer{layer}.") + className)) continue; - 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 (typeInfo.AsEnum) - { - 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 - { - string tldefReverse = null; - if (commonFields != 0) - { - if (ctor.@params[0].name == typeInfo.MainClass.@params[0].name) - parms = ctor.@params.Skip(commonFields).ToArray(); - else - { - parms = ctor.@params.Take(ctor.@params.Length - commonFields).ToArray(); - tldefReverse = ", inheritAfter = true"; - } - } - else - { - foreach (var other in typeInfo.Structs) - { - if (other == ctor) continue; - var otherParams = other.@params; - if (otherParams.Length <= commonFields) continue; - if (!IsDerivedName(ctor.predicate, other.predicate)) continue; - if (HasPrefix(ctor, otherParams)) - { - parms = ctor.@params.Skip(otherParams.Length).ToArray(); - tldefReverse = null; - } - else if (HasSuffix(ctor, otherParams)) - { - parms = ctor.@params.Take(ctor.@params.Length - otherParams.Length).ToArray(); - tldefReverse = ", inheritAfter = true"; - } - else continue; - commonFields = otherParams.Length; - parentClass = CSharpName(other.predicate) + genericType; - } - } - if (currentJson != "TL.MTProto") - sw.WriteLine($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})]"); - else - { - sw.Write($"{tabIndent}[TLDef(0x{ctor.ID:X8}{tldefReverse})] //{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 partial class {className}"); - //sw.Write(skipParams == 0 && typeInfo.NeedAbstract > 0 ? "ITLObject" : parentClass); - } - sw.Write(" : "); - sw.Write(parentClass); - if (parms.Length == 0 && !typeInfo.AbstractUserOrChat && typeInfo.AutoProps == null) - { - sw.WriteLine(" { }"); - commonFields = typeInfo.CommonFields; - continue; - } - var paramDoc = webDoc?.GetValueOrDefault("Parameters").table; - var hasFlagEnum = parms.Any(p => p.type.StartsWith("flags.")); - 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/// {doc}"); - 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.WriteLine($"{tabIndent}\tpublic {MapType(parm.type, parm.name)} {MapName(parm.name)};"); - } - } - if (hasFlagEnum) - { - sw.WriteLine(); - var list = new SortedList(); - var flagDoc = new Dictionary(); - 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; - 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 has a value"; - var name = MapName("has_" + parm.name); - if (list.Values.Contains(name)) name += "_field"; - list[mask] = name; - } - sw.WriteLine(tabIndent + "\t[Flags] public enum Flags"); - sw.WriteLine(tabIndent + "\t{"); - foreach (var (mask, name) in list) - { - if (flagDoc.TryGetValue(mask, out var summary)) sw.WriteLine($"{tabIndent}\t\t/// {summary}"); - sw.WriteLine($"{tabIndent}\t\t{name} = 0x{mask:X},"); - } - sw.WriteLine(tabIndent + "\t}"); - } - if (typeInfo.AutoProps != null) - { - bool firstLine = parms.Length != 0 || hasFlagEnum; - string format = $"{tabIndent}\tpublic "; - if (ctorId == 0) - format += "abstract {0} {1} {{ get; }}"; - else if (ctor == typeInfo.MainClass) - format += "virtual {0} {1} => {2};"; - else - format += "override {0} {1} => {2};"; - foreach (var parm in typeInfo.AutoProps) - { - var value = "default"; - if (ctor.@params.Any(p => p.name == parm.name)) - if (!parms.Any(p => p.name == parm.name)) continue; - else value = MapName(parm.name); - else if (parm.type.StartsWith("Vector<") && className.EndsWith("Empty")) - value = $"Array.Empty<{MapType(parm.type, parm.name).TrimEnd('[', ']')}>()"; - 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/// {doc}"); - sw.WriteLine(string.Format(format, MapType(parm.type, parm.name), csName, value)); - } - } - var hasUsersChats = parms.Contains(ParamUsers) && parms.Contains(ParamChats); - 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/// returns a or for {(withArg ? "the given Peer" : "the result")}"); - sw.Write($"{tabIndent}\tpublic {modifier}IPeerInfo UserOrChat"); - if (withArg) - sw.Write("(Peer peer)"); - if (modifier == "abstract ") - sw.WriteLine(";"); - else if (hasUsersChats) - sw.WriteLine(" => peer.UserOrChat(users, chats);"); - else - sw.WriteLine(" => null;"); - } - - sw.WriteLine(tabIndent + "}"); - commonFields = typeInfo.CommonFields; - } - } - - private Dictionary 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.id == null ? ctor.type : ctor.predicate).descr; - var derived = webDoc?.GetValueOrDefault("Constructors").table; - if (derived != null && !typeInfo.AsEnum) - summary += $"\t\tDerived classes: {string.Join(", ", derived.Keys.Where(k => k != ""))}"; - summary += $"\t\tSee "; - sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); - if (typeInfo.Nullable != null && ctor == typeInfo.MainClass) - sw.WriteLine($"{tabIndent}/// a null value means {typeInfo.Nullable.predicate}"); - 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\tSee "; - sw.WriteLine($"{tabIndent}/// {summary.Trim()}"); - if (paramDoc != null) - foreach (var (name, doc) in paramDoc) - if (name != "flags") - sw.WriteLine($"{tabIndent}/// {doc}"); - if (typeInfos.GetValueOrDefault(method.type)?.Nullable is Constructor nullable) - sw.WriteLine($"{tabIndent}/// a null value means {nullable.predicate}"); - if (excepDoc != null) - sw.WriteLine($"{tabIndent}/// Possible errors: {string.Join(",", new SortedSet(excepDoc.Keys))} (details)"); - } - - private Dictionary 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 table)>(); - var html = File.ReadAllText(path); - foreach (var section in html[html.IndexOf("" }, StringSplitOptions.None)) - { - var index = 0; - do { index = section.IndexOf('>', index) + 1; } while (section[index] == '<'); - var title = section[index..section.IndexOf("")) >= 0) - { - descr = rest[(index + 3)..rest.IndexOf("

", index)]; - rest = rest[(index + 7 + descr.Length)..].Trim(); - descr = ProcessDescr(descr); - } - Dictionary table = null; - if (rest.StartsWith("", rowIndex)) >= 0) - { - var row = rest[(rowIndex + 4)..rest.IndexOf("", rowIndex)]; - rowIndex += row.Length; - index = row.IndexOf("', index) + 1; - var name = row[index..row.IndexOf("") && name.EndsWith("")) name = name[8..^9]; - index = row.IndexOf("', index) + 1; - var value = row[index..row.IndexOf("= 0) - { - //if (!value.StartsWith("<") && value != "!X") name = $"{name} {value}"; - index = row.IndexOf('>', index) + 1; - value = row[index..row.IndexOf("= 0) - { - var url = str[(index + 9)..str.IndexOf('"', index + 9)]; - var close = str.IndexOf("", index) + 4; - if (url.StartsWith("/constructor/")) - if (url == "/constructor/decryptedMessageActionSetMessageTTL") - str = $"{str[0..index]}{str[close..]}"; - else if (nullableCtor.Contains(url[13..])) - str = $"{str[0..index]}{str[close..]}"; - else - str = $"{str[0..index]}{str[close..]}"; - else if (url.StartsWith("/type/")) - if (url == "/type/DecryptedMessage") - str = $"{str[0..index]}{str[close..]}"; - else - str = $"{str[0..index]}{str[close..]}"; - else if (url.StartsWith("/")) - str = str.Insert(index + 9, "https://corefork.telegram.org"); - } - index = -1; - while ((index = str.IndexOf("= 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("
", "
").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" }; - static readonly Param ParamChats = new() { name = "chats", type = "Vector" }; - static readonly HashSet AbstractUserOrChatTypes = new() { - "Messages_MessagesBase", "Updates_DifferenceBase", "Updates_ChannelDifferenceBase", - "Messages_DialogsBase" - }; - - private static bool IsDerivedName(string derived, string basename) - { - int left, right; - if (basename.Length >= derived.Length) return false; - for (left = 0; left < basename.Length; left++) - if (basename[left] != derived[left]) - break; - if (left == 0) return false; - for (right = 1; left + right <= basename.Length; right++) - if (basename[^right] != derived[^right]) - break; - return left + right > basename.Length; - } - - private void WriteTypeAsEnum(StreamWriter sw, TypeInfo typeInfo, Dictionary table)> webDoc) - { - var valuesDoc = webDoc?["Constructors"].table; - sw.WriteLine($"{tabIndent}public enum {typeInfo.ReturnName} : uint"); - sw.WriteLine($"{tabIndent}{{"); - foreach (var ctor in typeInfo.Structs) - { - if (ctor.id == null) continue; - string enumValue = enumValues[ctor.predicate]; - var summary = valuesDoc?[$""] ?? $"See "; - sw.WriteLine($"{tabIndent}\t///{summary}"); - sw.WriteLine($"{tabIndent}\t{enumValue[(enumValue.IndexOf('.') + 1)..]} = 0x{ctor.ID:X8},"); - } - sw.WriteLine($"{tabIndent}}}"); - } - - - private static string MapName(string name) => name switch - { - "out" => "out_", - "static" => "static_", - "long" => "long_", - "default" => "default_", - "public" => "public_", - "params" => "params_", - "private" => "private_", - _ => name - }; - - private string MapType(string type, string name) - { - if (type.StartsWith("flags.")) type = type[(type.IndexOf('?') + 1)..]; - if (type.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) - { - if (name == "users" && type == "Vector") - return $"Dictionary"; - else if (name == "chats" && type == "Vector") - return $"Dictionary"; - return MapType(type[7..^1], name) + "[]"; - } - else if (type == "Bool") - return "bool"; - else if (type == "bytes") - return "byte[]"; - else if (type == "int128") - return "Int128"; - else if (type == "int256") - return "Int256"; - else if (type == "Object") - return "ITLObject"; - else if (type == "!X") - return "ITLFunction"; - else if (type == "int") - { - var name2 = '_' + name + '_'; - if (name2.EndsWith("_date_") || name2.EndsWith("_time_") || name2.StartsWith("_valid_") || - name2 == "_expires_" || name2 == "_expires_at_" || name2 == "_now_") - return "DateTime"; - else - return "int"; - } - else if (type == "string") - return name.StartsWith("md5") ? "byte[]" : "string"; - else if (type == "long" || type == "double" || type == "X") - 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)) - if (layer.Value.TryGetValue(type, out typeInfo)) - return layer.Key == 0 ? typeInfo.ReturnName : $"Layer{layer.Key}.{typeInfo.ReturnName}";*/ - return CSharpName(type); - } - } - - private string MapOptionalType(string type, string name) - { - if (type == "Bool") - return "bool?"; - else if (type == "long") - return "long?"; - else if (type == "double") - return "double?"; - else if (type == "int128") - return "Int128?"; - else if (type == "int256") - return "Int256?"; - else if (type == "int") - { - var name2 = '_' + name + '_'; - if (name2.EndsWith("_date_") || name2.EndsWith("_time_") || name2 == "_expires_" || name2 == "_now_" || name2.StartsWith("_valid_")) - return "DateTime?"; - else - return "int?"; - } - else - return MapType(type, name); - } - - private void WriteMethod(StreamWriter sw, Method method) - { - int ctorNb = int.Parse(method.id); - var funcName = CSharpName(method.method); - string returnType = MapType(method.type, ""); - int style = knownStyles.GetValueOrDefault(funcName, 2); - // 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") - { - if (method.type is not "FutureSalts" and not "Pong") callAsync = "CallBareAsync"; - sw.Write($"{tabIndent}//{method.method}#{ctorNb:x8} "); - if (method.type.Length == 1) sw.Write($"{{{method.type}:Type}} "); - foreach (var parm in method.@params) sw.Write($"{parm.name}:{parm.type} "); - sw.WriteLine($"= {method.type}"); - } - - if (style == 0) sw.WriteLine($"{tabIndent}public static Task<{returnType}> {funcName}(this Client client) => client.{callAsync}<{returnType}>({funcName});"); - if (style == 0) sw.Write($"{tabIndent}public static string {funcName}(BinaryWriter writer"); - if (style == 1) sw.Write($"{tabIndent}public static ITLFunction {funcName}("); - if (style == 2) sw.Write($"{tabIndent}public static Task<{returnType}> {funcName}(this Client client"); - bool first = style == 1; - foreach (var parm in method.@params) // output non-optional parameters - { - if (parm.type == "#" || parm.type.StartsWith("flags.")) continue; - if (first) first = false; else sw.Write(", "); - sw.Write($"{MapType(parm.type, parm.name)} {MapName(parm.name)}"); - } - string flagExpr = null; - foreach (var parm in method.@params) // output optional parameters - { - if (!parm.type.StartsWith("flags.")) continue; - var parmName = MapName(parm.name); - int qm = parm.type.IndexOf('?'); - int bit = int.Parse(parm.type[6..qm]); - if (first) first = false; else sw.Write(", "); - if (parm.type.EndsWith("?true")) - { - sw.Write($"bool {parmName} = false"); - flagExpr += $" | ({parmName} ? 0x{1 << bit:X} : 0)"; - } - else - { - var parmType = parm.type[(qm + 1)..]; - var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; - sw.Write($"{MapOptionalType(parmType, parm.name)} {parmName} = {nullValue}"); - flagExpr += $" | ({parmName} != {nullValue} ? 0x{1 << bit:X} : 0)"; - } - } - if (flagExpr != null) flagExpr = flagExpr.IndexOf('|', 3) >= 0 ? flagExpr[3..] : flagExpr[4..^1]; - sw.WriteLine(")"); - if (style != 0) tabIndent += "\t"; - if (style == 1) sw.WriteLine($"{tabIndent}=> writer =>"); - if (style == 2) sw.WriteLine($"{tabIndent}=> client.{callAsync}<{returnType}>(writer =>"); - sw.WriteLine(tabIndent + "{"); - sw.WriteLine($"{tabIndent}\twriter.Write(0x{ctorNb:X8});"); - foreach (var parm in method.@params) // serialize request - { - var parmName = MapName(parm.name); - var parmType = parm.type; - if (parmType.StartsWith("flags.")) - { - if (parmType.EndsWith("?true")) continue; - int qm = parmType.IndexOf('?'); - parmType = parmType[(qm + 1)..]; - var nullValue = enumTypes.Contains(parmType) ? "default" : "null"; - sw.WriteLine($"{tabIndent}\tif ({parmName} != {nullValue})"); - sw.Write('\t'); - if (MapOptionalType(parmType, parm.name).EndsWith("?")) - parmName += ".Value"; - } - switch (parmType) - { - case "Bool": - sw.WriteLine($"{tabIndent}\twriter.Write({parmName} ? 0x997275B5 : 0xBC799737);"); - break; - case "bytes": - sw.WriteLine($"{tabIndent}\twriter.WriteTLBytes({parmName});"); - break; - case "long": case "int128": case "int256": case "double": - sw.WriteLine($"{tabIndent}\twriter.Write({parmName});"); - break; - case "int": - if (MapType(parmType, parm.name) == "int") - sw.WriteLine($"{tabIndent}\twriter.Write({parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLStamp({parmName});"); - break; - case "string": - if (parm.name.StartsWith("md5")) - sw.WriteLine($"{tabIndent}\twriter.WriteTLBytes({parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLString({parmName});"); - break; - case "#": - sw.WriteLine($"{tabIndent}\twriter.Write({flagExpr});"); - break; - case "!X": - sw.WriteLine($"{tabIndent}\t{parmName}(writer);"); - break; - default: - if (parmType.StartsWith("Vector<", StringComparison.OrdinalIgnoreCase)) - sw.WriteLine($"{tabIndent}\twriter.WriteTLVector({parmName});"); - else if (enumTypes.Contains(parmType)) - sw.WriteLine($"{tabIndent}\twriter.Write((uint){parmName});"); - else - sw.WriteLine($"{tabIndent}\twriter.WriteTLObject({parmName});"); - break; - } - } - sw.WriteLine($"{tabIndent}\treturn \"{funcName}\";"); - if (style == 0) sw.WriteLine(tabIndent + "}"); - if (style == 1) sw.WriteLine(tabIndent + "};"); - if (style == 2) sw.WriteLine(tabIndent + "});"); - if (style != 0) tabIndent = tabIndent[0..^1]; - } - - void UpdateTable(string tableCs) - { - int tableId = 0; - var myTag = $"\t\t\t// from {currentJson}:"; - var seen_ids = new HashSet(); - var seen_nullables = new HashSet(); - using (var sr = new StreamReader(tableCs)) - using (var sw = new StreamWriter(tableCs + ".new", false, Encoding.UTF8)) - { - string line; - while ((line = sr.ReadLine()) != null) - { - if (currentLayer != 0 && line.StartsWith("\t\tpublic const int Version")) - sw.WriteLine($"\t\tpublic const int Version = {currentLayer};\t\t\t\t\t// fetched {DateTime.UtcNow}"); - else - sw.WriteLine(line); - if (line == myTag) - { - switch (++tableId) - { - case 1: - foreach (var ctor in ctorToTypes) - if (seen_ids.Add(ctor.Key)) - if (ctor.Value.EndsWith("=null")) - sw.WriteLine($"\t\t\t[0x{ctor.Key:X8}] = null,//{ctor.Value[..^5]}"); - else - sw.WriteLine($"\t\t\t[0x{ctor.Key:X8}] = typeof({ctor.Value}),"); - break; - case 2: - foreach (var typeInfo in typeInfos.Values) - if (typeInfo.Nullable != null && seen_nullables.Add(typeInfo.ReturnName)) - sw.WriteLine($"\t\t\t[typeof({typeInfo.ReturnName})]{new string(' ', 30 - typeInfo.ReturnName.Length)} = 0x{typeInfo.Nullable.ID:X8}, //{typeInfo.Nullable.predicate}"); - break; - } - while ((line = sr.ReadLine()) != null) - if (line.StartsWith("\t\t\t// ")) - break; - sw.WriteLine(line); - } - else if (line.StartsWith("\t\t\t[0x")) - seen_ids.Add(int.Parse(line[6..14], System.Globalization.NumberStyles.HexNumber)); - else if (line.StartsWith("\t\t\t[typeof(")) - seen_nullables.Add(line[11..line.IndexOf(')')]); - } - } - File.Replace(tableCs + ".new", tableCs, null); - } - - private static bool HasPrefix(Constructor ctor, IList prefixParams) - { - if (ctor.@params.Length < prefixParams.Count) return false; - for (int i = 0; i < prefixParams.Count; i++) - if (ctor.@params[i].name != prefixParams[i].name || ctor.@params[i].type != prefixParams[i].type) - return false; - return true; - } - - private static bool HasSuffix(Constructor ctor, IList prefixParams) - { - if (ctor.@params.Length < prefixParams.Count) return false; - for (int i = 1; i <= prefixParams.Count; i++) - if (ctor.@params[^i].name != prefixParams[^i].name || ctor.@params[^i].type != prefixParams[^i].type) - return false; - return true; - } - - private static string CSharpName(string name) - { - if (name == "id") return "ID"; - name = char.ToUpper(name[0]) + name[1..]; - int i; - while ((i = name.IndexOf('_')) > 0) - name = name[..i] + char.ToUpper(name[i + 1]) + name[(i + 2)..]; - while ((i = name.IndexOf('.')) > 0) - name = name[..i] + '_' + char.ToUpper(name[i + 1]) + name[(i + 2)..]; - return name; - } - - class TypeInfo - { - public string ReturnName; - public Constructor MainClass; - public Constructor Nullable; - public List Structs = new(); - internal int CommonFields; // n fields are common among all those classes - internal bool AsEnum; - internal bool AbstractUserOrChat; - internal List AutoProps; - } - -#pragma warning disable IDE1006 // Naming Styles - internal class SchemaJson - { - public List constructors { get; set; } - public List methods { get; set; } - } - - internal class Constructor - { - public string id { get; set; } - public string predicate { get; set; } - public Param[] @params { get; set; } - public string type { get; set; } - public int layer { get; set; } - - public int ID => string.IsNullOrEmpty(id) ? 0 : int.Parse(id); - } - - internal class Param - { - public string name { get; set; } - public string type { get; set; } - public override bool Equals(object obj) => obj is Param other && other.name == name && other.type == type; - public override int GetHashCode() => HashCode.Combine(name, type); - } - - internal class Method - { - public string id { get; set; } - public string method { get; set; } - public Param[] @params { get; set; } - public string type { get; set; } - } -#pragma warning restore IDE1006 // Naming Styles - } -} diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9d7f28b..9d27d17 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1,4 +1,4 @@ -// This file is generated automatically using the Generator class +// This file is generated automatically using System; using System.Collections.Generic; using System.Threading.Tasks; @@ -12260,7 +12260,7 @@ namespace TL return "InvokeAfterMsgs"; }); - /// Initialize connection See + /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model /// Operation system version @@ -12271,7 +12271,6 @@ namespace TL /// Info about an MTProto proxy /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. /// The query itself - /// Possible errors: 400 (details) public static ITLFunction InitConnection(int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLFunction query, InputClientProxy proxy = null, JSONValue params_ = null) => writer => { @@ -12292,10 +12291,9 @@ namespace TL return "InitConnection"; }; - /// Invoke the specified query using the specified API layer See + /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query - /// Possible errors: 400,403 (details) public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) => client.CallAsync(writer => { @@ -12339,12 +12337,11 @@ namespace TL return "InvokeWithTakeout"; }); - /// Send the verification code for login See + /// Send the verification code for login See Possible codes: 303,400,401,406 (details) /// Phone number in international format /// Application identifier (see App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send - /// Possible errors: 303,400,401,406 (details) public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12356,12 +12353,11 @@ namespace TL return "Auth_SendCode"; }); - /// Registers a validated phone number in the system. See + /// Registers a validated phone number in the system. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID /// New user first name /// New user last name - /// Possible errors: 400 (details) public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) => client.CallAsync(writer => { @@ -12373,11 +12369,10 @@ namespace TL return "Auth_SignUp"; }); - /// Signs in a user with a validated phone number. See + /// Signs in a user with a validated phone number. See Possible codes: 400 (details) /// Phone number in the international format /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message - /// Possible errors: 400 (details) public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12396,8 +12391,7 @@ namespace TL return "Auth_LogOut"; }); - /// Terminates all user's authorized sessions except for the current one. See - /// Possible errors: 406 (details) + /// Terminates all user's authorized sessions except for the current one. See Possible codes: 406 (details) public static Task Auth_ResetAuthorizations(this Client client) => client.CallAsync(writer => { @@ -12405,9 +12399,8 @@ namespace TL return "Auth_ResetAuthorizations"; }); - /// Returns data for copying authorization to another data-centre. See + /// Returns data for copying authorization to another data-centre. See Possible codes: 400 (details) /// Number of a target data-centre - /// Possible errors: 400 (details) public static Task Auth_ExportAuthorization(this Client client, int dc_id) => client.CallAsync(writer => { @@ -12416,10 +12409,9 @@ namespace TL return "Auth_ExportAuthorization"; }); - /// Logs in a user using a key transmitted from his native data-centre. See + /// Logs in a user using a key transmitted from his native data-centre. See Possible codes: 400 (details) /// User ID /// Authorization key - /// Possible errors: 400 (details) public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) => client.CallAsync(writer => { @@ -12429,12 +12421,11 @@ namespace TL return "Auth_ImportAuthorization"; }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See Possible codes: 400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents /// See Generating encrypted_message - /// Possible errors: 400 (details) public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) => client.CallAsync(writer => { @@ -12446,11 +12437,10 @@ namespace TL return "Auth_BindTempAuthKey"; }); - /// Login as a bot See + /// Login as a bot See Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) - /// Possible errors: 400,401 (details) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) => client.CallAsync(writer => { @@ -12462,9 +12452,8 @@ namespace TL return "Auth_ImportBotAuthorization"; }); - /// Try logging to an account protected by a 2FA password. See + /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) - /// Possible errors: 400 (details) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12473,8 +12462,7 @@ namespace TL return "Auth_CheckPassword"; }); - /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See - /// Possible errors: 400 (details) + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See Possible codes: 400 (details) public static Task Auth_RequestPasswordRecovery(this Client client) => client.CallAsync(writer => { @@ -12482,10 +12470,9 @@ namespace TL return "Auth_RequestPasswordRecovery"; }); - /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See Possible codes: 400 (details) /// Code received via email /// New password - /// Possible errors: 400 (details) public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) => client.CallAsync(writer => { @@ -12497,10 +12484,9 @@ namespace TL return "Auth_RecoverPassword"; }); - /// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See + /// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See Possible codes: 400,406 (details) /// The phone number /// The phone code hash obtained from auth.sendCode - /// Possible errors: 400,406 (details) public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12510,10 +12496,9 @@ namespace TL return "Auth_ResendCode"; }); - /// Cancel the login verification code See + /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode - /// Possible errors: 400 (details) public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.CallAsync(writer => { @@ -12533,11 +12518,10 @@ namespace TL return "Auth_DropTempAuthKeys"; }); - /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code. See
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken URL in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user - /// Possible errors: 400 (details) public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) => client.CallAsync(writer => { @@ -12548,9 +12532,8 @@ namespace TL return "Auth_ExportLoginToken"; }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) /// Login token - /// Possible errors: 400 (details) public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12559,9 +12542,8 @@ namespace TL return "Auth_ImportLoginToken"; }); - /// Accept QR code login token, logging in the app that generated it. See + /// Accept QR code login token, logging in the app that generated it. See Possible codes: 400 (details) /// Login token embedded in QR code, for more info, see login via QR code. - /// Possible errors: 400 (details) public static Task Auth_AcceptLoginToken(this Client client, byte[] token) => client.CallAsync(writer => { @@ -12570,9 +12552,8 @@ namespace TL return "Auth_AcceptLoginToken"; }); - /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See + /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See Possible codes: 400 (details) /// Code received via email - /// Possible errors: 400 (details) public static Task Auth_CheckRecoveryPassword(this Client client, string code) => client.CallAsync(writer => { @@ -12581,14 +12562,13 @@ namespace TL return "Auth_CheckRecoveryPassword"; }); - /// Register device to receive PUSH notifications See + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// If is transmitted, a sandbox-certificate will be used during transmission. /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications /// List of user identifiers of other users currently using the client - /// Possible errors: 400 (details) public static Task Account_RegisterDevice(this Client client, int token_type, string token, bool app_sandbox, byte[] secret, long[] other_uids, bool no_muted = false) => client.CallAsync(writer => { @@ -12602,11 +12582,10 @@ namespace TL return "Account_RegisterDevice"; }); - /// Deletes a device by its token, stops sending PUSH-notifications to it. See + /// Deletes a device by its token, stops sending PUSH-notifications to it. See Possible codes: 400 (details) /// Device token type.
Possible values:
1 - APNS (device token for apple push)
2 - FCM (firebase token for google firebase)
3 - MPNS (channel URI for microsoft push)
4 - Simple push (endpoint for firefox's simple push API)
5 - Ubuntu phone (token for ubuntu push)
6 - Blackberry (token for blackberry push)
7 - Unused
8 - WNS (windows push)
9 - APNS VoIP (token for apple push VoIP)
10 - Web push (web push, see below)
11 - MPNS VoIP (token for microsoft push VoIP)
12 - Tizen (token for tizen push)

For 10 web push, the token must be a JSON-encoded object containing the keys described in PUSH updates /// Device token /// List of user identifiers of other users currently using the client - /// Possible errors: 400 (details) public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) => client.CallAsync(writer => { @@ -12617,10 +12596,9 @@ namespace TL return "Account_UnregisterDevice"; }); - /// Edits notification settings from a given user/group, from all users/all groups. See + /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings - /// Possible errors: 400 (details) public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) => client.CallAsync(writer => { @@ -12630,9 +12608,8 @@ namespace TL return "Account_UpdateNotifySettings"; }); - /// Gets current notification settings for a given user/group, from all users/all groups. See + /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source - /// Possible errors: 400 (details) public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) => client.CallAsync(writer => { @@ -12649,11 +12626,10 @@ namespace TL return "Account_ResetNotifySettings"; }); - /// Updates user profile. See + /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio - /// Possible errors: 400 (details) public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) => client.CallAsync(writer => { @@ -12689,11 +12665,10 @@ namespace TL return "Account_GetWallPapers"; }); - /// Report a peer for violation of telegram's Terms of Service See + /// Report a peer for violation of telegram's Terms of Service See Possible codes: 400 (details) /// The peer to report /// The reason why this peer is being reported /// Comment for report moderation - /// Possible errors: 400 (details) public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) => client.CallAsync(writer => { @@ -12704,9 +12679,8 @@ namespace TL return "Account_ReportPeer"; }); - /// Validates a username and checks availability. See + /// Validates a username and checks availability. See Possible codes: 400 (details) /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - /// Possible errors: 400 (details) public static Task Account_CheckUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12715,9 +12689,8 @@ namespace TL return "Account_CheckUsername"; }); - /// Changes username for the current user. See + /// Changes username for the current user. See Possible codes: 400,401 (details) /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters. - /// Possible errors: 400,401 (details) public static Task Account_UpdateUsername(this Client client, string username) => client.CallAsync(writer => { @@ -12726,9 +12699,8 @@ namespace TL return "Account_UpdateUsername"; }); - /// Get privacy settings of current account See + /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched - /// Possible errors: 400 (details) public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) => client.CallAsync(writer => { @@ -12737,10 +12709,9 @@ namespace TL return "Account_GetPrivacy"; }); - /// Change privacy settings of current account See + /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules - /// Possible errors: 400 (details) public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) => client.CallAsync(writer => { @@ -12750,9 +12721,8 @@ namespace TL return "Account_SetPrivacy"; }); - /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See + /// Delete the user's account from the telegram servers. Can be used, for example, to delete the account of a user that provided the login code, but forgot the 2FA password and no recovery method is configured. See Possible codes: 420 (details) /// Why is the account being deleted, can be empty - /// Possible errors: 420 (details) public static Task Account_DeleteAccount(this Client client, string reason) => client.CallAsync(writer => { @@ -12769,9 +12739,8 @@ namespace TL return "Account_GetAccountTTL"; }); - /// Set account self-destruction period See + /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days - /// Possible errors: 400 (details) public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) => client.CallAsync(writer => { @@ -12780,10 +12749,9 @@ namespace TL return "Account_SetAccountTTL"; }); - /// Verify a new phone number to associate to the current account See + /// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details) /// New phone number /// Phone code settings - /// Possible errors: 400,406 (details) public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -12793,11 +12761,10 @@ namespace TL return "Account_SendChangePhoneCode"; }); - /// Change the phone number of the current account See + /// Change the phone number of the current account See Possible codes: 400 (details) /// New phone number /// Phone code hash received when calling account.sendChangePhoneCode /// Phone code received when calling account.sendChangePhoneCode - /// Possible errors: 400 (details) public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12826,9 +12793,8 @@ namespace TL return "Account_GetAuthorizations"; }); - /// Log out an active authorized session by its hash See + /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash - /// Possible errors: 400,406 (details) public static Task Account_ResetAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12845,9 +12811,8 @@ namespace TL return "Account_GetPassword"; }); - /// Get private info associated to the password info (recovery email, telegram passport info & so on) See + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) - /// Possible errors: 400 (details) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -12856,10 +12821,9 @@ namespace TL return "Account_GetPasswordSettings"; }); - /// Set a new 2FA password See + /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) - /// Possible errors: 400 (details) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) => client.CallAsync(writer => { @@ -12869,10 +12833,9 @@ namespace TL return "Account_UpdatePasswordSettings"; }); - /// Send confirmation code to cancel account deletion, for more info click here » See + /// Send confirmation code to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// The hash from the service notification, for more info click here » /// Phone code settings - /// Possible errors: 400 (details) public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) => client.CallAsync(writer => { @@ -12882,10 +12845,9 @@ namespace TL return "Account_SendConfirmPhoneCode"; }); - /// Confirm a phone number to cancel account deletion, for more info click here » See + /// Confirm a phone number to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// Phone code hash, for more info click here » /// SMS code, for more info click here » - /// Possible errors: 400 (details) public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -12895,10 +12857,9 @@ namespace TL return "Account_ConfirmPhone"; }); - /// Get temporary payment password See + /// Get temporary payment password See Possible codes: 400 (details) /// SRP password parameters /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 - /// Possible errors: 400 (details) public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) => client.CallAsync(writer => { @@ -12916,9 +12877,8 @@ namespace TL return "Account_GetWebAuthorizations"; }); - /// Log out an active web telegram login session See + /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash - /// Possible errors: 400 (details) public static Task Account_ResetWebAuthorization(this Client client, long hash) => client.CallAsync(writer => { @@ -12953,10 +12913,9 @@ namespace TL return "Account_GetSecureValue"; }); - /// Securely save Telegram Passport document, for more info see the passport docs » See + /// Securely save Telegram Passport document, for more info see the passport docs » See Possible codes: 400 (details) /// Secure value, for more info see the passport docs » /// Passport secret hash, for more info see the passport docs » - /// Possible errors: 400 (details) public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) => client.CallAsync(writer => { @@ -12976,11 +12935,10 @@ namespace TL return "Account_DeleteSecureValue"; }); - /// Returns a Telegram Passport authorization form for sharing data with a service See + /// Returns a Telegram Passport authorization form for sharing data with a service See Possible codes: 400 (details) /// User identifier of the service's bot /// Telegram Passport element types requested by the service /// Service's public key - /// Possible errors: 400 (details) public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) => client.CallAsync(writer => { @@ -13009,10 +12967,9 @@ namespace TL return "Account_AcceptAuthorization"; }); - /// Send the verification phone code for telegram passport. See + /// Send the verification phone code for telegram passport. See Possible codes: 400 (details) /// The phone number to verify /// Phone code settings - /// Possible errors: 400 (details) public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) => client.CallAsync(writer => { @@ -13022,11 +12979,10 @@ namespace TL return "Account_SendVerifyPhoneCode"; }); - /// Verify a phone number for telegram passport. See + /// Verify a phone number for telegram passport. See Possible codes: 400 (details) /// Phone number /// Phone code hash received from the call to account.sendVerifyPhoneCode /// Code received after the call to account.sendVerifyPhoneCode - /// Possible errors: 400 (details) public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.CallAsync(writer => { @@ -13037,9 +12993,8 @@ namespace TL return "Account_VerifyPhone"; }); - /// Send the verification email code for telegram passport. See + /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code - /// Possible errors: 400 (details) public static Task Account_SendVerifyEmailCode(this Client client, string email) => client.CallAsync(writer => { @@ -13048,10 +13003,9 @@ namespace TL return "Account_SendVerifyEmailCode"; }); - /// Verify an email address for telegram passport. See + /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received - /// Possible errors: 400 (details) public static Task Account_VerifyEmail(this Client client, string email, string code) => client.CallAsync(writer => { @@ -13061,7 +13015,7 @@ namespace TL return "Account_VerifyEmail"; }); - /// Initialize account takeout session See + /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats /// Whether to export messages in legacy groups @@ -13069,7 +13023,6 @@ namespace TL /// Whether to export messages in channels /// Whether to export files /// Maximum size of files to export - /// Possible errors: 420 (details) public static Task Account_InitTakeoutSession(this Client client, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false, int? file_max_size = null) => client.CallAsync(writer => { @@ -13080,9 +13033,8 @@ namespace TL return "Account_InitTakeoutSession"; }); - /// Finish account takeout session See + /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully - /// Possible errors: 403 (details) public static Task Account_FinishTakeoutSession(this Client client, bool success = false) => client.CallAsync(writer => { @@ -13091,9 +13043,8 @@ namespace TL return "Account_FinishTakeoutSession"; }); - /// Verify an email to use as 2FA recovery method. See + /// Verify an email to use as 2FA recovery method. See Possible codes: 400 (details) /// The phone code that was received after setting a recovery email - /// Possible errors: 400 (details) public static Task Account_ConfirmPasswordEmail(this Client client, string code) => client.CallAsync(writer => { @@ -13149,9 +13100,8 @@ namespace TL return "Account_GetNotifyExceptions"; }); - /// Get info about a certain wallpaper See + /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about - /// Possible errors: 400 (details) public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) => client.CallAsync(writer => { @@ -13160,11 +13110,10 @@ namespace TL return "Account_GetWallPaper"; }); - /// Create and upload a new wallpaper See + /// Create and upload a new wallpaper See Possible codes: 400 (details) /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13175,11 +13124,10 @@ namespace TL return "Account_UploadWallPaper"; }); - /// Install/uninstall wallpaper See + /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13190,10 +13138,9 @@ namespace TL return "Account_SaveWallPaper"; }); - /// Install wallpaper See + /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings - /// Possible errors: 400 (details) public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) => client.CallAsync(writer => { @@ -13232,12 +13179,11 @@ namespace TL return "Account_SaveAutoDownloadSettings"; }); - /// Upload theme See + /// Upload theme See Possible codes: 400 (details) /// Theme file uploaded as described in files » /// Thumbnail /// File name /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client - /// Possible errors: 400 (details) public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) => client.CallAsync(writer => { @@ -13251,12 +13197,11 @@ namespace TL return "Account_UploadTheme"; }); - /// Create a theme See + /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings - /// Possible errors: 400 (details) public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13271,14 +13216,13 @@ namespace TL return "Account_CreateTheme"; }); - /// Update theme See + /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update /// Unique theme ID /// Theme name /// Theme file /// Theme settings - /// Possible errors: 400 (details) public static Task Account_UpdateTheme(this Client client, string format, InputThemeBase theme, string slug = null, string title = null, InputDocument document = null, InputThemeSettings[] settings = null) => client.CallAsync(writer => { @@ -13327,11 +13271,10 @@ namespace TL return "Account_InstallTheme"; }); - /// Get theme information See + /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID - /// Possible errors: 400 (details) public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) => client.CallAsync(writer => { @@ -13355,9 +13298,8 @@ namespace TL return "Account_GetThemes"; }); - /// Set sensitive content settings (for viewing or hiding NSFW content) See + /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content - /// Possible errors: 403 (details) public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) => client.CallAsync(writer => { @@ -13392,9 +13334,8 @@ namespace TL return "Account_GetGlobalPrivacySettings"; }); - /// Set global privacy settings See + /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings - /// Possible errors: 400 (details) public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) => client.CallAsync(writer => { @@ -13427,8 +13368,7 @@ namespace TL return "Account_ResetPassword"; }); - /// Abort a pending 2FA password reset, see here for more info » See - /// Possible errors: 400 (details) + /// Abort a pending 2FA password reset, see here for more info » See Possible codes: 400 (details) public static Task Account_DeclinePasswordReset(this Client client) => client.CallAsync(writer => { @@ -13447,9 +13387,8 @@ namespace TL return "Account_GetChatThemes"; }); - /// Returns basic user info according to their identifiers. See + /// Returns basic user info according to their identifiers. See Possible codes: 400,401 (details) /// List of user identifiers - /// Possible errors: 400,401 (details) public static Task Users_GetUsers(this Client client, InputUserBase[] id) => client.CallAsync(writer => { @@ -13458,9 +13397,8 @@ namespace TL return "Users_GetUsers"; }); - /// Returns extended user info by ID. See + /// Returns extended user info by ID. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13469,10 +13407,9 @@ namespace TL return "Users_GetFullUser"; }); - /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See + /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See Possible codes: 400 (details) /// The user /// Errors - /// Possible errors: 400 (details) public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) => client.CallAsync(writer => { @@ -13541,9 +13478,8 @@ namespace TL return "Contacts_DeleteByPhones"; }); - /// Adds the user to the blacklist. See + /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Contacts_Block(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13552,9 +13488,8 @@ namespace TL return "Contacts_Block"; }); - /// Deletes the user from the blacklist. See + /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID - /// Possible errors: 400 (details) public static Task Contacts_Unblock(this Client client, InputPeer id) => client.CallAsync(writer => { @@ -13575,10 +13510,9 @@ namespace TL return "Contacts_GetBlocked"; }); - /// Returns users found by username substring. See + /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned - /// Possible errors: 400 (details) public static Task Contacts_Search(this Client client, string q, int limit) => client.CallAsync(writer => { @@ -13588,9 +13522,8 @@ namespace TL return "Contacts_Search"; }); - /// Resolve a @username to get peer info See + /// Resolve a @username to get peer info See Possible codes: 400,401 (details) /// @username to resolve - /// Possible errors: 400,401 (details) public static Task Contacts_ResolveUsername(this Client client, string username) => client.CallAsync(writer => { @@ -13599,7 +13532,7 @@ namespace TL return "Contacts_ResolveUsername"; }); - /// Get most used peers See + /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots /// Most used inline bots @@ -13612,7 +13545,6 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified - /// Possible errors: 400 (details) public static Task Contacts_GetTopPeers(this Client client, int offset, int limit, long hash, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false) => client.CallAsync(writer => { @@ -13624,10 +13556,9 @@ namespace TL return "Contacts_GetTopPeers"; }); - /// Reset rating of top peer See + /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset - /// Possible errors: 400 (details) public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) => client.CallAsync(writer => { @@ -13645,8 +13576,7 @@ namespace TL return "Contacts_ResetSaved"; }); - /// Get all contacts See - /// Possible errors: 403 (details) + /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.CallAsync(writer => { @@ -13664,13 +13594,12 @@ namespace TL return "Contacts_ToggleTopPeers"; }); - /// Add an existing telegram user as contact. See + /// Add an existing telegram user as contact. See Possible codes: 400 (details) /// Allow the other user to see our phone number? /// Telegram ID of the other user /// First name /// Last name /// User's phone number - /// Possible errors: 400 (details) public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, bool add_phone_privacy_exception = false) => client.CallAsync(writer => { @@ -13683,9 +13612,8 @@ namespace TL return "Contacts_AddContact"; }); - /// If the of a new user allow us to add him as contact, add that user as contact See + /// If the of a new user allow us to add him as contact, add that user as contact See Possible codes: 400 (details) /// The user to add as contact - /// Possible errors: 400 (details) public static Task Contacts_AcceptContact(this Client client, InputUserBase id) => client.CallAsync(writer => { @@ -13694,11 +13622,10 @@ namespace TL return "Contacts_AcceptContact"; }); - /// Get contacts near you See + /// Get contacts near you See Possible codes: 400,406 (details) /// While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown. /// Geolocation /// If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied. - /// Possible errors: 400,406 (details) public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) => client.CallAsync(writer => { @@ -13734,7 +13661,7 @@ namespace TL return "Messages_GetMessages"; }); - /// Returns the current user dialog list. See + /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -13742,7 +13669,6 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetDialogs(this Client client, DateTime offset_date, int offset_id, InputPeer offset_peer, int limit, long hash, bool exclude_pinned = false, int? folder_id = null) => client.CallAsync(writer => { @@ -13758,7 +13684,7 @@ namespace TL return "Messages_GetDialogs"; }); - /// Gets back the conversation history with one interlocutor / within a chat See + /// Gets back the conversation history with one interlocutor / within a chat See Possible codes: 400,401 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -13767,7 +13693,6 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs less than max_id /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash - /// Possible errors: 400,401 (details) public static Task Messages_GetHistory(this Client client, InputPeer peer, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -13783,7 +13708,7 @@ namespace TL return "Messages_GetHistory"; }); - /// Gets back found messages See + /// Gets back found messages See Possible codes: 400 (details) /// User or chat, histories with which are searched, or constructor for global search /// Text search request /// Only return messages sent by the specified user ID @@ -13797,7 +13722,6 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - /// Possible errors: 400 (details) public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_id, int add_offset, int limit, int max_id, int min_id, long hash, InputPeer from_id = null, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13821,10 +13745,9 @@ namespace TL return "Messages_Search"; }); - /// Marks message history as read. See + /// Marks message history as read. See Possible codes: 400 (details) /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read - /// Possible errors: 400 (details) public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id) => client.CallAsync(writer => { @@ -13834,12 +13757,11 @@ namespace TL return "Messages_ReadHistory"; }); - /// Deletes communication history. See + /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user /// Whether to delete the message history for all chat participants /// User or chat, communication history of which will be deleted /// Maximum ID of message to delete - /// Possible errors: 400 (details) public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) => client.CallAsync(writer => { @@ -13854,10 +13776,9 @@ namespace TL return "Messages_DeleteHistory"; }); - /// Deletes messages by their identifiers. See + /// Deletes messages by their identifiers. See Possible codes: 403 (details) /// Whether to delete messages for all participants of the chat /// Message ID list - /// Possible errors: 403 (details) public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) => client.CallAsync(writer => { @@ -13877,11 +13798,10 @@ namespace TL return "Messages_ReceivedMessages"; }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. - /// Possible errors: 400,403 (details) public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) => client.CallAsync(writer => { @@ -13894,7 +13814,7 @@ namespace TL return "Messages_SetTyping"; }); - /// Sends a message to a chat See + /// Sends a message to a chat See Possible codes: 400,401,403,420 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -13906,7 +13826,6 @@ namespace TL /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,401,403,420 (details) public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13926,7 +13845,7 @@ namespace TL return "Messages_SendMessage"; }); - /// Send a media See + /// Send a media See Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -13938,7 +13857,6 @@ namespace TL /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13959,7 +13877,7 @@ namespace TL return "Messages_SendMedia"; }); - /// Forwards messages by their IDs. See + /// Forwards messages by their IDs. See Possible codes: 400,403,420 (details) /// Whether to send messages silently (no notification will be triggered on the destination clients) /// Whether to send the message in background /// When forwarding games, whether to include your score in the game @@ -13970,7 +13888,6 @@ namespace TL /// Random ID to prevent resending of messages /// Destination peer /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -13985,9 +13902,8 @@ namespace TL return "Messages_ForwardMessages"; }); - /// Report a new incoming chat for spam, if the of the chat allow us to do that See + /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) /// Peer to report - /// Possible errors: 400 (details) public static Task Messages_ReportSpam(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -13996,9 +13912,8 @@ namespace TL return "Messages_ReportSpam"; }); - /// Get peer settings See + /// Get peer settings See Possible codes: 400 (details) /// The peer - /// Possible errors: 400 (details) public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -14007,12 +13922,11 @@ namespace TL return "Messages_GetPeerSettings"; }); - /// Report a message in a chat for violation of telegram's Terms of Service See + /// Report a message in a chat for violation of telegram's Terms of Service See Possible codes: 400 (details) /// Peer /// IDs of messages to report /// Why are these messages being reported /// Comment for report moderation - /// Possible errors: 400 (details) public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) => client.CallAsync(writer => { @@ -14024,9 +13938,8 @@ namespace TL return "Messages_Report"; }); - /// Returns chat basic info on their IDs. See + /// Returns chat basic info on their IDs. See Possible codes: 400 (details) /// List of chat IDs - /// Possible errors: 400 (details) public static Task Messages_GetChats(this Client client, long[] id) => client.CallAsync(writer => { @@ -14035,9 +13948,8 @@ namespace TL return "Messages_GetChats"; }); - /// Returns full chat info according to its ID. See + /// Returns full chat info according to its ID. See Possible codes: 400 (details) /// Chat ID - /// Possible errors: 400 (details) public static Task Messages_GetFullChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -14046,10 +13958,9 @@ namespace TL return "Messages_GetFullChat"; }); - /// Chanages chat name and sends a service message on it. See + /// Chanages chat name and sends a service message on it. See Possible codes: 400 (details) /// Chat ID /// New chat name, different from the old one - /// Possible errors: 400 (details) public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) => client.CallAsync(writer => { @@ -14059,10 +13970,9 @@ namespace TL return "Messages_EditChatTitle"; }); - /// Changes chat photo and sends a service message on it See + /// Changes chat photo and sends a service message on it See Possible codes: 400 (details) /// Chat ID /// Photo to be set - /// Possible errors: 400 (details) public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -14072,11 +13982,10 @@ namespace TL return "Messages_EditChatPhoto"; }); - /// Adds a user to a chat and sends a service message on it. See + /// Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details) /// Chat ID /// User ID to be added /// Number of last messages to be forwarded - /// Possible errors: 400,403 (details) public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) => client.CallAsync(writer => { @@ -14087,11 +13996,10 @@ namespace TL return "Messages_AddChatUser"; }); - /// Deletes a user from a chat and sends a service message on it. See + /// Deletes a user from a chat and sends a service message on it. See Possible codes: 400 (details) /// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted - /// Possible errors: 400 (details) public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) => client.CallAsync(writer => { @@ -14102,10 +14010,9 @@ namespace TL return "Messages_DeleteChatUser"; }); - /// Creates a new chat. See + /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name - /// Possible errors: 400,403 (details) public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) => client.CallAsync(writer => { @@ -14115,10 +14022,9 @@ namespace TL return "Messages_CreateChat"; }); - /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) /// Value of the version parameter from , avialable at the client /// Length of the required random sequence - /// Possible errors: 400 (details) public static Task Messages_GetDhConfig(this Client client, int version, int random_length) => client.CallAsync(writer => { @@ -14128,11 +14034,10 @@ namespace TL return "Messages_GetDhConfig"; }); - /// Sends a request to start a secret chat to the user. See + /// Sends a request to start a secret chat to the user. See Possible codes: 400 (details) /// User ID /// Unique client request ID required to prevent resending. This also doubles as the chat ID. /// A = g ^ a mod p, see Wikipedia - /// Possible errors: 400 (details) public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) => client.CallAsync(writer => { @@ -14143,11 +14048,10 @@ namespace TL return "Messages_RequestEncryption"; }); - /// Confirms creation of a secret chat See + /// Confirms creation of a secret chat See Possible codes: 400 (details) /// Secret chat ID /// B = g ^ b mod p, see Wikipedia /// 64-bit fingerprint of the received key - /// Possible errors: 400 (details) public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) => client.CallAsync(writer => { @@ -14158,10 +14062,9 @@ namespace TL return "Messages_AcceptEncryption"; }); - /// Cancels a request for creation and/or delete info on secret chat. See + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details) /// Whether to delete the entire chat history for the other user as well /// Secret chat ID - /// Possible errors: 400 (details) public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) => client.CallAsync(writer => { @@ -14171,10 +14074,9 @@ namespace TL return "Messages_DiscardEncryption"; }); - /// Send typing event by the current user to a secret chat. See + /// Send typing event by the current user to a secret chat. See Possible codes: 400 (details) /// Secret chat ID /// Typing.
Possible values:
, if the user started typing and more than 5 seconds have passed since the last request
, if the user stopped typing - /// Possible errors: 400 (details) public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) => client.CallAsync(writer => { @@ -14184,10 +14086,9 @@ namespace TL return "Messages_SetEncryptedTyping"; }); - /// Marks message history within a secret chat as read. See + /// Marks message history within a secret chat as read. See Possible codes: 400 (details) /// Secret chat ID /// Maximum date value for received messages in history - /// Possible errors: 400 (details) public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) => client.CallAsync(writer => { @@ -14197,12 +14098,11 @@ namespace TL return "Messages_ReadEncryptedHistory"; }); - /// Sends a text message to a secret chat. See + /// Sends a text message to a secret chat. See Possible codes: 400,403 (details) /// Send encrypted message without a notification /// Secret chat ID /// Unique client message ID, necessary to avoid message resending /// TL-serialization of type, encrypted with a key that was created during chat initialization - /// Possible errors: 400,403 (details) public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false) => client.CallAsync(writer => { @@ -14214,13 +14114,12 @@ namespace TL return "Messages_SendEncrypted"; }); - /// Sends a message with a file attachment to a secret chat See + /// Sends a message with a file attachment to a secret chat See Possible codes: 400 (details) /// Whether to send the file without triggering a notification /// Secret chat ID /// Unique client message ID necessary to prevent message resending /// TL-serialization of type, encrypted with a key generated during chat initialization /// File attachment for the secret chat - /// Possible errors: 400 (details) public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false) => client.CallAsync(writer => { @@ -14233,11 +14132,10 @@ namespace TL return "Messages_SendEncryptedFile"; }); - /// Sends a service message to a secret chat. See + /// Sends a service message to a secret chat. See Possible codes: 400,403 (details) /// Secret chat ID /// Unique client message ID required to prevent message resending /// TL-serialization of type, encrypted with a key generated during chat initialization - /// Possible errors: 400,403 (details) public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data) => client.CallAsync(writer => { @@ -14248,9 +14146,8 @@ namespace TL return "Messages_SendEncryptedService"; }); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See Possible codes: 400 (details) /// Maximum qts value available at the client - /// Possible errors: 400 (details) public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.CallAsync(writer => { @@ -14259,9 +14156,8 @@ namespace TL return "Messages_ReceivedQueue"; }); - /// Report a secret chat for spam See + /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report - /// Possible errors: 400 (details) public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) => client.CallAsync(writer => { @@ -14280,11 +14176,10 @@ namespace TL return "Messages_ReadMessageContents"; }); - /// Get stickers by emoji See + /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji /// Hash for pagination, for more info click here /// a null value means messages.stickersNotModified - /// Possible errors: 400 (details) public static Task Messages_GetStickers(this Client client, string emoticon, long hash) => client.CallAsync(writer => { @@ -14305,11 +14200,10 @@ namespace TL return "Messages_GetAllStickers"; }); - /// Get preview of webpage See + /// Get preview of webpage See Possible codes: 400 (details) /// Message from which to extract the preview /// Message entities for styled text /// a null value means messageMediaEmpty - /// Possible errors: 400 (details) public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) => client.CallAsync(writer => { @@ -14321,12 +14215,11 @@ namespace TL return "Messages_GetWebPagePreview"; }); - /// Export an invite link for a chat See + /// Export an invite link for a chat See Possible codes: 400,403 (details) /// Legacy flag, reproducing legacy behavior of this method: if set, revokes all previous links before creating a new one. Kept for bot API BC, should not be used by modern clients. /// Chat /// Expiration date /// Maximum number of users that can join using this link - /// Possible errors: 400,403 (details) public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, bool legacy_revoke_permanent = false, bool request_needed = false, DateTime? expire_date = null, int? usage_limit = null, string title = null) => client.CallAsync(writer => { @@ -14342,9 +14235,8 @@ namespace TL return "Messages_ExportChatInvite"; }); - /// Check the validity of a chat invite link and get basic info about it See + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400 (details) /// Invite hash in t.me/joinchat/hash - /// Possible errors: 400 (details) public static Task Messages_CheckChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14353,9 +14245,8 @@ namespace TL return "Messages_CheckChatInvite"; }); - /// Import a chat invite and join a private chat/supergroup/channel See + /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash - /// Possible errors: 400 (details) public static Task Messages_ImportChatInvite(this Client client, string hash) => client.CallAsync(writer => { @@ -14364,9 +14255,8 @@ namespace TL return "Messages_ImportChatInvite"; }); - /// Get info about a stickerset See + /// Get info about a stickerset See Possible codes: 400 (details) /// Stickerset - /// Possible errors: 400 (details) public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14375,10 +14265,9 @@ namespace TL return "Messages_GetStickerSet"; }); - /// Install a stickerset See + /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset - /// Possible errors: 400 (details) public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) => client.CallAsync(writer => { @@ -14388,9 +14277,8 @@ namespace TL return "Messages_InstallStickerSet"; }); - /// Uninstall a stickerset See + /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall - /// Possible errors: 400 (details) public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -14399,12 +14287,11 @@ namespace TL return "Messages_UninstallStickerSet"; }); - /// Start a conversation with a bot using a deep linking parameter See + /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400 (details) /// The bot /// The chat where to start the bot, can be the bot's private chat or a group /// Random ID to avoid resending the same message /// Deep linking parameter - /// Possible errors: 400 (details) public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) => client.CallAsync(writer => { @@ -14416,11 +14303,10 @@ namespace TL return "Messages_StartBot"; }); - /// Get and increase the view counter of a message sent or forwarded from a channel See + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter - /// Possible errors: 400 (details) public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) => client.CallAsync(writer => { @@ -14431,11 +14317,10 @@ namespace TL return "Messages_GetMessagesViews"; }); - /// Make a user admin in a legacy group. See + /// Make a user admin in a legacy group. See Possible codes: 400 (details) /// The ID of the group /// The user to make admin /// Whether to make him admin - /// Possible errors: 400 (details) public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) => client.CallAsync(writer => { @@ -14446,9 +14331,8 @@ namespace TL return "Messages_EditChatAdmin"; }); - /// Turn a legacy group into a supergroup See + /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate - /// Possible errors: 400,403 (details) public static Task Messages_MigrateChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -14457,7 +14341,7 @@ namespace TL return "Messages_MigrateChat"; }); - /// Search for messages and peers globally See + /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query /// Global search filter @@ -14467,7 +14351,6 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter, DateTime min_date, DateTime max_date, int offset_rate, InputPeer offset_peer, int offset_id, int limit, int? folder_id = null) => client.CallAsync(writer => { @@ -14498,11 +14381,10 @@ namespace TL return "Messages_ReorderStickerSets"; }); - /// Get a document by its SHA256 hash, mainly used for gifs See + /// Get a document by its SHA256 hash, mainly used for gifs See Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type - /// Possible errors: 400 (details) public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) => client.CallAsync(writer => { @@ -14524,10 +14406,9 @@ namespace TL return "Messages_GetSavedGifs"; }); - /// Add GIF to saved gifs list See + /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list - /// Possible errors: 400 (details) public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) => client.CallAsync(writer => { @@ -14537,13 +14418,12 @@ namespace TL return "Messages_SaveGif"; }); - /// Query an inline bot See + /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested /// The query /// The offset within the results, will be passed directly as-is to the bot. - /// Possible errors: -503,400 (details) public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) => client.CallAsync(writer => { @@ -14558,7 +14438,7 @@ namespace TL return "Messages_GetInlineBotResults"; }); - /// Answer an inline query, for bots only See + /// Answer an inline query, for bots only See Possible codes: 400,403 (details) /// Set this flag if the results are composed of media files /// Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query /// Unique identifier for the answered query @@ -14566,7 +14446,6 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don‘t support pagination. Offset length can’t exceed 64 bytes. /// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - /// Possible errors: 400,403 (details) public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, bool gallery = false, bool private_ = false, string next_offset = null, InlineBotSwitchPM switch_pm = null) => client.CallAsync(writer => { @@ -14582,7 +14461,7 @@ namespace TL return "Messages_SetInlineBotResults"; }); - /// Send a result obtained using messages.getInlineBotResults. See + /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background /// Whether to clear the draft @@ -14593,7 +14472,6 @@ namespace TL /// Query ID from messages.getInlineBotResults /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages - /// Possible errors: 400,403,420 (details) public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -14610,10 +14488,9 @@ namespace TL return "Messages_SendInlineBotResult"; }); - /// Find out if a media message's caption can be edited See + /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) /// Peer where the media was sent /// ID of message - /// Possible errors: 400,403 (details) public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) => client.CallAsync(writer => { @@ -14623,7 +14500,7 @@ namespace TL return "Messages_GetMessageEditData"; }); - /// Edit message See + /// Edit message See Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -14632,7 +14509,6 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - /// Possible errors: 400,403 (details) public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, bool no_webpage = false, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -14653,14 +14529,13 @@ namespace TL return "Messages_EditMessage"; }); - /// Edit an inline bot message See + /// Edit an inline bot message See Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID /// Message /// Media /// Reply markup for inline keyboards /// Message entities for styled text - /// Possible errors: 400 (details) public static Task Messages_EditInlineBotMessage(this Client client, InputBotInlineMessageIDBase id, bool no_webpage = false, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null) => client.CallAsync(writer => { @@ -14678,13 +14553,12 @@ namespace TL return "Messages_EditInlineBotMessage"; }); - /// Press an inline callback button and get a callback answer from the bot See + /// Press an inline callback button and get a callback answer from the bot See Possible codes: -503,400 (details) /// Whether this is a "play game" button /// Where was the inline keyboard sent /// ID of the Message with the inline keyboard /// Callback data /// For buttons , the SRP payload generated using SRP. - /// Possible errors: -503,400 (details) public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, bool game = false, byte[] data = null, InputCheckPasswordSRP password = null) => client.CallAsync(writer => { @@ -14699,13 +14573,12 @@ namespace TL return "Messages_GetBotCallbackAnswer"; }); - /// Set the callback answer to a user button press (bots only) See + /// Set the callback answer to a user button press (bots only) See Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show /// URL to open /// Cache validity - /// Possible errors: 400 (details) public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, bool alert = false, string message = null, string url = null) => client.CallAsync(writer => { @@ -14720,9 +14593,8 @@ namespace TL return "Messages_SetBotCallbackAnswer"; }); - /// Get dialog info of specified peers See + /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers - /// Possible errors: 400 (details) public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) => client.CallAsync(writer => { @@ -14731,13 +14603,12 @@ namespace TL return "Messages_GetPeerDialogs"; }); - /// Save a message draft associated to a chat. See + /// Save a message draft associated to a chat. See Possible codes: 400 (details) /// Disable generation of the webpage preview /// Message ID the message should reply to /// Destination of the message that should be sent /// The draft /// Message entities for styled text - /// Possible errors: 400 (details) public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, MessageEntity[] entities = null) => client.CallAsync(writer => { @@ -14793,11 +14664,10 @@ namespace TL return "Messages_GetRecentStickers"; }); - /// Add/remove sticker from recent stickers list See + /// Add/remove sticker from recent stickers list See Possible codes: 400 (details) /// Whether to add/remove stickers recently attached to photo or video files /// Sticker /// Whether to save or unsave the sticker - /// Possible errors: 400 (details) public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) => client.CallAsync(writer => { @@ -14853,14 +14723,13 @@ namespace TL return "Messages_GetAttachedStickers"; }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// Unique identifier of target chat /// Identifier of the sent message /// User identifier /// New score - /// Possible errors: 400 (details) public static Task Messages_SetGameScore(this Client client, InputPeer peer, int id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14873,13 +14742,12 @@ namespace TL return "Messages_SetGameScore"; }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// ID of the inline message /// User identifier /// New score - /// Possible errors: 400 (details) public static Task Messages_SetInlineGameScore(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id, int score, bool edit_message = false, bool force = false) => client.CallAsync(writer => { @@ -14891,11 +14759,10 @@ namespace TL return "Messages_SetInlineGameScore"; }); - /// Get highscores of a game See + /// Get highscores of a game See Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user - /// Possible errors: 400 (details) public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14906,10 +14773,9 @@ namespace TL return "Messages_GetGameHighScores"; }); - /// Get highscores of a game sent using an inline bot See + /// Get highscores of a game sent using an inline bot See Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user - /// Possible errors: 400 (details) public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) => client.CallAsync(writer => { @@ -14919,11 +14785,10 @@ namespace TL return "Messages_GetInlineGameHighScores"; }); - /// Get chats in common with a user See + /// Get chats in common with a user See Possible codes: 400 (details) /// User ID /// Maximum ID of chat to return (see pagination) /// Maximum number of results to return, see pagination - /// Possible errors: 400 (details) public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) => client.CallAsync(writer => { @@ -14944,10 +14809,9 @@ namespace TL return "Messages_GetAllChats"; }); - /// Get instant view page See + /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetWebPage(this Client client, string url, int hash) => client.CallAsync(writer => { @@ -14957,10 +14821,9 @@ namespace TL return "Messages_GetWebPage"; }); - /// Pin/unpin a dialog See + /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin - /// Possible errors: 400 (details) public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.CallAsync(writer => { @@ -14970,11 +14833,10 @@ namespace TL return "Messages_ToggleDialogPin"; }); - /// Reorder pinned dialogs See + /// Reorder pinned dialogs See Possible codes: 400 (details) /// If set, dialogs pinned server-side but not present in the order field will be unpinned. /// Peer folder ID, for more info click here /// New dialog order - /// Possible errors: 400 (details) public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) => client.CallAsync(writer => { @@ -14985,9 +14847,8 @@ namespace TL return "Messages_ReorderPinnedDialogs"; }); - /// Get pinned dialogs See + /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) => client.CallAsync(writer => { @@ -14996,11 +14857,10 @@ namespace TL return "Messages_GetPinnedDialogs"; }); - /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See + /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See Possible codes: 400 (details) /// Unique identifier for the query to be answered /// Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable'). Telegram will display this message to the user. /// A vector of available shipping options. - /// Possible errors: 400 (details) public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) => client.CallAsync(writer => { @@ -15014,11 +14874,10 @@ namespace TL return "Messages_SetBotShippingResults"; }); - /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See
+ /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See
Possible codes: 400 (details)
/// Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the error field, instead /// Unique identifier for the query to be answered /// Required if the success isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. - /// Possible errors: 400 (details) public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, bool success = false, string error = null) => client.CallAsync(writer => { @@ -15030,11 +14889,10 @@ namespace TL return "Messages_SetBotPrecheckoutResults"; }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See + /// Upload a file and associate it to a chat (without actually sending it to the chat) See Possible codes: 400,403 (details) /// The chat, can be an for bots /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty - /// Possible errors: 400,403 (details) public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media) => client.CallAsync(writer => { @@ -15044,11 +14902,10 @@ namespace TL return "Messages_UploadMedia"; }); - /// Notify the other user in a private chat that a screenshot of the chat was taken See + /// Notify the other user in a private chat that a screenshot of the chat was taken See Possible codes: 400 (details) /// Other user /// ID of message that was screenshotted, can be 0 /// Random ID to avoid message resending - /// Possible errors: 400 (details) public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) => client.CallAsync(writer => { @@ -15070,10 +14927,9 @@ namespace TL return "Messages_GetFavedStickers"; }); - /// Mark a sticker as favorite See + /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite - /// Possible errors: 400 (details) public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) => client.CallAsync(writer => { @@ -15083,14 +14939,13 @@ namespace TL return "Messages_FaveSticker"; }); - /// Get unread messages where we were mentioned See + /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination - /// Possible errors: 400 (details) public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id, int add_offset, int limit, int max_id, int min_id) => client.CallAsync(writer => { @@ -15104,9 +14959,8 @@ namespace TL return "Messages_GetUnreadMentions"; }); - /// Mark mentions as read See + /// Mark mentions as read See Possible codes: 400 (details) /// Dialog - /// Possible errors: 400 (details) public static Task Messages_ReadMentions(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15129,7 +14983,7 @@ namespace TL return "Messages_GetRecentLocations"; }); - /// Send an album or grouped media See + /// Send an album or grouped media See Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -15137,7 +14991,6 @@ namespace TL /// The message to reply to /// The medias to send /// Scheduled message date for scheduled messages - /// Possible errors: 400,420 (details) public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, int? reply_to_msg_id = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -15216,13 +15069,12 @@ namespace TL return "Messages_ClearAllDrafts"; }); - /// Pin a message See + /// Pin a message See Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned /// Whether the message should only be pinned on the local side of a one-to-one chat /// The peer where to pin the message /// The message to pin or unpin - /// Possible errors: 400,403 (details) public static Task Messages_UpdatePinnedMessage(this Client client, InputPeer peer, int id, bool silent = false, bool unpin = false, bool pm_oneside = false) => client.CallAsync(writer => { @@ -15233,11 +15085,10 @@ namespace TL return "Messages_UpdatePinnedMessage"; }); - /// Vote in a See + /// Vote in a See Possible codes: 400 (details) /// The chat where the poll was sent /// The message ID of the poll /// The options that were chosen - /// Possible errors: 400 (details) public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) => client.CallAsync(writer => { @@ -15248,10 +15099,9 @@ namespace TL return "Messages_SendVote"; }); - /// Get poll results See + /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message - /// Possible errors: 400 (details) public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15261,9 +15111,8 @@ namespace TL return "Messages_GetPollResults"; }); - /// Get count of online users in a chat See + /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat - /// Possible errors: 400 (details) public static Task Messages_GetOnlines(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15272,10 +15121,9 @@ namespace TL return "Messages_GetOnlines"; }); - /// Edit the description of a group/supergroup/channel. See + /// Edit the description of a group/supergroup/channel. See Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description - /// Possible errors: 400,403 (details) public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) => client.CallAsync(writer => { @@ -15285,10 +15133,9 @@ namespace TL return "Messages_EditChatAbout"; }); - /// Edit the default banned rights of a channel/supergroup/group. See + /// Edit the default banned rights of a channel/supergroup/group. See Possible codes: 400,403 (details) /// The peer /// The new global rights - /// Possible errors: 400,403 (details) public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -15340,10 +15187,9 @@ namespace TL return "Messages_GetEmojiURL"; }); - /// Get the number of results that would be found by a messages.search call with the same parameters See + /// Get the number of results that would be found by a messages.search call with the same parameters See Possible codes: 400 (details) /// Peer where to search /// Search filters - /// Possible errors: 400 (details) public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) => client.CallAsync(writer => { @@ -15406,10 +15252,9 @@ namespace TL return "Messages_HidePeerSettingsBar"; }); - /// Get scheduled messages See + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) => client.CallAsync(writer => { @@ -15419,10 +15264,9 @@ namespace TL return "Messages_GetScheduledHistory"; }); - /// Get scheduled messages See + /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages - /// Possible errors: 400 (details) public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15432,10 +15276,9 @@ namespace TL return "Messages_GetScheduledMessages"; }); - /// Send scheduled messages right away See + /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs - /// Possible errors: 400 (details) public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) => client.CallAsync(writer => { @@ -15457,13 +15300,12 @@ namespace TL return "Messages_DeleteScheduledMessages"; }); - /// Get poll results for non-anonymous polls See + /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID /// Get only results for the specified poll option /// Offset for results, taken from the next_offset field of , initially an empty string.
Note: if no more results are available, the method call will return an empty next_offset; thus, avoid providing the next_offset returned in if it is empty, to avoid an infinite loop. /// Number of results to return - /// Possible errors: 400,403 (details) public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) => client.CallAsync(writer => { @@ -15509,10 +15351,9 @@ namespace TL return "Messages_GetSuggestedDialogFilters"; }); - /// Update folder See + /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info - /// Possible errors: 400 (details) public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) => client.CallAsync(writer => { @@ -15548,7 +15389,7 @@ namespace TL return "Messages_GetOldFeaturedStickers"; }); - /// Get messages in a reply thread See + /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID /// Offsets for pagination, for more info click here @@ -15558,7 +15399,6 @@ namespace TL /// If a positive value was transferred, the method will return only messages with ID smaller than max_id /// If a positive value was transferred, the method will return only messages with ID bigger than min_id /// Hash for pagination, for more info click here - /// Possible errors: 400 (details) public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id, DateTime offset_date, int add_offset, int limit, int max_id, int min_id, long hash) => client.CallAsync(writer => { @@ -15575,10 +15415,9 @@ namespace TL return "Messages_GetReplies"; }); - /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See + /// Get discussion message from the associated discussion group of a channel to show it on top of the comment section, without actually joining the group See Possible codes: 400 (details) /// Channel ID /// Message ID - /// Possible errors: 400 (details) public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15588,11 +15427,10 @@ namespace TL return "Messages_GetDiscussionMessage"; }); - /// Mark a thread as read See + /// Mark a thread as read See Possible codes: 400 (details) /// Group ID /// ID of message that started the thread /// ID up to which thread messages were read - /// Possible errors: 400 (details) public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) => client.CallAsync(writer => { @@ -15613,9 +15451,8 @@ namespace TL return "Messages_UnpinAllMessages"; }); - /// Delete a chat See + /// Delete a chat See Possible codes: 400 (details) /// Chat ID - /// Possible errors: 400 (details) public static Task Messages_DeleteChat(this Client client, long chat_id) => client.CallAsync(writer => { @@ -15644,11 +15481,10 @@ namespace TL return "Messages_CheckHistoryImport"; }); - /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See + /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See Possible codes: 400,406 (details) /// The Telegram chat where the history should be imported. /// File with messages to import. /// Number of media files associated with the chat that will be uploaded using messages.uploadImportedMedia. - /// Possible errors: 400,406 (details) public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) => client.CallAsync(writer => { @@ -15676,10 +15512,9 @@ namespace TL return "Messages_UploadImportedMedia"; }); - /// Complete the history import process, importing all messages into the chat.
To be called only after initializing the import with messages.initHistoryImport and uploading all files using messages.uploadImportedMedia. See
+ /// Complete the history import process, importing all messages into the chat.
To be called only after initializing the import with messages.initHistoryImport and uploading all files using messages.uploadImportedMedia. See Possible codes: 400 (details)
/// The Telegram chat where the messages should be imported, click here for more info » /// Identifier of a history import session, returned by messages.initHistoryImport. - /// Possible errors: 400 (details) public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) => client.CallAsync(writer => { @@ -15723,13 +15558,12 @@ namespace TL return "Messages_GetExportedChatInvite"; }); - /// Edit an exported chat invite See + /// Edit an exported chat invite See Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat /// Invite link /// New expiration date /// Maximum number of users that can join using this link - /// Possible errors: 400 (details) public static Task Messages_EditExportedChatInvite(this Client client, InputPeer peer, string link, bool revoked = false, DateTime? expire_date = null, int? usage_limit = null, bool? request_needed = default, string title = null) => client.CallAsync(writer => { @@ -15804,10 +15638,9 @@ namespace TL return "Messages_GetChatInviteImporters"; }); - /// Set maximum Time-To-Live of all messages in the specified chat See + /// Set maximum Time-To-Live of all messages in the specified chat See Possible codes: 400 (details) /// The dialog /// Automatically delete all messages sent in the chat after this many seconds - /// Possible errors: 400 (details) public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) => client.CallAsync(writer => { @@ -15817,9 +15650,8 @@ namespace TL return "Messages_SetHistoryTTL"; }); - /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See Possible codes: 400 (details) /// The chat where we want to import history ». - /// Possible errors: 400 (details) public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) => client.CallAsync(writer => { @@ -15828,10 +15660,9 @@ namespace TL return "Messages_CheckHistoryImportPeer"; }); - /// Change the chat theme of a certain chat See + /// Change the chat theme of a certain chat See Possible codes: 400 (details) /// Private chat where to change theme /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes - /// Possible errors: 400 (details) public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) => client.CallAsync(writer => { @@ -15841,10 +15672,9 @@ namespace TL return "Messages_SetChatTheme"; }); - /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See + /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details) /// Dialog /// Message ID - /// Possible errors: 400 (details) public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -15897,12 +15727,11 @@ namespace TL return "Updates_GetState"; }); - /// Get new updates. See + /// Get new updates. See Possible codes: 400,401,403 (details) /// PTS, see updates. /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 /// date, see updates. /// QTS, see updates. - /// Possible errors: 400,401,403 (details) public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null) => client.CallAsync(writer => { @@ -15916,13 +15745,12 @@ namespace TL return "Updates_GetDifference"; }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See + /// Returns the difference between the current state of updates of a certain channel and transmitted. See Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 - /// Possible errors: 400,403 (details) public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) => client.CallAsync(writer => { @@ -15935,9 +15763,8 @@ namespace TL return "Updates_GetChannelDifference"; }); - /// Installs a previously uploaded photo as a profile photo. See + /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) /// Input photo - /// Possible errors: 400 (details) public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) => client.CallAsync(writer => { @@ -15946,11 +15773,10 @@ namespace TL return "Photos_UpdateProfilePhoto"; }); - /// Updates current user profile photo. See + /// Updates current user profile photo. See Possible codes: 400 (details) /// File saved in parts by means of upload.saveFilePart method /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. - /// Possible errors: 400 (details) public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) => client.CallAsync(writer => { @@ -15975,12 +15801,11 @@ namespace TL return "Photos_DeletePhotos"; }); - /// Returns the list of user photos. See + /// Returns the list of user photos. See Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped /// If a positive value was transferred, the method will return only photos with IDs less than the set one /// Number of list elements to be returned - /// Possible errors: 400 (details) public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) => client.CallAsync(writer => { @@ -15992,11 +15817,10 @@ namespace TL return "Photos_GetUserPhotos"; }); - /// Saves a part of file for futher sending to one of the methods. See + /// Saves a part of file for futher sending to one of the methods. See Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part /// Binary data, contend of a part - /// Possible errors: 400 (details) public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) => client.CallAsync(writer => { @@ -16007,13 +15831,12 @@ namespace TL return "Upload_SaveFilePart"; }); - /// Returns content of a whole file or its part. See + /// Returns content of a whole file or its part. See Possible codes: 400,401,406 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads /// File location /// Number of bytes to be skipped /// Number of bytes to be returned - /// Possible errors: 400,401,406 (details) public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) => client.CallAsync(writer => { @@ -16025,12 +15848,11 @@ namespace TL return "Upload_GetFile"; }); - /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents - /// Possible errors: 400 (details) public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) => client.CallAsync(writer => { @@ -16042,11 +15864,10 @@ namespace TL return "Upload_SaveBigFilePart"; }); - /// See + /// See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned - /// Possible errors: 400 (details) public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) => client.CallAsync(writer => { @@ -16071,10 +15892,9 @@ namespace TL return "Upload_GetCdnFile"; }); - /// Request a reupload of a certain file to a CDN DC. See + /// Request a reupload of a certain file to a CDN DC. See Possible codes: 400 (details) /// File token /// Request token - /// Possible errors: 400 (details) public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) => client.CallAsync(writer => { @@ -16084,10 +15904,9 @@ namespace TL return "Upload_ReuploadCdnFile"; }); - /// Get SHA256 hashes for verifying downloaded CDN files See + /// Get SHA256 hashes for verifying downloaded CDN files See Possible codes: 400 (details) /// File /// Offset from which to start getting hashes - /// Possible errors: 400 (details) public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) => client.CallAsync(writer => { @@ -16097,10 +15916,9 @@ namespace TL return "Upload_GetCdnFileHashes"; }); - /// Get SHA256 hashes for verifying downloaded files See + /// Get SHA256 hashes for verifying downloaded files See Possible codes: 400 (details) /// File /// Offset from which to get file hashes - /// Possible errors: 400 (details) public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) => client.CallAsync(writer => { @@ -16110,8 +15928,7 @@ namespace TL return "Upload_GetFileHashes"; }); - /// Returns current configuration, including data center configuration. See - /// Possible errors: 400,403 (details) + /// Returns current configuration, including data center configuration. See Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); public static string Help_GetConfig(BinaryWriter writer) { @@ -16176,8 +15993,7 @@ namespace TL return "Help_SetBotUpdatesStatus"; }); - /// Get configuration for CDN file downloads. See - /// Possible errors: 401 (details) + /// Get configuration for CDN file downloads. See Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) => client.CallAsync(writer => { @@ -16253,8 +16069,7 @@ namespace TL return "Help_GetPassportConfig"; }); - /// Get localized name of the telegram support user See - /// Possible errors: 403 (details) + /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) => client.CallAsync(writer => { @@ -16262,10 +16077,9 @@ namespace TL return "Help_GetSupportName"; }); - /// Internal use See + /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty - /// Possible errors: 403 (details) public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) => client.CallAsync(writer => { @@ -16274,12 +16088,11 @@ namespace TL return "Help_GetUserInfo"; }); - /// Internal use See + /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty - /// Possible errors: 400 (details) public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) => client.CallAsync(writer => { @@ -16333,10 +16146,9 @@ namespace TL return "Help_GetCountriesList"; }); - /// Mark channel/supergroup history as read See + /// Mark channel/supergroup history as read See Possible codes: 400 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read - /// Possible errors: 400 (details) public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16346,10 +16158,9 @@ namespace TL return "Channels_ReadHistory"; }); - /// Delete messages in a channel/supergroup See + /// Delete messages in a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete - /// Possible errors: 400,403 (details) public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16359,10 +16170,9 @@ namespace TL return "Channels_DeleteMessages"; }); - /// Delete all messages sent by a certain user in a supergroup See + /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted - /// Possible errors: 400,403 (details) public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) => client.CallAsync(writer => { @@ -16372,11 +16182,10 @@ namespace TL return "Channels_DeleteUserHistory"; }); - /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup /// ID of the user that sent the spam messages /// IDs of spam messages - /// Possible errors: 400 (details) public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) => client.CallAsync(writer => { @@ -16387,10 +16196,9 @@ namespace TL return "Channels_ReportSpam"; }); - /// Get channel/supergroup messages See + /// Get channel/supergroup messages See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get - /// Possible errors: 400 (details) public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) => client.CallAsync(writer => { @@ -16400,14 +16208,13 @@ namespace TL return "Channels_GetMessages"; }); - /// Get the participants of a supergroup/channel See + /// Get the participants of a supergroup/channel See Possible codes: 400 (details) /// Channel /// Which participant types to fetch /// Offset /// Limit /// Hash /// a null value means channels.channelParticipantsNotModified - /// Possible errors: 400 (details) public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) => client.CallAsync(writer => { @@ -16420,10 +16227,9 @@ namespace TL return "Channels_GetParticipants"; }); - /// Get info about a channel/supergroup participant See + /// Get info about a channel/supergroup participant See Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about - /// Possible errors: 400 (details) public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) => client.CallAsync(writer => { @@ -16433,9 +16239,8 @@ namespace TL return "Channels_GetParticipant"; }); - /// Get info about channels/supergroups See + /// Get info about channels/supergroups See Possible codes: 400 (details) /// IDs of channels/supergroups to get info about - /// Possible errors: 400 (details) public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) => client.CallAsync(writer => { @@ -16444,9 +16249,8 @@ namespace TL return "Channels_GetChannels"; }); - /// Get full info about a channel See + /// Get full info about a channel See Possible codes: 400,403 (details) /// The channel to get info about - /// Possible errors: 400,403 (details) public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16455,7 +16259,7 @@ namespace TL return "Channels_GetFullChannel"; }); - /// Create a supergroup/channel. See + /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using messages.initHistoryImport @@ -16463,7 +16267,6 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - /// Possible errors: 400,403 (details) public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null) => client.CallAsync(writer => { @@ -16478,12 +16281,11 @@ namespace TL return "Channels_CreateChannel"; }); - /// Modify the admin rights of a user in a supergroup/channel. See + /// Modify the admin rights of a user in a supergroup/channel. See Possible codes: 400,403,406 (details) /// The supergroup/channel. /// The ID of the user whose admin rights should be modified /// The admin rights /// Indicates the role (rank) of the admin in the group: just an arbitrary string - /// Possible errors: 400,403,406 (details) public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) => client.CallAsync(writer => { @@ -16495,10 +16297,9 @@ namespace TL return "Channels_EditAdmin"; }); - /// Edit the name of a channel/supergroup See + /// Edit the name of a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// New name - /// Possible errors: 400,403 (details) public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) => client.CallAsync(writer => { @@ -16508,10 +16309,9 @@ namespace TL return "Channels_EditTitle"; }); - /// Change the photo of a channel/supergroup See + /// Change the photo of a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo - /// Possible errors: 400,403 (details) public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) => client.CallAsync(writer => { @@ -16521,10 +16321,9 @@ namespace TL return "Channels_EditPhoto"; }); - /// Check if a username is free and can be assigned to a channel/supergroup See + /// Check if a username is free and can be assigned to a channel/supergroup See Possible codes: 400 (details) /// The channel/supergroup that will assigned the specified username /// The username to check - /// Possible errors: 400 (details) public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16534,10 +16333,9 @@ namespace TL return "Channels_CheckUsername"; }); - /// Change the username of a supergroup/channel See + /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username - /// Possible errors: 400,403 (details) public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) => client.CallAsync(writer => { @@ -16547,9 +16345,8 @@ namespace TL return "Channels_UpdateUsername"; }); - /// Join a channel/supergroup See + /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join - /// Possible errors: 400 (details) public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16558,9 +16355,8 @@ namespace TL return "Channels_JoinChannel"; }); - /// Leave a channel/supergroup See + /// Leave a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to leave - /// Possible errors: 400,403 (details) public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16569,10 +16365,9 @@ namespace TL return "Channels_LeaveChannel"; }); - /// Invite users to a channel/supergroup See + /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite - /// Possible errors: 400,403 (details) public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) => client.CallAsync(writer => { @@ -16582,9 +16377,8 @@ namespace TL return "Channels_InviteToChannel"; }); - /// Delete a channel/supergroup See + /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete - /// Possible errors: 400,403 (details) public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) => client.CallAsync(writer => { @@ -16593,12 +16387,11 @@ namespace TL return "Channels_DeleteChannel"; }); - /// Get link and embed info of a message in a channel/supergroup See + /// Get link and embed info of a message in a channel/supergroup See Possible codes: 400 (details) /// Whether to include other grouped media (for albums) /// Whether to also include a thread ID, if available, inside of the link /// Channel /// Message ID - /// Possible errors: 400 (details) public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) => client.CallAsync(writer => { @@ -16609,10 +16402,9 @@ namespace TL return "Channels_ExportMessageLink"; }); - /// Enable/disable message signatures in channels See + /// Enable/disable message signatures in channels See Possible codes: 400 (details) /// Channel /// Value - /// Possible errors: 400 (details) public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16622,10 +16414,9 @@ namespace TL return "Channels_ToggleSignatures"; }); - /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See + /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) /// Get geogroups /// If set and the user has reached the limit of owned public channels/supergroups/geogroups, instead of returning the channel list one of the specified errors will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in channels.checkUsername/channels.updateUsername. - /// Possible errors: 400 (details) public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) => client.CallAsync(writer => { @@ -16634,11 +16425,10 @@ namespace TL return "Channels_GetAdminedPublicChannels"; }); - /// Ban/unban/kick a user in a supergroup/channel. See + /// Ban/unban/kick a user in a supergroup/channel. See Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights - /// Possible errors: 400,403 (details) public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) => client.CallAsync(writer => { @@ -16649,7 +16439,7 @@ namespace TL return "Channels_EditBanned"; }); - /// Get the admin log of a channel/supergroup See + /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty /// Event filter @@ -16657,7 +16447,6 @@ namespace TL /// Maximum ID of message to return (see pagination) /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination - /// Possible errors: 400,403 (details) public static Task Channels_GetAdminLog(this Client client, InputChannelBase channel, string q, long max_id, long min_id, int limit, ChannelAdminLogEventsFilter events_filter = null, InputUserBase[] admins = null) => client.CallAsync(writer => { @@ -16675,10 +16464,9 @@ namespace TL return "Channels_GetAdminLog"; }); - /// Associate a stickerset to the supergroup See + /// Associate a stickerset to the supergroup See Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate - /// Possible errors: 400,406 (details) public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.CallAsync(writer => { @@ -16688,10 +16476,9 @@ namespace TL return "Channels_SetStickers"; }); - /// Mark channel/supergroup message contents as read See + /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read - /// Possible errors: 400 (details) public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) => client.CallAsync(writer => { @@ -16701,10 +16488,9 @@ namespace TL return "Channels_ReadMessageContents"; }); - /// Delete the history of a supergroup See + /// Delete the history of a supergroup See Possible codes: 400 (details) /// Supergroup whose history must be deleted /// ID of message up to which the history must be deleted - /// Possible errors: 400 (details) public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) => client.CallAsync(writer => { @@ -16714,10 +16500,9 @@ namespace TL return "Channels_DeleteHistory"; }); - /// Hide/unhide message history for new channel/supergroup users See + /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide - /// Possible errors: 400 (details) public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) => client.CallAsync(writer => { @@ -16727,9 +16512,8 @@ namespace TL return "Channels_TogglePreHistoryHidden"; }); - /// Get a list of channels/supergroups we left See + /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination - /// Possible errors: 403 (details) public static Task Channels_GetLeftChannels(this Client client, int offset) => client.CallAsync(writer => { @@ -16746,10 +16530,9 @@ namespace TL return "Channels_GetGroupsForDiscussion"; }); - /// Associate a group to a channel as discussion group for that channel See + /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) /// Channel /// Discussion group to associate to the channel - /// Possible errors: 400 (details) public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) => client.CallAsync(writer => { @@ -16759,11 +16542,10 @@ namespace TL return "Channels_SetDiscussionGroup"; }); - /// Transfer channel ownership See + /// Transfer channel ownership See Possible codes: 400,403 (details) /// Channel /// New channel owner /// 2FA password of account - /// Possible errors: 400,403 (details) public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) => client.CallAsync(writer => { @@ -16774,11 +16556,10 @@ namespace TL return "Channels_EditCreator"; }); - /// Edit location of geogroup See + /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string - /// Possible errors: 400 (details) public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) => client.CallAsync(writer => { @@ -16789,10 +16570,9 @@ namespace TL return "Channels_EditLocation"; }); - /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See Possible codes: 400 (details) /// The supergroup /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation - /// Possible errors: 400 (details) public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) => client.CallAsync(writer => { @@ -16819,10 +16599,9 @@ namespace TL return "Channels_ConvertToGigagroup"; }); - /// Mark a specific sponsored message as read See + /// Mark a specific sponsored message as read See Possible codes: 400 (details) /// Peer /// Message ID - /// Possible errors: 400 (details) public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.CallAsync(writer => { @@ -16842,10 +16621,9 @@ namespace TL return "Channels_GetSponsoredMessages"; }); - /// Sends a custom request; for bots only See + /// Sends a custom request; for bots only See Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters - /// Possible errors: 400 (details) public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) => client.CallAsync(writer => { @@ -16855,10 +16633,9 @@ namespace TL return "Bots_SendCustomRequest"; }); - /// Answers a custom query; for bots only See + /// Answers a custom query; for bots only See Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query - /// Possible errors: 400 (details) public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) => client.CallAsync(writer => { @@ -16868,11 +16645,10 @@ namespace TL return "Bots_AnswerWebhookJSONQuery"; }); - /// Set bot command list See + /// Set bot command list See Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands - /// Possible errors: 400 (details) public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) => client.CallAsync(writer => { @@ -16907,11 +16683,10 @@ namespace TL return "Bots_GetBotCommands"; }); - /// Get a payment form See + /// Get a payment form See Possible codes: 400 (details) /// The peer where the payment form was sent /// Message ID of payment form /// A JSON object with the following keys, containing color theme information (integers, RGB24) to pass to the payment provider, to apply in eventual verification pages:
bg_color - Background color
text_color - Text color
hint_color - Hint text color
link_color - Link color
button_color - Button color
button_text_color - Button text color - /// Possible errors: 400 (details) public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) => client.CallAsync(writer => { @@ -16924,10 +16699,9 @@ namespace TL return "Payments_GetPaymentForm"; }); - /// Get payment receipt See + /// Get payment receipt See Possible codes: 400 (details) /// The peer where the payment receipt was sent /// Message ID of receipt - /// Possible errors: 400 (details) public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) => client.CallAsync(writer => { @@ -16937,12 +16711,11 @@ namespace TL return "Payments_GetPaymentReceipt"; }); - /// Submit requested order information for validation See + /// Submit requested order information for validation See Possible codes: 400 (details) /// Save order information to re-use it for future orders /// Peer where the payment form was sent /// Message ID of payment form /// Requested order information - /// Possible errors: 400 (details) public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) => client.CallAsync(writer => { @@ -16954,7 +16727,7 @@ namespace TL return "Payments_ValidateRequestedInfo"; }); - /// Send compiled payment form See + /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent /// Message ID of form @@ -16962,7 +16735,6 @@ namespace TL /// Chosen shipping option ID /// Payment credentials /// Tip, in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). - /// Possible errors: 400 (details) public static Task Payments_SendPaymentForm(this Client client, long form_id, InputPeer peer, int msg_id, InputPaymentCredentialsBase credentials, string requested_info_id = null, string shipping_option_id = null, long? tip_amount = null) => client.CallAsync(writer => { @@ -17000,9 +16772,8 @@ namespace TL return "Payments_ClearSavedInfo"; }); - /// Get info about a credit card See + /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number - /// Possible errors: 400 (details) public static Task Payments_GetBankCardData(this Client client, string number) => client.CallAsync(writer => { @@ -17011,7 +16782,7 @@ namespace TL return "Payments_GetBankCardData"; }); - /// Create a stickerset, bots only. See + /// Create a stickerset, bots only. See Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Stickerset owner @@ -17020,7 +16791,6 @@ namespace TL /// Thumbnail /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers - /// Possible errors: 400 (details) public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, InputDocument thumb = null, string software = null) => client.CallAsync(writer => { @@ -17037,9 +16807,8 @@ namespace TL return "Stickers_CreateStickerSet"; }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) /// The sticker to remove - /// Possible errors: 400 (details) public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) => client.CallAsync(writer => { @@ -17048,10 +16817,9 @@ namespace TL return "Stickers_RemoveStickerFromSet"; }); - /// Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot See + /// Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot See Possible codes: 400 (details) /// The sticker /// The new position of the sticker, zero-based - /// Possible errors: 400 (details) public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) => client.CallAsync(writer => { @@ -17061,10 +16829,9 @@ namespace TL return "Stickers_ChangeStickerPosition"; }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See Possible codes: 400 (details) /// The stickerset /// The sticker - /// Possible errors: 400 (details) public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) => client.CallAsync(writer => { @@ -17074,10 +16841,9 @@ namespace TL return "Stickers_AddStickerToSet"; }); - /// Set stickerset thumbnail See + /// Set stickerset thumbnail See Possible codes: 400 (details) /// Stickerset /// Thumbnail - /// Possible errors: 400 (details) public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) => client.CallAsync(writer => { @@ -17087,9 +16853,8 @@ namespace TL return "Stickers_SetStickerSetThumb"; }); - /// Check whether the given short name is available See + /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name - /// Possible errors: 400 (details) public static Task Stickers_CheckShortName(this Client client, string short_name) => client.CallAsync(writer => { @@ -17098,9 +16863,8 @@ namespace TL return "Stickers_CheckShortName"; }); - /// Suggests a short name for a given stickerpack name See + /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name - /// Possible errors: 400 (details) public static Task Stickers_SuggestShortName(this Client client, string title) => client.CallAsync(writer => { @@ -17117,13 +16881,12 @@ namespace TL return "Phone_GetCallConfig"; }); - /// Start a telegram phone call See + /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object /// Parameter for E2E encryption key exchange » /// Phone call settings - /// Possible errors: 400,403 (details) public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) => client.CallAsync(writer => { @@ -17136,11 +16899,10 @@ namespace TL return "Phone_RequestCall"; }); - /// Accept incoming call See + /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings - /// Possible errors: 400 (details) public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -17151,12 +16913,11 @@ namespace TL return "Phone_AcceptCall"; }); - /// Complete phone call E2E encryption key exchange » See + /// Complete phone call E2E encryption key exchange » See Possible codes: 400 (details) /// The phone call /// Parameter for E2E encryption key exchange » /// Key fingerprint /// Phone call settings - /// Possible errors: 400 (details) public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) => client.CallAsync(writer => { @@ -17168,9 +16929,8 @@ namespace TL return "Phone_ConfirmCall"; }); - /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See + /// Optional: notify the server that the user is currently busy in a call: this will automatically refuse all incoming phone calls until the current phone call is ended. See Possible codes: 400 (details) /// The phone call we're currently in - /// Possible errors: 400 (details) public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) => client.CallAsync(writer => { @@ -17179,13 +16939,12 @@ namespace TL return "Phone_ReceivedCall"; }); - /// Refuse or end running call See + /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call /// Call duration /// Why was the call discarded /// Preferred libtgvoip relay ID - /// Possible errors: 400 (details) public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) => client.CallAsync(writer => { @@ -17198,12 +16957,11 @@ namespace TL return "Phone_DiscardCall"; }); - /// Rate a call See + /// Rate a call See Possible codes: 400 (details) /// Whether the user decided on their own initiative to rate the call /// The call to rate /// Rating in 1-5 stars /// An additional comment - /// Possible errors: 400 (details) public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) => client.CallAsync(writer => { @@ -17215,10 +16973,9 @@ namespace TL return "Phone_SetCallRating"; }); - /// Send phone call debug data to server See + /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip - /// Possible errors: 400 (details) public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) => client.CallAsync(writer => { @@ -17240,12 +16997,11 @@ namespace TL return "Phone_SendSignalingData"; }); - /// Create a group call or livestream See + /// Create a group call or livestream See Possible codes: 400 (details) /// Associate the group call or livestream to the provided group/supergroup/channel /// Unique client message ID required to prevent creation of duplicate group calls /// Call title /// For scheduled group call or livestreams, the absolute date when the group call will start - /// Possible errors: 400 (details) public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, string title = null, DateTime? schedule_date = null) => client.CallAsync(writer => { @@ -17260,14 +17016,13 @@ namespace TL return "Phone_CreateGroupCall"; }); - /// Join a group call See + /// Join a group call See Possible codes: 400 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// WebRTC parameters - /// Possible errors: 400 (details) public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, bool muted = false, bool video_stopped = false, string invite_hash = null) => client.CallAsync(writer => { @@ -17293,10 +17048,9 @@ namespace TL return "Phone_LeaveGroupCall"; }); - /// Invite a set of users to a group call. See + /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. - /// Possible errors: 403 (details) public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) => client.CallAsync(writer => { @@ -17316,11 +17070,10 @@ namespace TL return "Phone_DiscardGroupCall"; }); - /// Change group call settings See + /// Change group call settings See Possible codes: 400 (details) /// Invalidate existing invite links /// Group call /// Whether all users will bthat join this group calle muted by default upon joining the group call - /// Possible errors: 400 (details) public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) => client.CallAsync(writer => { @@ -17393,7 +17146,7 @@ namespace TL return "Phone_ToggleGroupCallRecord"; }); - /// Edit information about a given group call participant See + /// Edit information about a given group call participant See Possible codes: 400 (details) /// The group call /// The group call participant (can also be the user itself) /// Whether to mute or unmute the specified participant @@ -17402,7 +17155,6 @@ namespace TL /// Start or stop the video stream /// Pause or resume the video stream /// Pause or resume the screen sharing stream - /// Possible errors: 400 (details) public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCall call, InputPeer participant, bool? muted = default, int? volume = null, bool? raise_hand = default, bool? video_stopped = default, bool? video_paused = default, bool? presentation_paused = default) => client.CallAsync(writer => { @@ -17493,10 +17245,9 @@ namespace TL return "Phone_SaveDefaultGroupCallJoinAs"; }); - /// Start screen sharing in a call See + /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters - /// Possible errors: 403 (details) public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) => client.CallAsync(writer => { @@ -17516,10 +17267,9 @@ namespace TL return "Phone_LeaveGroupCallPresentation"; }); - /// Get localization pack strings See + /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code - /// Possible errors: 400 (details) public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.CallAsync(writer => { @@ -17529,11 +17279,10 @@ namespace TL return "Langpack_GetLangPack"; }); - /// Get strings from a language pack See + /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get - /// Possible errors: 400 (details) public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) => client.CallAsync(writer => { @@ -17544,11 +17293,10 @@ namespace TL return "Langpack_GetStrings"; }); - /// Get new strings in languagepack See + /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version - /// Possible errors: 400 (details) public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) => client.CallAsync(writer => { @@ -17559,9 +17307,8 @@ namespace TL return "Langpack_GetDifference"; }); - /// Get information about all languages in a localization pack See + /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack - /// Possible errors: 400 (details) public static Task Langpack_GetLanguages(this Client client, string lang_pack) => client.CallAsync(writer => { @@ -17582,9 +17329,8 @@ namespace TL return "Langpack_GetLanguage"; }); - /// Edit peers in peer folder See + /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list - /// Possible errors: 400 (details) public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) => client.CallAsync(writer => { @@ -17593,9 +17339,8 @@ namespace TL return "Folders_EditPeerFolders"; }); - /// Delete a peer folder See + /// Delete a peer folder See Possible codes: 400 (details) /// Peer folder ID, for more info click here - /// Possible errors: 400 (details) public static Task Folders_DeleteFolder(this Client client, int folder_id) => client.CallAsync(writer => { @@ -17604,10 +17349,9 @@ namespace TL return "Folders_DeleteFolder"; }); - /// Get channel statistics See + /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel - /// Possible errors: 400 (details) public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17617,10 +17361,9 @@ namespace TL return "Stats_GetBroadcastStats"; }); - /// Load channel statistics graph asynchronously See + /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required - /// Possible errors: 400 (details) public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) => client.CallAsync(writer => { @@ -17632,10 +17375,9 @@ namespace TL return "Stats_LoadAsyncGraph"; }); - /// Get supergroup statistics See + /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID - /// Possible errors: 400 (details) public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) => client.CallAsync(writer => { @@ -17645,14 +17387,13 @@ namespace TL return "Stats_GetMegagroupStats"; }); - /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of with peer_id equal to the public channel to which this message was forwarded. See
+ /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of with peer_id equal to the public channel to which this message was forwarded. See
Possible codes: 400 (details)
/// Source channel /// Source message ID /// Initially 0, then set to the next_rate parameter of /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - /// Possible errors: 400 (details) public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate, InputPeer offset_peer, int offset_id, int limit) => client.CallAsync(writer => { @@ -17666,11 +17407,10 @@ namespace TL return "Stats_GetMessagePublicForwards"; }); - /// Get message statistics See + /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID - /// Possible errors: 400 (details) public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) => client.CallAsync(writer => {