diff --git a/src/Client.cs b/src/Client.cs index 4abac12..c56611c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -44,7 +44,7 @@ namespace WTelegram private static readonly byte[] IntermediateHeader = new byte[4] { 0xee, 0xee, 0xee, 0xee }; private TcpClient _tcpClient; private NetworkStream _networkStream; - private ITLFunction _lastSentMsg; + private ITLObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = new(); private readonly Random _random = new(); @@ -143,7 +143,7 @@ namespace WTelegram try { if (CheckMsgsToAck() is MsgsAck msgsAck) - SendAsync(MakeFunction(msgsAck), false).Wait(1000); + SendAsync(msgsAck, false).Wait(1000); } catch (Exception) { @@ -260,15 +260,18 @@ namespace WTelegram await CreateAuthorizationKey(this, _dcSession); var keepAliveTask = KeepAlive(_cts.Token); - TLConfig = await this.InvokeWithLayer(Layer.Version, - Schema.InitConnection(_apiId, - Config("device_model"), - Config("system_version"), - Config("app_version"), - Config("system_lang_code"), - Config("lang_pack"), - Config("lang_code"), - Schema.Help_GetConfig)); + TLConfig = await this.InvokeWithLayer(Layer.Version, + new Schema.InitConnection_ + { + api_id = _apiId, + device_model = Config("device_model"), + system_version = Config("system_version"), + app_version = Config("app_version"), + system_lang_code = Config("system_lang_code"), + lang_pack = Config("lang_pack"), + lang_code = Config("lang_code"), + query = new Schema.Help_GetConfig_() + }); _session.DcOptions = TLConfig.dc_options; _saltChangeCounter = 0; if (_dcSession.DataCenter == null) @@ -551,13 +554,13 @@ namespace WTelegram return length; } - private async Task SendAsync(ITLFunction func, bool isContent) + private async Task SendAsync(ITLObject msg, bool isContent) { if (_dcSession.AuthKeyID != 0 && isContent && CheckMsgsToAck() is MsgsAck msgsAck) { var ackMsg = NewMsgId(false); var mainMsg = NewMsgId(true); - await SendAsync(MakeContainer((MakeFunction(msgsAck), ackMsg), (func, mainMsg)), false); + await SendAsync(MakeContainer((msgsAck, ackMsg), (msg, mainMsg)), false); return mainMsg.msgId; } (long msgId, int seqno) = NewMsgId(isContent && _dcSession.AuthKeyID != 0); @@ -573,8 +576,8 @@ namespace WTelegram writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted) writer.Write(msgId); // int64 message_id writer.Write(0); // int32 message_data_length (to be patched) - var typeName = func(writer); // bytes message_data - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName}..."); + writer.WriteTLObject(msg); // bytes message_data + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name}..."); BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } else @@ -592,11 +595,11 @@ namespace WTelegram clearWriter.Write(msgId); // int64 message_id clearWriter.Write(seqno); // int32 msg_seqno clearWriter.Write(0); // int32 message_data_length (to be patched) - var typeName = func(clearWriter); // bytes message_data + clearWriter.WriteTLObject(msg); // bytes message_data if ((seqno & 1) != 0) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName,-40} #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} #{(short)msgId.GetHashCode():X4}"); else - Helpers.Log(1, $"{_dcSession.DcID}>Sending {typeName,-40} {MsgIdToStamp(msgId):u} (svc)"); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name,-40} {MsgIdToStamp(msgId):u} (svc)"); int clearLength = (int)clearStream.Length - prepend; // length before padding (= 32 + message_data_length) int padding = (0x7FFFFFF0 - clearLength) % 16; #if !MTPROTO1 @@ -626,7 +629,7 @@ namespace WTelegram //TODO: support Transport obfuscation? await _networkStream.WriteAsync(memStream.GetBuffer(), 0, frameLength); - _lastSentMsg = func; + _lastSentMsg = msg; } finally { @@ -635,13 +638,6 @@ namespace WTelegram return msgId; } - private static ITLFunction MakeFunction(ITLObject msg) - => writer => - { - writer.WriteTLObject(msg); - return msg.GetType().Name; - }; - internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) { int count = reader.ReadInt32(); @@ -727,7 +723,7 @@ namespace WTelegram return request; } - internal async Task CallBareAsync(ITLFunction request) + internal async Task CallBareAsync(ITLMethod request) { if (_bareRequest != 0) throw new ApplicationException("A bare request is already undergoing"); var msgId = await SendAsync(request, false); @@ -740,9 +736,9 @@ namespace WTelegram /// Call the given TL method (You shouldn't need to call this, usually) /// Expected type of the returned object - /// TL method serializer + /// TL method object /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied - public async Task CallAsync(ITLFunction request) + public async Task CallAsync(ITLMethod request) { retry: var msgId = await SendAsync(request, true); @@ -806,27 +802,15 @@ namespace WTelegram } } - private ITLFunction MakeContainer(params (ITLFunction func, (long msgId, int seqno))[] msgs) - => writer => + private static MsgContainer MakeContainer(params (ITLObject obj, (long msgId, int seqno))[] msgs) + => new() { - writer.Write(0x73F1F8DC); - writer.Write(msgs.Length); - foreach (var (func, (msgId, seqno)) in msgs) + messages = msgs.Select(msg => new _Message { - writer.Write(msgId); - writer.Write(seqno); - var patchPos = writer.BaseStream.Position; - writer.Write(0); - var typeName = func(writer); - if ((seqno & 1) != 0) - Helpers.Log(1, $" Sending → {typeName,-40} #{(short)msgId.GetHashCode():X4}"); - else - Helpers.Log(1, $" Sending → {typeName,-40} {MsgIdToStamp(msgId):u} (svc)"); - writer.BaseStream.Position = patchPos; - writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field - writer.Seek(0, SeekOrigin.End); - } - return "as MsgContainer"; + msg_id = msg.Item2.msgId, + seqno = msg.Item2.seqno, + body = msg.obj + }).ToArray() }; private async Task HandleMessageAsync(ITLObject obj) @@ -855,8 +839,8 @@ namespace WTelegram } } break; - case Ping ping: - _ = SendAsync(MakeFunction(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }), false); + case MTProto.Ping_ ping: + _ = SendAsync(new Pong { msg_id = _lastRecvMsgId, ping_id = ping.ping_id }, false); break; case Pong pong: SetResult(pong.msg_id, pong); diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index b6bcd6b..c100635 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -293,111 +293,130 @@ namespace TL public AccessPointRule[] rules; } - [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public partial class Ping : ITLObject - { - public long ping_id; - } - // ---functions--- public static class MTProto { - //req_pq#60469778 nonce:int128 = ResPQ + [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ + public partial class ReqPq_ : ITLMethod + { + public Int128 nonce; + } public static Task ReqPq(this Client client, Int128 nonce) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqPq_ { - writer.Write(0x60469778); - writer.Write(nonce); - return "ReqPq"; + nonce = nonce, }); - //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ + public partial class ReqPqMulti_ : ITLMethod + { + public Int128 nonce; + } public static Task ReqPqMulti(this Client client, Int128 nonce) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqPqMulti_ { - writer.Write(0xBE7E8EF1); - writer.Write(nonce); - return "ReqPqMulti"; + nonce = nonce, }); - //req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params + [TLDef(0xD712E4BE)] //req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params + public partial class ReqDHParams_ : ITLMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] p; + public byte[] q; + public long public_key_fingerprint; + public byte[] encrypted_data; + } public static Task ReqDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] p, byte[] q, long public_key_fingerprint, byte[] encrypted_data) - => client.CallBareAsync(writer => + => client.CallBareAsync(new ReqDHParams_ { - writer.Write(0xD712E4BE); - writer.Write(nonce); - writer.Write(server_nonce); - writer.WriteTLBytes(p); - writer.WriteTLBytes(q); - writer.Write(public_key_fingerprint); - writer.WriteTLBytes(encrypted_data); - return "ReqDHParams"; + nonce = nonce, + server_nonce = server_nonce, + p = p, + q = q, + public_key_fingerprint = public_key_fingerprint, + encrypted_data = encrypted_data, }); - //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer + [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer + public partial class SetClientDHParams_ : ITLMethod + { + public Int128 nonce; + public Int128 server_nonce; + public byte[] encrypted_data; + } public static Task SetClientDHParams(this Client client, Int128 nonce, Int128 server_nonce, byte[] encrypted_data) - => client.CallBareAsync(writer => + => client.CallBareAsync(new SetClientDHParams_ { - writer.Write(0xF5045F1F); - writer.Write(nonce); - writer.Write(server_nonce); - writer.WriteTLBytes(encrypted_data); - return "SetClientDHParams"; + nonce = nonce, + server_nonce = server_nonce, + encrypted_data = encrypted_data, }); - //destroy_auth_key#d1435160 = DestroyAuthKeyRes + [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes + public partial class DestroyAuthKey_ : ITLMethod { } public static Task DestroyAuthKey(this Client client) - => client.CallBareAsync(writer => + => client.CallBareAsync(new DestroyAuthKey_ { - writer.Write(0xD1435160); - return "DestroyAuthKey"; }); - //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer + public partial class RpcDropAnswer_ : ITLMethod + { + public long req_msg_id; + } public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.CallBareAsync(writer => + => client.CallBareAsync(new RpcDropAnswer_ { - writer.Write(0x58E4A740); - writer.Write(req_msg_id); - return "RpcDropAnswer"; + req_msg_id = req_msg_id, }); - //get_future_salts#b921bd04 num:int = FutureSalts + [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts + public partial class GetFutureSalts_ : ITLMethod + { + public int num; + } public static Task GetFutureSalts(this Client client, int num) - => client.CallAsync(writer => + => client.CallAsync(new GetFutureSalts_ { - writer.Write(0xB921BD04); - writer.Write(num); - return "GetFutureSalts"; + num = num, }); - //ping#7abe77ec ping_id:long = Pong + [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong + public partial class Ping_ : ITLMethod + { + public long ping_id; + } public static Task Ping(this Client client, long ping_id) - => client.CallAsync(writer => + => client.CallAsync(new Ping_ { - writer.Write(0x7ABE77EC); - writer.Write(ping_id); - return "Ping"; + ping_id = ping_id, }); - //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong + [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong + public partial class PingDelayDisconnect_ : ITLMethod + { + public long ping_id; + public int disconnect_delay; + } public static Task PingDelayDisconnect(this Client client, long ping_id, int disconnect_delay) - => client.CallAsync(writer => + => client.CallAsync(new PingDelayDisconnect_ { - writer.Write(0xF3427B8C); - writer.Write(ping_id); - writer.Write(disconnect_delay); - return "PingDelayDisconnect"; + ping_id = ping_id, + disconnect_delay = disconnect_delay, }); - //destroy_session#e7512126 session_id:long = DestroySessionRes + [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes + public partial class DestroySession_ : ITLMethod + { + public long session_id; + } public static Task DestroySession(this Client client, long session_id) - => client.CallBareAsync(writer => + => client.CallBareAsync(new DestroySession_ { - writer.Write(0xE7512126); - writer.Write(session_id); - return "DestroySession"; + session_id = session_id, }); } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 89837f0..65e1a20 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -12236,30 +12236,79 @@ namespace TL public static class Schema { + /// Invokes a query after successfull completion of one of the previous queries. See + [TLDef(0xCB9F372D)] + public partial class InvokeAfterMsg_ : ITLMethod + { + /// Message identifier on which a current query depends + public long msg_id; + /// The query itself + public ITLMethod query; + } /// Invokes a query after successfull completion of one of the previous queries. See /// Message identifier on which a current query depends /// The query itself - public static Task InvokeAfterMsg(this Client client, long msg_id, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeAfterMsg(this Client client, long msg_id, ITLMethod query) + => client.CallAsync(new InvokeAfterMsg_ { - writer.Write(0xCB9F372D); - writer.Write(msg_id); - query(writer); - return "InvokeAfterMsg"; + msg_id = msg_id, + query = query, }); + /// Invokes a query after a successfull completion of previous queries See + [TLDef(0x3DC4B4F0)] + public partial class InvokeAfterMsgs_ : ITLMethod + { + /// List of messages on which a current query depends + public long[] msg_ids; + /// The query itself + public ITLMethod query; + } /// Invokes a query after a successfull completion of previous queries See /// List of messages on which a current query depends /// The query itself - public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, ITLMethod query) + => client.CallAsync(new InvokeAfterMsgs_ { - writer.Write(0x3DC4B4F0); - writer.WriteTLVector(msg_ids); - query(writer); - return "InvokeAfterMsgs"; + msg_ids = msg_ids, + query = query, }); + /// Initialize connection See + [TLDef(0xC1CD5EA9)] + public partial class InitConnection_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Application identifier (see. App configuration) + public int api_id; + /// Device model + public string device_model; + /// Operation system version + public string system_version; + /// Application version + public string app_version; + /// Code for the language used on the device's OS, ISO 639-1 standard + public string system_lang_code; + /// Language pack to use + public string lang_pack; + /// Code for the language used on the client, ISO 639-1 standard + public string lang_code; + /// Info about an MTProto proxy + [IfFlag(0)] public InputClientProxy proxy; + /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds.
+ [IfFlag(1)] public JSONValue params_; + /// The query itself + public ITLMethod query; + + [Flags] public enum Flags + { + /// Field has a value + has_proxy = 0x1, + /// Field has a value + has_params = 0x2, + } + } /// Initialize connection See Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model @@ -12271,297 +12320,472 @@ 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 - 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 => + public static Task InitConnection(this Client client, int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, ITLMethod query, InputClientProxy proxy = null, JSONValue params_ = null) + => client.CallAsync(new InitConnection_ { - writer.Write(0xC1CD5EA9); - writer.Write((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)); - writer.Write(api_id); - writer.WriteTLString(device_model); - writer.WriteTLString(system_version); - writer.WriteTLString(app_version); - writer.WriteTLString(system_lang_code); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - if (proxy != null) - writer.WriteTLObject(proxy); - if (params_ != null) - writer.WriteTLObject(params_); - query(writer); - return "InitConnection"; - }; + flags = (InitConnection_.Flags)((proxy != null ? 0x1 : 0) | (params_ != null ? 0x2 : 0)), + api_id = api_id, + device_model = device_model, + system_version = system_version, + app_version = app_version, + system_lang_code = system_lang_code, + lang_pack = lang_pack, + lang_code = lang_code, + proxy = proxy, + params_ = params_, + query = query, + }); + /// Invoke the specified query using the specified API layer See + [TLDef(0xDA9B0D0D)] + public partial class InvokeWithLayer_ : ITLMethod + { + /// The layer to use + public int layer; + /// The query + public ITLMethod query; + } /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) /// The layer to use /// The query - public static Task InvokeWithLayer(this Client client, int layer, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithLayer(this Client client, int layer, ITLMethod query) + => client.CallAsync(new InvokeWithLayer_ { - writer.Write(0xDA9B0D0D); - writer.Write(layer); - query(writer); - return "InvokeWithLayer"; + layer = layer, + query = query, }); + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See + [TLDef(0xBF9459B7)] + public partial class InvokeWithoutUpdates_ : ITLMethod + { + /// The query + public ITLMethod query; + } /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See /// The query - public static Task InvokeWithoutUpdates(this Client client, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithoutUpdates(this Client client, ITLMethod query) + => client.CallAsync(new InvokeWithoutUpdates_ { - writer.Write(0xBF9459B7); - query(writer); - return "InvokeWithoutUpdates"; + query = query, }); + /// Invoke with the given message range See + [TLDef(0x365275F2)] + public partial class InvokeWithMessagesRange_ : ITLMethod + { + /// Message range + public MessageRange range; + /// Query + public ITLMethod query; + } /// Invoke with the given message range See /// Message range /// Query - public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithMessagesRange(this Client client, MessageRange range, ITLMethod query) + => client.CallAsync(new InvokeWithMessagesRange_ { - writer.Write(0x365275F2); - writer.WriteTLObject(range); - query(writer); - return "InvokeWithMessagesRange"; + range = range, + query = query, }); + /// Invoke a method within a takeout session See + [TLDef(0xACA9FD2E)] + public partial class InvokeWithTakeout_ : ITLMethod + { + /// Takeout session ID + public long takeout_id; + /// Query + public ITLMethod query; + } /// Invoke a method within a takeout session See /// Takeout session ID /// Query - public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLFunction query) - => client.CallAsync(writer => + public static Task InvokeWithTakeout(this Client client, long takeout_id, ITLMethod query) + => client.CallAsync(new InvokeWithTakeout_ { - writer.Write(0xACA9FD2E); - writer.Write(takeout_id); - query(writer); - return "InvokeWithTakeout"; + takeout_id = takeout_id, + query = query, }); + /// Send the verification code for login See + [TLDef(0xA677244F)] + public partial class Auth_SendCode_ : ITLMethod + { + /// Phone number in international format + public string phone_number; + /// Application identifier (see App configuration) + public int api_id; + /// Application secret hash (see App configuration) + public string api_hash; + /// Settings for the code type to send + public CodeSettings settings; + } /// 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 public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SendCode_ { - writer.Write(0xA677244F); - writer.WriteTLString(phone_number); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLObject(settings); - return "Auth_SendCode"; + phone_number = phone_number, + api_id = api_id, + api_hash = api_hash, + settings = settings, }); + /// Registers a validated phone number in the system. See + [TLDef(0x80EEE427)] + public partial class Auth_SignUp_ : ITLMethod + { + /// Phone number in the international format + public string phone_number; + /// SMS-message ID + public string phone_code_hash; + /// New user first name + public string first_name; + /// New user last name + public string last_name; + } /// 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 public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SignUp_ { - writer.Write(0x80EEE427); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(first_name); - writer.WriteTLString(last_name); - return "Auth_SignUp"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + first_name = first_name, + last_name = last_name, }); + /// Signs in a user with a validated phone number. See + [TLDef(0xBCD51581)] + public partial class Auth_SignIn_ : ITLMethod + { + /// Phone number in the international format + public string phone_number; + /// SMS-message ID, obtained from auth.sendCode + public string phone_code_hash; + /// Valid numerical code from the SMS-message + public string phone_code; + } /// 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 public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Auth_SignIn_ { - writer.Write(0xBCD51581); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Auth_SignIn"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Logs out the user. See + [TLDef(0x5717DA40)] + public partial class Auth_LogOut_ : ITLMethod { } /// Logs out the user. See [bots: ✓] public static Task Auth_LogOut(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Auth_LogOut_ { - writer.Write(0x5717DA40); - return "Auth_LogOut"; }); + /// Terminates all user's authorized sessions except for the current one. See + [TLDef(0x9FAB0D1A)] + public partial class Auth_ResetAuthorizations_ : ITLMethod { } /// 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 => + => client.CallAsync(new Auth_ResetAuthorizations_ { - writer.Write(0x9FAB0D1A); - return "Auth_ResetAuthorizations"; }); + /// Returns data for copying authorization to another data-centre. See + [TLDef(0xE5BFFFCD)] + public partial class Auth_ExportAuthorization_ : ITLMethod + { + /// Number of a target data-centre + public int dc_id; + } /// Returns data for copying authorization to another data-centre. See [bots: ✓] Possible codes: 400 (details) /// Number of a target data-centre public static Task Auth_ExportAuthorization(this Client client, int dc_id) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ExportAuthorization_ { - writer.Write(0xE5BFFFCD); - writer.Write(dc_id); - return "Auth_ExportAuthorization"; + dc_id = dc_id, }); + /// Logs in a user using a key transmitted from his native data-centre. See + [TLDef(0xA57A7DAD)] + public partial class Auth_ImportAuthorization_ : ITLMethod + { + /// User ID + public long id; + /// Authorization key + public byte[] bytes; + } /// Logs in a user using a key transmitted from his native data-centre. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Authorization key public static Task Auth_ImportAuthorization(this Client client, long id, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ImportAuthorization_ { - writer.Write(0xA57A7DAD); - writer.Write(id); - writer.WriteTLBytes(bytes); - return "Auth_ImportAuthorization"; + id = id, + bytes = bytes, }); + /// 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 + [TLDef(0xCDD42A05)] + public partial class Auth_BindTempAuthKey_ : ITLMethod + { + /// Permanent auth_key_id to bind to + public long perm_auth_key_id; + /// Random long from Binding message contents + public long nonce; + /// Unix timestamp to invalidate temporary key, see Binding message contents + public DateTime expires_at; + /// See Generating encrypted_message + public byte[] encrypted_message; + } /// 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 [bots: ✓] 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 public static Task Auth_BindTempAuthKey(this Client client, long perm_auth_key_id, long nonce, DateTime expires_at, byte[] encrypted_message) - => client.CallAsync(writer => + => client.CallAsync(new Auth_BindTempAuthKey_ { - writer.Write(0xCDD42A05); - writer.Write(perm_auth_key_id); - writer.Write(nonce); - writer.WriteTLStamp(expires_at); - writer.WriteTLBytes(encrypted_message); - return "Auth_BindTempAuthKey"; + perm_auth_key_id = perm_auth_key_id, + nonce = nonce, + expires_at = expires_at, + encrypted_message = encrypted_message, }); + /// Login as a bot See + [TLDef(0x67A3FF2C)] + public partial class Auth_ImportBotAuthorization_ : ITLMethod + { + /// Reserved for future use + public int flags; + /// Application identifier (see. App configuration) + public int api_id; + /// Application identifier hash (see. App configuration) + public string api_hash; + /// Bot token (see bots) + public string bot_auth_token; + } /// Login as a bot See [bots: ✓] Possible codes: 400,401 (details) /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) public static Task Auth_ImportBotAuthorization(this Client client, int flags, int api_id, string api_hash, string bot_auth_token) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ImportBotAuthorization_ { - writer.Write(0x67A3FF2C); - writer.Write(flags); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLString(bot_auth_token); - return "Auth_ImportBotAuthorization"; + flags = flags, + api_id = api_id, + api_hash = api_hash, + bot_auth_token = bot_auth_token, }); + /// Try logging to an account protected by a 2FA password. See + [TLDef(0xD18B4D16)] + public partial class Auth_CheckPassword_ : ITLMethod + { + /// The account's password (see SRP) + public InputCheckPasswordSRP password; + } /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(writer => + => client.CallAsync(new Auth_CheckPassword_ { - writer.Write(0xD18B4D16); - writer.WriteTLObject(password); - return "Auth_CheckPassword"; + password = password, }); + /// Request recovery code of a 2FA password, only for accounts with a recovery email configured. See + [TLDef(0xD897BC66)] + public partial class Auth_RequestPasswordRecovery_ : ITLMethod { } /// 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 => + => client.CallAsync(new Auth_RequestPasswordRecovery_ { - writer.Write(0xD897BC66); - return "Auth_RequestPasswordRecovery"; }); + /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See + [TLDef(0x37096C70)] + public partial class Auth_RecoverPassword_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Code received via email + public string code; + /// New password + [IfFlag(0)] public Account_PasswordInputSettings new_settings; + + [Flags] public enum Flags + { + /// Field has a value + has_new_settings = 0x1, + } + } /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See Possible codes: 400 (details) /// Code received via email /// New password public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) - => client.CallAsync(writer => + => client.CallAsync(new Auth_RecoverPassword_ { - writer.Write(0x37096C70); - writer.Write(new_settings != null ? 0x1 : 0); - writer.WriteTLString(code); - if (new_settings != null) - writer.WriteTLObject(new_settings); - return "Auth_RecoverPassword"; + flags = (Auth_RecoverPassword_.Flags)(new_settings != null ? 0x1 : 0), + code = code, + new_settings = new_settings, }); + /// 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 + [TLDef(0x3EF1A9BF)] + public partial class Auth_ResendCode_ : ITLMethod + { + /// The phone number + public string phone_number; + /// The phone code hash obtained from auth.sendCode + public string phone_code_hash; + } /// 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 public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ResendCode_ { - writer.Write(0x3EF1A9BF); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - return "Auth_ResendCode"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, }); + /// Cancel the login verification code See + [TLDef(0x1F040578)] + public partial class Auth_CancelCode_ : ITLMethod + { + /// Phone number + public string phone_number; + /// Phone code hash from auth.sendCode + public string phone_code_hash; + } /// Cancel the login verification code See Possible codes: 400 (details) /// Phone number /// Phone code hash from auth.sendCode public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) - => client.CallAsync(writer => + => client.CallAsync(new Auth_CancelCode_ { - writer.Write(0x1F040578); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - return "Auth_CancelCode"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, }); + /// Delete all temporary authorization keys except for the ones specified See + [TLDef(0x8E48A188)] + public partial class Auth_DropTempAuthKeys_ : ITLMethod + { + /// The auth keys that shouldn't be dropped. + public long[] except_auth_keys; + } /// Delete all temporary authorization keys except for the ones specified See [bots: ✓] /// The auth keys that shouldn't be dropped. public static Task Auth_DropTempAuthKeys(this Client client, long[] except_auth_keys) - => client.CallAsync(writer => + => client.CallAsync(new Auth_DropTempAuthKeys_ { - writer.Write(0x8E48A188); - writer.WriteTLVector(except_auth_keys); - return "Auth_DropTempAuthKeys"; + except_auth_keys = except_auth_keys, }); + /// 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
+ [TLDef(0xB7E085FE)] + public partial class Auth_ExportLoginToken_ : ITLMethod + { + /// Application identifier (see. App configuration) + public int api_id; + /// Application identifier hash (see. App configuration) + public string api_hash; + /// List of already logged-in user IDs, to prevent logging in twice with the same user + public long[] except_ids; + } /// 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 public static Task Auth_ExportLoginToken(this Client client, int api_id, string api_hash, long[] except_ids) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ExportLoginToken_ { - writer.Write(0xB7E085FE); - writer.Write(api_id); - writer.WriteTLString(api_hash); - writer.WriteTLVector(except_ids); - return "Auth_ExportLoginToken"; + api_id = api_id, + api_hash = api_hash, + except_ids = except_ids, }); + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See + [TLDef(0x95AC5CE4)] + public partial class Auth_ImportLoginToken_ : ITLMethod + { + /// Login token + public byte[] token; + } /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) /// Login token public static Task Auth_ImportLoginToken(this Client client, byte[] token) - => client.CallAsync(writer => + => client.CallAsync(new Auth_ImportLoginToken_ { - writer.Write(0x95AC5CE4); - writer.WriteTLBytes(token); - return "Auth_ImportLoginToken"; + token = token, }); + /// Accept QR code login token, logging in the app that generated it. See + [TLDef(0xE894AD4D)] + public partial class Auth_AcceptLoginToken_ : ITLMethod + { + /// Login token embedded in QR code, for more info, see login via QR code. + public byte[] token; + } /// 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. public static Task Auth_AcceptLoginToken(this Client client, byte[] token) - => client.CallAsync(writer => + => client.CallAsync(new Auth_AcceptLoginToken_ { - writer.Write(0xE894AD4D); - writer.WriteTLBytes(token); - return "Auth_AcceptLoginToken"; + token = token, }); + /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See + [TLDef(0x0D36BF79)] + public partial class Auth_CheckRecoveryPassword_ : ITLMethod + { + /// Code received via email + public string code; + } /// 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 public static Task Auth_CheckRecoveryPassword(this Client client, string code) - => client.CallAsync(writer => + => client.CallAsync(new Auth_CheckRecoveryPassword_ { - writer.Write(0x0D36BF79); - writer.WriteTLString(code); - return "Auth_CheckRecoveryPassword"; + code = code, }); + /// Register device to receive PUSH notifications See + [TLDef(0xEC86017A)] + public partial class Account_RegisterDevice_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// 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
+ public int token_type; + /// Device token + public string token; + /// If is transmitted, a sandbox-certificate will be used during transmission. + public bool app_sandbox; + /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications + public byte[] secret; + /// List of user identifiers of other users currently using the client + public long[] other_uids; + + [Flags] public enum Flags + { + /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. + no_muted = 0x1, + } + } /// 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 @@ -12570,385 +12794,585 @@ namespace TL /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications /// List of user identifiers of other users currently using the client 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 => + => client.CallAsync(new Account_RegisterDevice_ { - writer.Write(0xEC86017A); - writer.Write(no_muted ? 0x1 : 0); - writer.Write(token_type); - writer.WriteTLString(token); - writer.Write(app_sandbox ? 0x997275B5 : 0xBC799737); - writer.WriteTLBytes(secret); - writer.WriteTLVector(other_uids); - return "Account_RegisterDevice"; + flags = (Account_RegisterDevice_.Flags)(no_muted ? 0x1 : 0), + token_type = token_type, + token = token, + app_sandbox = app_sandbox, + secret = secret, + other_uids = other_uids, }); + /// Deletes a device by its token, stops sending PUSH-notifications to it. See + [TLDef(0x6A0D3206)] + public partial class Account_UnregisterDevice_ : ITLMethod + { + /// 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
+ public int token_type; + /// Device token + public string token; + /// List of user identifiers of other users currently using the client + public long[] other_uids; + } /// 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 public static Task Account_UnregisterDevice(this Client client, int token_type, string token, long[] other_uids) - => client.CallAsync(writer => + => client.CallAsync(new Account_UnregisterDevice_ { - writer.Write(0x6A0D3206); - writer.Write(token_type); - writer.WriteTLString(token); - writer.WriteTLVector(other_uids); - return "Account_UnregisterDevice"; + token_type = token_type, + token = token, + other_uids = other_uids, }); + /// Edits notification settings from a given user/group, from all users/all groups. See + [TLDef(0x84BE5B93)] + public partial class Account_UpdateNotifySettings_ : ITLMethod + { + /// Notification source + public InputNotifyPeerBase peer; + /// Notification settings + public InputPeerNotifySettings settings; + } /// Edits notification settings from a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source /// Notification settings public static Task Account_UpdateNotifySettings(this Client client, InputNotifyPeerBase peer, InputPeerNotifySettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateNotifySettings_ { - writer.Write(0x84BE5B93); - writer.WriteTLObject(peer); - writer.WriteTLObject(settings); - return "Account_UpdateNotifySettings"; + peer = peer, + settings = settings, }); + /// Gets current notification settings for a given user/group, from all users/all groups. See + [TLDef(0x12B3AD31)] + public partial class Account_GetNotifySettings_ : ITLMethod + { + /// Notification source + public InputNotifyPeerBase peer; + } /// Gets current notification settings for a given user/group, from all users/all groups. See Possible codes: 400 (details) /// Notification source public static Task Account_GetNotifySettings(this Client client, InputNotifyPeerBase peer) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetNotifySettings_ { - writer.Write(0x12B3AD31); - writer.WriteTLObject(peer); - return "Account_GetNotifySettings"; + peer = peer, }); + /// Resets all notification settings from users and groups. See + [TLDef(0xDB7E1747)] + public partial class Account_ResetNotifySettings_ : ITLMethod { } /// Resets all notification settings from users and groups. See public static Task Account_ResetNotifySettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetNotifySettings_ { - writer.Write(0xDB7E1747); - return "Account_ResetNotifySettings"; }); + /// Updates user profile. See + [TLDef(0x78515775)] + public partial class Account_UpdateProfile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// New user first name + [IfFlag(0)] public string first_name; + /// New user last name + [IfFlag(1)] public string last_name; + /// New bio + [IfFlag(2)] public string about; + + [Flags] public enum Flags + { + /// Field has a value + has_first_name = 0x1, + /// Field has a value + has_last_name = 0x2, + /// Field has a value + has_about = 0x4, + } + } /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio public static Task Account_UpdateProfile(this Client client, string first_name = null, string last_name = null, string about = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateProfile_ { - writer.Write(0x78515775); - writer.Write((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)); - if (first_name != null) - writer.WriteTLString(first_name); - if (last_name != null) - writer.WriteTLString(last_name); - if (about != null) - writer.WriteTLString(about); - return "Account_UpdateProfile"; + flags = (Account_UpdateProfile_.Flags)((first_name != null ? 0x1 : 0) | (last_name != null ? 0x2 : 0) | (about != null ? 0x4 : 0)), + first_name = first_name, + last_name = last_name, + about = about, }); + /// Updates online user status. See + [TLDef(0x6628562C)] + public partial class Account_UpdateStatus_ : ITLMethod + { + /// If is transmitted, user status will change to . + public bool offline; + } /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateStatus_ { - writer.Write(0x6628562C); - writer.Write(offline ? 0x997275B5 : 0xBC799737); - return "Account_UpdateStatus"; + offline = offline, }); + /// Returns a list of available wallpapers. See + [TLDef(0x07967D36)] + public partial class Account_GetWallPapers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Returns a list of available wallpapers. See /// Hash for pagination, for more info click here /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWallPapers_ { - writer.Write(0x07967D36); - writer.Write(hash); - return "Account_GetWallPapers"; + hash = hash, }); + /// Report a peer for violation of telegram's Terms of Service See + [TLDef(0xC5BA3D86)] + public partial class Account_ReportPeer_ : ITLMethod + { + /// The peer to report + public InputPeer peer; + /// The reason why this peer is being reported + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// 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 public static Task Account_ReportPeer(this Client client, InputPeer peer, ReportReason reason, string message) - => client.CallAsync(writer => + => client.CallAsync(new Account_ReportPeer_ { - writer.Write(0xC5BA3D86); - writer.WriteTLObject(peer); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Account_ReportPeer"; + peer = peer, + reason = reason, + message = message, }); + /// Validates a username and checks availability. See + [TLDef(0x2714D86C)] + public partial class Account_CheckUsername_ : ITLMethod + { + /// username
Accepted characters: A-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ public string username; + } ///
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. public static Task Account_CheckUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Account_CheckUsername_ { - writer.Write(0x2714D86C); - writer.WriteTLString(username); - return "Account_CheckUsername"; + username = username, }); + /// Changes username for the current user. See + [TLDef(0x3E0BDD7C)] + public partial class Account_UpdateUsername_ : ITLMethod + { + /// username or empty string if username is to be removed
Accepted characters: a-z (case-insensitive), 0-9 and underscores.
Length: 5-32 characters.
+ public string username; + } ///
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. public static Task Account_UpdateUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateUsername_ { - writer.Write(0x3E0BDD7C); - writer.WriteTLString(username); - return "Account_UpdateUsername"; + username = username, }); + /// Get privacy settings of current account See + [TLDef(0xDADBC950)] + public partial class Account_GetPrivacy_ : ITLMethod + { + /// Peer category whose privacy settings should be fetched + public InputPrivacyKey key; + } /// Get privacy settings of current account See Possible codes: 400 (details) /// Peer category whose privacy settings should be fetched public static Task Account_GetPrivacy(this Client client, InputPrivacyKey key) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPrivacy_ { - writer.Write(0xDADBC950); - writer.Write((uint)key); - return "Account_GetPrivacy"; + key = key, }); + /// Change privacy settings of current account See + [TLDef(0xC9F81CE8)] + public partial class Account_SetPrivacy_ : ITLMethod + { + /// Peers to which the privacy rules apply + public InputPrivacyKey key; + /// New privacy rules + public InputPrivacyRule[] rules; + } /// Change privacy settings of current account See Possible codes: 400 (details) /// Peers to which the privacy rules apply /// New privacy rules public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, InputPrivacyRule[] rules) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetPrivacy_ { - writer.Write(0xC9F81CE8); - writer.Write((uint)key); - writer.WriteTLVector(rules); - return "Account_SetPrivacy"; + key = key, + rules = rules, }); + /// 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 + [TLDef(0x418D4E0B)] + public partial class Account_DeleteAccount_ : ITLMethod + { + /// Why is the account being deleted, can be empty + public string reason; + } /// 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 public static Task Account_DeleteAccount(this Client client, string reason) - => client.CallAsync(writer => + => client.CallAsync(new Account_DeleteAccount_ { - writer.Write(0x418D4E0B); - writer.WriteTLString(reason); - return "Account_DeleteAccount"; + reason = reason, }); + /// Get days to live of account See + [TLDef(0x08FC711D)] + public partial class Account_GetAccountTTL_ : ITLMethod { } /// Get days to live of account See public static Task Account_GetAccountTTL(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAccountTTL_ { - writer.Write(0x08FC711D); - return "Account_GetAccountTTL"; }); + /// Set account self-destruction period See + [TLDef(0x2442485E)] + public partial class Account_SetAccountTTL_ : ITLMethod + { + /// Time to live in days + public AccountDaysTTL ttl; + } /// Set account self-destruction period See Possible codes: 400 (details) /// Time to live in days public static Task Account_SetAccountTTL(this Client client, AccountDaysTTL ttl) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetAccountTTL_ { - writer.Write(0x2442485E); - writer.WriteTLObject(ttl); - return "Account_SetAccountTTL"; + ttl = ttl, }); + /// Verify a new phone number to associate to the current account See + [TLDef(0x82574AE5)] + public partial class Account_SendChangePhoneCode_ : ITLMethod + { + /// New phone number + public string phone_number; + /// Phone code settings + public CodeSettings settings; + } /// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details) /// New phone number /// Phone code settings public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendChangePhoneCode_ { - writer.Write(0x82574AE5); - writer.WriteTLString(phone_number); - writer.WriteTLObject(settings); - return "Account_SendChangePhoneCode"; + phone_number = phone_number, + settings = settings, }); + /// Change the phone number of the current account See + [TLDef(0x70C32EDB)] + public partial class Account_ChangePhone_ : ITLMethod + { + /// New phone number + public string phone_number; + /// Phone code hash received when calling account.sendChangePhoneCode + public string phone_code_hash; + /// Phone code received when calling account.sendChangePhoneCode + public string phone_code; + } /// 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 public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Account_ChangePhone_ { - writer.Write(0x70C32EDB); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_ChangePhone"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See + [TLDef(0x38DF3532)] + public partial class Account_UpdateDeviceLocked_ : ITLMethod + { + /// Inactivity period after which to start hiding message texts in PUSH notifications. + public int period; + } /// When client-side passcode lock feature is enabled, will not show message texts in incoming PUSH notifications. See /// Inactivity period after which to start hiding message texts in PUSH notifications. public static Task Account_UpdateDeviceLocked(this Client client, int period) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdateDeviceLocked_ { - writer.Write(0x38DF3532); - writer.Write(period); - return "Account_UpdateDeviceLocked"; + period = period, }); + /// Get logged-in sessions See + [TLDef(0xE320C158)] + public partial class Account_GetAuthorizations_ : ITLMethod { } /// Get logged-in sessions See public static Task Account_GetAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAuthorizations_ { - writer.Write(0xE320C158); - return "Account_GetAuthorizations"; }); + /// Log out an active authorized session by its hash See + [TLDef(0xDF77F3BC)] + public partial class Account_ResetAuthorization_ : ITLMethod + { + /// Session hash + public long hash; + } /// Log out an active authorized session by its hash See Possible codes: 400,406 (details) /// Session hash public static Task Account_ResetAuthorization(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetAuthorization_ { - writer.Write(0xDF77F3BC); - writer.Write(hash); - return "Account_ResetAuthorization"; + hash = hash, }); + /// Obtain configuration for two-factor authorization with password See + [TLDef(0x548A30F5)] + public partial class Account_GetPassword_ : ITLMethod { } /// Obtain configuration for two-factor authorization with password See public static Task Account_GetPassword(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPassword_ { - writer.Write(0x548A30F5); - return "Account_GetPassword"; }); + /// Get private info associated to the password info (recovery email, telegram passport info & so on) See + [TLDef(0x9CD4EAF9)] + public partial class Account_GetPasswordSettings_ : ITLMethod + { + /// The password (see SRP) + public InputCheckPasswordSRP password; + } /// Get private info associated to the password info (recovery email, telegram passport info & so on) See Possible codes: 400 (details) /// The password (see SRP) public static Task Account_GetPasswordSettings(this Client client, InputCheckPasswordSRP password) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetPasswordSettings_ { - writer.Write(0x9CD4EAF9); - writer.WriteTLObject(password); - return "Account_GetPasswordSettings"; + password = password, }); + /// Set a new 2FA password See + [TLDef(0xA59B102F)] + public partial class Account_UpdatePasswordSettings_ : ITLMethod + { + /// The old password (see SRP) + public InputCheckPasswordSRP password; + /// The new password (see SRP) + public Account_PasswordInputSettings new_settings; + } /// Set a new 2FA password See Possible codes: 400 (details) /// The old password (see SRP) /// The new password (see SRP) public static Task Account_UpdatePasswordSettings(this Client client, InputCheckPasswordSRP password, Account_PasswordInputSettings new_settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_UpdatePasswordSettings_ { - writer.Write(0xA59B102F); - writer.WriteTLObject(password); - writer.WriteTLObject(new_settings); - return "Account_UpdatePasswordSettings"; + password = password, + new_settings = new_settings, }); + /// Send confirmation code to cancel account deletion, for more info click here » See + [TLDef(0x1B3FAA88)] + public partial class Account_SendConfirmPhoneCode_ : ITLMethod + { + /// The hash from the service notification, for more info click here » + public string hash; + /// Phone code settings + public CodeSettings settings; + } /// 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 public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendConfirmPhoneCode_ { - writer.Write(0x1B3FAA88); - writer.WriteTLString(hash); - writer.WriteTLObject(settings); - return "Account_SendConfirmPhoneCode"; + hash = hash, + settings = settings, }); + /// Confirm a phone number to cancel account deletion, for more info click here » See + [TLDef(0x5F2178C3)] + public partial class Account_ConfirmPhone_ : ITLMethod + { + /// Phone code hash, for more info click here » + public string phone_code_hash; + /// SMS code, for more info click here » + public string phone_code; + } /// 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 » public static Task Account_ConfirmPhone(this Client client, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Account_ConfirmPhone_ { - writer.Write(0x5F2178C3); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_ConfirmPhone"; + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Get temporary payment password See + [TLDef(0x449E0B51)] + public partial class Account_GetTmpPassword_ : ITLMethod + { + /// SRP password parameters + public InputCheckPasswordSRP password; + /// Time during which the temporary password will be valid, in seconds; should be between 60 and 86400 + public int period; + } /// 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 public static Task Account_GetTmpPassword(this Client client, InputCheckPasswordSRP password, int period) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetTmpPassword_ { - writer.Write(0x449E0B51); - writer.WriteTLObject(password); - writer.Write(period); - return "Account_GetTmpPassword"; + password = password, + period = period, }); + /// Get web login widget authorizations See + [TLDef(0x182E6D6F)] + public partial class Account_GetWebAuthorizations_ : ITLMethod { } /// Get web login widget authorizations See public static Task Account_GetWebAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWebAuthorizations_ { - writer.Write(0x182E6D6F); - return "Account_GetWebAuthorizations"; }); + /// Log out an active web telegram login session See + [TLDef(0x2D01B9EF)] + public partial class Account_ResetWebAuthorization_ : ITLMethod + { + /// hash + public long hash; + } /// Log out an active web telegram login session See Possible codes: 400 (details) /// hash public static Task Account_ResetWebAuthorization(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWebAuthorization_ { - writer.Write(0x2D01B9EF); - writer.Write(hash); - return "Account_ResetWebAuthorization"; + hash = hash, }); + /// Reset all active web telegram login sessions See + [TLDef(0x682D2594)] + public partial class Account_ResetWebAuthorizations_ : ITLMethod { } /// Reset all active web telegram login sessions See public static Task Account_ResetWebAuthorizations(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWebAuthorizations_ { - writer.Write(0x682D2594); - return "Account_ResetWebAuthorizations"; }); + /// Get all saved Telegram Passport documents, for more info see the passport docs » See + [TLDef(0xB288BC7D)] + public partial class Account_GetAllSecureValues_ : ITLMethod { } /// Get all saved Telegram Passport documents, for more info see the passport docs » See public static Task Account_GetAllSecureValues(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAllSecureValues_ { - writer.Write(0xB288BC7D); - return "Account_GetAllSecureValues"; }); + /// Get saved Telegram Passport document, for more info see the passport docs » See + [TLDef(0x73665BC2)] + public partial class Account_GetSecureValue_ : ITLMethod + { + /// Requested value types + public SecureValueType[] types; + } /// Get saved Telegram Passport document, for more info see the passport docs » See /// Requested value types public static Task Account_GetSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetSecureValue_ { - writer.Write(0x73665BC2); - writer.WriteTLVector(types); - return "Account_GetSecureValue"; + types = types, }); + /// Securely save Telegram Passport document, for more info see the passport docs » See + [TLDef(0x899FE31D)] + public partial class Account_SaveSecureValue_ : ITLMethod + { + /// Secure value, for more info see the passport docs » + public InputSecureValue value; + /// Passport secret hash, for more info see the passport docs » + public long secure_secret_id; + } /// 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 » public static Task Account_SaveSecureValue(this Client client, InputSecureValue value, long secure_secret_id) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveSecureValue_ { - writer.Write(0x899FE31D); - writer.WriteTLObject(value); - writer.Write(secure_secret_id); - return "Account_SaveSecureValue"; + value = value, + secure_secret_id = secure_secret_id, }); + /// Delete stored Telegram Passport documents, for more info see the passport docs » See + [TLDef(0xB880BC4B)] + public partial class Account_DeleteSecureValue_ : ITLMethod + { + /// Document types to delete + public SecureValueType[] types; + } /// Delete stored Telegram Passport documents, for more info see the passport docs » See /// Document types to delete public static Task Account_DeleteSecureValue(this Client client, SecureValueType[] types) - => client.CallAsync(writer => + => client.CallAsync(new Account_DeleteSecureValue_ { - writer.Write(0xB880BC4B); - writer.WriteTLVector(types); - return "Account_DeleteSecureValue"; + types = types, }); + /// Returns a Telegram Passport authorization form for sharing data with a service See + [TLDef(0xA929597A)] + public partial class Account_GetAuthorizationForm_ : ITLMethod + { + /// User identifier of the service's bot + public long bot_id; + /// Telegram Passport element types requested by the service + public string scope; + /// Service's public key + public string public_key; + } /// 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 public static Task Account_GetAuthorizationForm(this Client client, long bot_id, string scope, string public_key) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAuthorizationForm_ { - writer.Write(0xA929597A); - writer.Write(bot_id); - writer.WriteTLString(scope); - writer.WriteTLString(public_key); - return "Account_GetAuthorizationForm"; + bot_id = bot_id, + scope = scope, + public_key = public_key, }); + /// Sends a Telegram Passport authorization form, effectively sharing data with the service See + [TLDef(0xF3ED4C73)] + public partial class Account_AcceptAuthorization_ : ITLMethod + { + /// Bot ID + public long bot_id; + /// Telegram Passport element types requested by the service + public string scope; + /// Service's public key + public string public_key; + /// Types of values sent and their hashes + public SecureValueHash[] value_hashes; + /// Encrypted values + public SecureCredentialsEncrypted credentials; + } /// Sends a Telegram Passport authorization form, effectively sharing data with the service See /// Bot ID /// Telegram Passport element types requested by the service @@ -12956,65 +13380,116 @@ namespace TL /// Types of values sent and their hashes /// Encrypted values public static Task Account_AcceptAuthorization(this Client client, long bot_id, string scope, string public_key, SecureValueHash[] value_hashes, SecureCredentialsEncrypted credentials) - => client.CallAsync(writer => + => client.CallAsync(new Account_AcceptAuthorization_ { - writer.Write(0xF3ED4C73); - writer.Write(bot_id); - writer.WriteTLString(scope); - writer.WriteTLString(public_key); - writer.WriteTLVector(value_hashes); - writer.WriteTLObject(credentials); - return "Account_AcceptAuthorization"; + bot_id = bot_id, + scope = scope, + public_key = public_key, + value_hashes = value_hashes, + credentials = credentials, }); + /// Send the verification phone code for telegram passport. See + [TLDef(0xA5A356F9)] + public partial class Account_SendVerifyPhoneCode_ : ITLMethod + { + /// The phone number to verify + public string phone_number; + /// Phone code settings + public CodeSettings settings; + } /// Send the verification phone code for telegram passport. See Possible codes: 400 (details) /// The phone number to verify /// Phone code settings public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendVerifyPhoneCode_ { - writer.Write(0xA5A356F9); - writer.WriteTLString(phone_number); - writer.WriteTLObject(settings); - return "Account_SendVerifyPhoneCode"; + phone_number = phone_number, + settings = settings, }); + /// Verify a phone number for telegram passport. See + [TLDef(0x4DD3A7F6)] + public partial class Account_VerifyPhone_ : ITLMethod + { + /// Phone number + public string phone_number; + /// Phone code hash received from the call to account.sendVerifyPhoneCode + public string phone_code_hash; + /// Code received after the call to account.sendVerifyPhoneCode + public string phone_code; + } /// 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 public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) - => client.CallAsync(writer => + => client.CallAsync(new Account_VerifyPhone_ { - writer.Write(0x4DD3A7F6); - writer.WriteTLString(phone_number); - writer.WriteTLString(phone_code_hash); - writer.WriteTLString(phone_code); - return "Account_VerifyPhone"; + phone_number = phone_number, + phone_code_hash = phone_code_hash, + phone_code = phone_code, }); + /// Send the verification email code for telegram passport. See + [TLDef(0x7011509F)] + public partial class Account_SendVerifyEmailCode_ : ITLMethod + { + /// The email where to send the code + public string email; + } /// Send the verification email code for telegram passport. See Possible codes: 400 (details) /// The email where to send the code public static Task Account_SendVerifyEmailCode(this Client client, string email) - => client.CallAsync(writer => + => client.CallAsync(new Account_SendVerifyEmailCode_ { - writer.Write(0x7011509F); - writer.WriteTLString(email); - return "Account_SendVerifyEmailCode"; + email = email, }); + /// Verify an email address for telegram passport. See + [TLDef(0xECBA39DB)] + public partial class Account_VerifyEmail_ : ITLMethod + { + /// The email to verify + public string email; + /// The verification code that was received + public string code; + } /// Verify an email address for telegram passport. See Possible codes: 400 (details) /// The email to verify /// The verification code that was received public static Task Account_VerifyEmail(this Client client, string email, string code) - => client.CallAsync(writer => + => client.CallAsync(new Account_VerifyEmail_ { - writer.Write(0xECBA39DB); - writer.WriteTLString(email); - writer.WriteTLString(code); - return "Account_VerifyEmail"; + email = email, + code = code, }); + /// Initialize account takeout session See + [TLDef(0xF05B4804)] + public partial class Account_InitTakeoutSession_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Maximum size of files to export + [IfFlag(5)] public int file_max_size; + + [Flags] public enum Flags + { + /// Whether to export contacts + contacts = 0x1, + /// Whether to export messages in private chats + message_users = 0x2, + /// Whether to export messages in legacy groups + message_chats = 0x4, + /// Whether to export messages in supergroups + message_megagroups = 0x8, + /// Whether to export messages in channels + message_channels = 0x10, + /// Whether to export files + files = 0x20, + } + } /// Initialize account takeout session See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats @@ -13024,198 +13499,348 @@ namespace TL /// Whether to export files /// Maximum size of files to export 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 => + => client.CallAsync(new Account_InitTakeoutSession_ { - writer.Write(0xF05B4804); - writer.Write((contacts ? 0x1 : 0) | (message_users ? 0x2 : 0) | (message_chats ? 0x4 : 0) | (message_megagroups ? 0x8 : 0) | (message_channels ? 0x10 : 0) | (files ? 0x20 : 0) | (file_max_size != null ? 0x20 : 0)); - if (file_max_size != null) - writer.Write(file_max_size.Value); - return "Account_InitTakeoutSession"; + flags = (Account_InitTakeoutSession_.Flags)((contacts ? 0x1 : 0) | (message_users ? 0x2 : 0) | (message_chats ? 0x4 : 0) | (message_megagroups ? 0x8 : 0) | (message_channels ? 0x10 : 0) | (files ? 0x20 : 0) | (file_max_size != null ? 0x20 : 0)), + file_max_size = file_max_size.GetValueOrDefault(), }); + /// Finish account takeout session See + [TLDef(0x1D2652EE)] + public partial class Account_FinishTakeoutSession_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Data exported successfully + success = 0x1, + } + } /// Finish account takeout session See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_FinishTakeoutSession_ { - writer.Write(0x1D2652EE); - writer.Write(success ? 0x1 : 0); - return "Account_FinishTakeoutSession"; + flags = (Account_FinishTakeoutSession_.Flags)(success ? 0x1 : 0), }); + /// Verify an email to use as 2FA recovery method. See + [TLDef(0x8FDF1920)] + public partial class Account_ConfirmPasswordEmail_ : ITLMethod + { + /// The phone code that was received after setting a recovery email + public string code; + } /// 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 public static Task Account_ConfirmPasswordEmail(this Client client, string code) - => client.CallAsync(writer => + => client.CallAsync(new Account_ConfirmPasswordEmail_ { - writer.Write(0x8FDF1920); - writer.WriteTLString(code); - return "Account_ConfirmPasswordEmail"; + code = code, }); + /// Resend the code to verify an email to use as 2FA recovery method. See + [TLDef(0x7A7F2A15)] + public partial class Account_ResendPasswordEmail_ : ITLMethod { } /// Resend the code to verify an email to use as 2FA recovery method. See public static Task Account_ResendPasswordEmail(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResendPasswordEmail_ { - writer.Write(0x7A7F2A15); - return "Account_ResendPasswordEmail"; }); + /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See + [TLDef(0xC1CBD5B6)] + public partial class Account_CancelPasswordEmail_ : ITLMethod { } /// Cancel the code that was sent to verify an email to use as 2FA recovery method. See public static Task Account_CancelPasswordEmail(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_CancelPasswordEmail_ { - writer.Write(0xC1CBD5B6); - return "Account_CancelPasswordEmail"; }); + /// Whether the user will receive notifications when contacts sign up See + [TLDef(0x9F07C728)] + public partial class Account_GetContactSignUpNotification_ : ITLMethod { } /// Whether the user will receive notifications when contacts sign up See public static Task Account_GetContactSignUpNotification(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetContactSignUpNotification_ { - writer.Write(0x9F07C728); - return "Account_GetContactSignUpNotification"; }); + /// Toggle contact sign up notifications See + [TLDef(0xCFF43F61)] + public partial class Account_SetContactSignUpNotification_ : ITLMethod + { + /// Whether to disable contact sign up notifications + public bool silent; + } /// Toggle contact sign up notifications See /// Whether to disable contact sign up notifications public static Task Account_SetContactSignUpNotification(this Client client, bool silent) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetContactSignUpNotification_ { - writer.Write(0xCFF43F61); - writer.Write(silent ? 0x997275B5 : 0xBC799737); - return "Account_SetContactSignUpNotification"; + silent = silent, }); + /// Returns list of chats with non-default notification settings See + [TLDef(0x53577479)] + public partial class Account_GetNotifyExceptions_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// If specified, only chats of the specified category will be returned + [IfFlag(0)] public InputNotifyPeerBase peer; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x1, + /// If true, chats with non-default sound will also be returned + compare_sound = 0x2, + } + } /// Returns list of chats with non-default notification settings See /// If true, chats with non-default sound will also be returned /// If specified, only chats of the specified category will be returned public static Task Account_GetNotifyExceptions(this Client client, bool compare_sound = false, InputNotifyPeerBase peer = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetNotifyExceptions_ { - writer.Write(0x53577479); - writer.Write((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - return "Account_GetNotifyExceptions"; + flags = (Account_GetNotifyExceptions_.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + peer = peer, }); + /// Get info about a certain wallpaper See + [TLDef(0xFC8DDBEA)] + public partial class Account_GetWallPaper_ : ITLMethod + { + /// The wallpaper to get info about + public InputWallPaperBase wallpaper; + } /// Get info about a certain wallpaper See Possible codes: 400 (details) /// The wallpaper to get info about public static Task Account_GetWallPaper(this Client client, InputWallPaperBase wallpaper) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetWallPaper_ { - writer.Write(0xFC8DDBEA); - writer.WriteTLObject(wallpaper); - return "Account_GetWallPaper"; + wallpaper = wallpaper, }); + /// Create and upload a new wallpaper See + [TLDef(0xDD853661)] + public partial class Account_UploadWallPaper_ : ITLMethod + { + /// The JPG/PNG wallpaper + public InputFileBase file; + /// MIME type of uploaded wallpaper + public string mime_type; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Create and upload a new wallpaper See Possible codes: 400 (details) /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_UploadWallPaper_ { - writer.Write(0xDD853661); - writer.WriteTLObject(file); - writer.WriteTLString(mime_type); - writer.WriteTLObject(settings); - return "Account_UploadWallPaper"; + file = file, + mime_type = mime_type, + settings = settings, }); + /// Install/uninstall wallpaper See + [TLDef(0x6C5A5B37)] + public partial class Account_SaveWallPaper_ : ITLMethod + { + /// Wallpaper to save + public InputWallPaperBase wallpaper; + /// Uninstall wallpaper? + public bool unsave; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Install/uninstall wallpaper See Possible codes: 400 (details) /// Wallpaper to save /// Uninstall wallpaper? /// Wallpaper settings public static Task Account_SaveWallPaper(this Client client, InputWallPaperBase wallpaper, bool unsave, WallPaperSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveWallPaper_ { - writer.Write(0x6C5A5B37); - writer.WriteTLObject(wallpaper); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - writer.WriteTLObject(settings); - return "Account_SaveWallPaper"; + wallpaper = wallpaper, + unsave = unsave, + settings = settings, }); + /// Install wallpaper See + [TLDef(0xFEED5769)] + public partial class Account_InstallWallPaper_ : ITLMethod + { + /// Wallpaper to install + public InputWallPaperBase wallpaper; + /// Wallpaper settings + public WallPaperSettings settings; + } /// Install wallpaper See Possible codes: 400 (details) /// Wallpaper to install /// Wallpaper settings public static Task Account_InstallWallPaper(this Client client, InputWallPaperBase wallpaper, WallPaperSettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_InstallWallPaper_ { - writer.Write(0xFEED5769); - writer.WriteTLObject(wallpaper); - writer.WriteTLObject(settings); - return "Account_InstallWallPaper"; + wallpaper = wallpaper, + settings = settings, }); + /// Delete installed wallpapers See + [TLDef(0xBB3B9804)] + public partial class Account_ResetWallPapers_ : ITLMethod { } /// Delete installed wallpapers See public static Task Account_ResetWallPapers(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetWallPapers_ { - writer.Write(0xBB3B9804); - return "Account_ResetWallPapers"; }); + /// Get media autodownload settings See + [TLDef(0x56DA0B3F)] + public partial class Account_GetAutoDownloadSettings_ : ITLMethod { } /// Get media autodownload settings See public static Task Account_GetAutoDownloadSettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetAutoDownloadSettings_ { - writer.Write(0x56DA0B3F); - return "Account_GetAutoDownloadSettings"; }); + /// Change media autodownload settings See + [TLDef(0x76F36233)] + public partial class Account_SaveAutoDownloadSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Media autodownload settings + public AutoDownloadSettings settings; + + [Flags] public enum Flags + { + /// Whether to save settings in the low data usage preset + low = 0x1, + /// Whether to save settings in the high data usage preset + high = 0x2, + } + } /// Change media autodownload settings See /// Whether to save settings in the low data usage preset /// Whether to save settings in the high data usage preset /// Media autodownload settings public static Task Account_SaveAutoDownloadSettings(this Client client, AutoDownloadSettings settings, bool low = false, bool high = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveAutoDownloadSettings_ { - writer.Write(0x76F36233); - writer.Write((low ? 0x1 : 0) | (high ? 0x2 : 0)); - writer.WriteTLObject(settings); - return "Account_SaveAutoDownloadSettings"; + flags = (Account_SaveAutoDownloadSettings_.Flags)((low ? 0x1 : 0) | (high ? 0x2 : 0)), + settings = settings, }); + /// Upload theme See + [TLDef(0x1C3DB333)] + public partial class Account_UploadTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme file uploaded as described in files » + public InputFileBase file; + /// Thumbnail + [IfFlag(0)] public InputFileBase thumb; + /// File name + public string file_name; + /// MIME type, must be application/x-tgtheme-{format}, where format depends on the client + public string mime_type; + + [Flags] public enum Flags + { + /// Field has a value + has_thumb = 0x1, + } + } /// 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 public static Task Account_UploadTheme(this Client client, InputFileBase file, string file_name, string mime_type, InputFileBase thumb = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_UploadTheme_ { - writer.Write(0x1C3DB333); - writer.Write(thumb != null ? 0x1 : 0); - writer.WriteTLObject(file); - if (thumb != null) - writer.WriteTLObject(thumb); - writer.WriteTLString(file_name); - writer.WriteTLString(mime_type); - return "Account_UploadTheme"; + flags = (Account_UploadTheme_.Flags)(thumb != null ? 0x1 : 0), + file = file, + thumb = thumb, + file_name = file_name, + mime_type = mime_type, }); + /// Create a theme See + [TLDef(0x652E4400)] + public partial class Account_CreateTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique theme ID + public string slug; + /// Theme name + public string title; + /// Theme file + [IfFlag(2)] public InputDocument document; + /// Theme settings + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Create a theme See Possible codes: 400 (details) /// Unique theme ID /// Theme name /// Theme file /// Theme settings public static Task Account_CreateTheme(this Client client, string slug, string title, InputDocument document = null, InputThemeSettings[] settings = null) - => client.CallAsync(writer => + => client.CallAsync(new Account_CreateTheme_ { - writer.Write(0x652E4400); - writer.Write((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); - writer.WriteTLString(slug); - writer.WriteTLString(title); - if (document != null) - writer.WriteTLObject(document); - if (settings != null) - writer.WriteTLVector(settings); - return "Account_CreateTheme"; + flags = (Account_CreateTheme_.Flags)((document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + slug = slug, + title = title, + document = document, + settings = settings, }); + /// Update theme See + [TLDef(0x2BF40CCC)] + public partial class Account_UpdateTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Theme to update + public InputThemeBase theme; + /// Unique theme ID + [IfFlag(0)] public string slug; + /// Theme name + [IfFlag(1)] public string title; + /// Theme file + [IfFlag(2)] public InputDocument document; + /// Theme settings + [IfFlag(3)] public InputThemeSettings[] settings; + + [Flags] public enum Flags + { + /// Field has a value + has_slug = 0x1, + /// Field has a value + has_title = 0x2, + /// Field has a value + has_document = 0x4, + /// Field has a value + has_settings = 0x8, + } + } /// Update theme See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme to update @@ -13224,314 +13849,496 @@ namespace TL /// Theme file /// Theme settings 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 => + => client.CallAsync(new Account_UpdateTheme_ { - writer.Write(0x2BF40CCC); - writer.Write((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)); - writer.WriteTLString(format); - writer.WriteTLObject(theme); - if (slug != null) - writer.WriteTLString(slug); - if (title != null) - writer.WriteTLString(title); - if (document != null) - writer.WriteTLObject(document); - if (settings != null) - writer.WriteTLVector(settings); - return "Account_UpdateTheme"; + flags = (Account_UpdateTheme_.Flags)((slug != null ? 0x1 : 0) | (title != null ? 0x2 : 0) | (document != null ? 0x4 : 0) | (settings != null ? 0x8 : 0)), + format = format, + theme = theme, + slug = slug, + title = title, + document = document, + settings = settings, }); + /// Save a theme See + [TLDef(0xF257106C)] + public partial class Account_SaveTheme_ : ITLMethod + { + /// Theme to save + public InputThemeBase theme; + /// Unsave + public bool unsave; + } /// Save a theme See /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) - => client.CallAsync(writer => + => client.CallAsync(new Account_SaveTheme_ { - writer.Write(0xF257106C); - writer.WriteTLObject(theme); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Account_SaveTheme"; + theme = theme, + unsave = unsave, }); + /// Install a theme See + [TLDef(0xC727BB3B)] + public partial class Account_InstallTheme_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Theme to install + [IfFlag(1)] public InputThemeBase theme; + /// Theme format, a string that identifies the theming engines supported by the client + [IfFlag(2)] public string format; + [IfFlag(3)] public BaseTheme base_theme; + + [Flags] public enum Flags + { + /// Whether to install the dark version + dark = 0x1, + /// Field has a value + has_theme = 0x2, + /// Field has a value + has_format = 0x4, + /// Field has a value + has_base_theme = 0x8, + } + } /// Install a theme See /// Whether to install the dark version /// Theme format, a string that identifies the theming engines supported by the client /// Theme to install public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) - => client.CallAsync(writer => + => client.CallAsync(new Account_InstallTheme_ { - writer.Write(0xC727BB3B); - writer.Write((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)); - if (theme != null) - writer.WriteTLObject(theme); - if (format != null) - writer.WriteTLString(format); - if (base_theme != default) - writer.Write((uint)base_theme); - return "Account_InstallTheme"; + flags = (Account_InstallTheme_.Flags)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), + theme = theme, + format = format, + base_theme = base_theme, }); + /// Get theme information See + [TLDef(0x8D9D742B)] + public partial class Account_GetTheme_ : ITLMethod + { + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Theme + public InputThemeBase theme; + /// Document ID + public long document_id; + } /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme /// Document ID public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetTheme_ { - writer.Write(0x8D9D742B); - writer.WriteTLString(format); - writer.WriteTLObject(theme); - writer.Write(document_id); - return "Account_GetTheme"; + format = format, + theme = theme, + document_id = document_id, }); + /// Get installed themes See + [TLDef(0x7206E458)] + public partial class Account_GetThemes_ : ITLMethod + { + /// Theme format, a string that identifies the theming engines supported by the client + public string format; + /// Hash for pagination, for more info click here + public long hash; + } /// Get installed themes See /// Theme format, a string that identifies the theming engines supported by the client /// Hash for pagination, for more info click here /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetThemes_ { - writer.Write(0x7206E458); - writer.WriteTLString(format); - writer.Write(hash); - return "Account_GetThemes"; + format = format, + hash = hash, }); + /// Set sensitive content settings (for viewing or hiding NSFW content) See + [TLDef(0xB574B16B)] + public partial class Account_SetContentSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Enable NSFW content + sensitive_enabled = 0x1, + } + } /// Set sensitive content settings (for viewing or hiding NSFW content) See Possible codes: 403 (details) /// Enable NSFW content public static Task Account_SetContentSettings(this Client client, bool sensitive_enabled = false) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetContentSettings_ { - writer.Write(0xB574B16B); - writer.Write(sensitive_enabled ? 0x1 : 0); - return "Account_SetContentSettings"; + flags = (Account_SetContentSettings_.Flags)(sensitive_enabled ? 0x1 : 0), }); + /// Get sensitive content settings See + [TLDef(0x8B9B4DAE)] + public partial class Account_GetContentSettings_ : ITLMethod { } /// Get sensitive content settings See public static Task Account_GetContentSettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetContentSettings_ { - writer.Write(0x8B9B4DAE); - return "Account_GetContentSettings"; }); + /// Get info about multiple wallpapers See + [TLDef(0x65AD71DC)] + public partial class Account_GetMultiWallPapers_ : ITLMethod + { + /// Wallpapers to fetch info about + public InputWallPaperBase[] wallpapers; + } /// Get info about multiple wallpapers See /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, InputWallPaperBase[] wallpapers) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetMultiWallPapers_ { - writer.Write(0x65AD71DC); - writer.WriteTLVector(wallpapers); - return "Account_GetMultiWallPapers"; + wallpapers = wallpapers, }); + /// Get global privacy settings See + [TLDef(0xEB2B4CF6)] + public partial class Account_GetGlobalPrivacySettings_ : ITLMethod { } /// Get global privacy settings See public static Task Account_GetGlobalPrivacySettings(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetGlobalPrivacySettings_ { - writer.Write(0xEB2B4CF6); - return "Account_GetGlobalPrivacySettings"; }); + /// Set global privacy settings See + [TLDef(0x1EDAAAC2)] + public partial class Account_SetGlobalPrivacySettings_ : ITLMethod + { + /// Global privacy settings + public GlobalPrivacySettings settings; + } /// Set global privacy settings See Possible codes: 400 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) - => client.CallAsync(writer => + => client.CallAsync(new Account_SetGlobalPrivacySettings_ { - writer.Write(0x1EDAAAC2); - writer.WriteTLObject(settings); - return "Account_SetGlobalPrivacySettings"; + settings = settings, }); + /// Report a profile photo of a dialog See + [TLDef(0xFA8CC6F5)] + public partial class Account_ReportProfilePhoto_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// Dialog photo ID + public InputPhoto photo_id; + /// Report reason + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// Report a profile photo of a dialog See /// The dialog /// Dialog photo ID /// Report reason /// Comment for report moderation public static Task Account_ReportProfilePhoto(this Client client, InputPeer peer, InputPhoto photo_id, ReportReason reason, string message) - => client.CallAsync(writer => + => client.CallAsync(new Account_ReportProfilePhoto_ { - writer.Write(0xFA8CC6F5); - writer.WriteTLObject(peer); - writer.WriteTLObject(photo_id); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Account_ReportProfilePhoto"; + peer = peer, + photo_id = photo_id, + reason = reason, + message = message, }); + /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See + [TLDef(0x9308CE1B)] + public partial class Account_ResetPassword_ : ITLMethod { } /// Initiate a 2FA password reset: can only be used if the user is already logged-in, see here for more info » See public static Task Account_ResetPassword(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Account_ResetPassword_ { - writer.Write(0x9308CE1B); - return "Account_ResetPassword"; }); + /// Abort a pending 2FA password reset, see here for more info » See + [TLDef(0x4C9409F6)] + public partial class Account_DeclinePasswordReset_ : ITLMethod { } /// 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 => + => client.CallAsync(new Account_DeclinePasswordReset_ { - writer.Write(0x4C9409F6); - return "Account_DeclinePasswordReset"; }); + /// Get all available chat themes See + [TLDef(0xD638DE89)] + public partial class Account_GetChatThemes_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get all available chat themes See /// Hash for pagination, for more info click here /// a null value means account.themesNotModified public static Task Account_GetChatThemes(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Account_GetChatThemes_ { - writer.Write(0xD638DE89); - writer.Write(hash); - return "Account_GetChatThemes"; + hash = hash, }); + /// Returns basic user info according to their identifiers. See + [TLDef(0x0D91A548)] + public partial class Users_GetUsers_ : ITLMethod + { + /// List of user identifiers + public InputUserBase[] id; + } /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,401 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, InputUserBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Users_GetUsers_ { - writer.Write(0x0D91A548); - writer.WriteTLVector(id); - return "Users_GetUsers"; + id = id, }); + /// Returns extended user info by ID. See + [TLDef(0xCA30A5B1)] + public partial class Users_GetFullUser_ : ITLMethod + { + /// User ID + public InputUserBase id; + } /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) - => client.CallAsync(writer => + => client.CallAsync(new Users_GetFullUser_ { - writer.Write(0xCA30A5B1); - writer.WriteTLObject(id); - return "Users_GetFullUser"; + id = id, }); + /// 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 + [TLDef(0x90C894B5)] + public partial class Users_SetSecureValueErrors_ : ITLMethod + { + /// The user + public InputUserBase id; + /// Errors + public SecureValueErrorBase[] errors; + } /// 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 [bots: ✓] Possible codes: 400 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, SecureValueErrorBase[] errors) - => client.CallAsync(writer => + => client.CallAsync(new Users_SetSecureValueErrors_ { - writer.Write(0x90C894B5); - writer.WriteTLObject(id); - writer.WriteTLVector(errors); - return "Users_SetSecureValueErrors"; + id = id, + errors = errors, }); + /// Get contact by telegram IDs See + [TLDef(0x7ADC669D)] + public partial class Contacts_GetContactIDs_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetContactIDs_ { - writer.Write(0x7ADC669D); - writer.Write(hash); - return "Contacts_GetContactIDs"; + hash = hash, }); + /// Returns the list of contact statuses. See + [TLDef(0xC4A353EE)] + public partial class Contacts_GetStatuses_ : ITLMethod { } /// Returns the list of contact statuses. See public static Task Contacts_GetStatuses(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetStatuses_ { - writer.Write(0xC4A353EE); - return "Contacts_GetStatuses"; }); + /// Returns the current user's contact list. See + [TLDef(0x5DD69E12)] + public partial class Contacts_GetContacts_ : ITLMethod + { + /// If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, will be returned. + public long hash; + } /// Returns the current user's contact list. See /// If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, will be returned. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetContacts_ { - writer.Write(0x5DD69E12); - writer.Write(hash); - return "Contacts_GetContacts"; + hash = hash, }); + /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See + [TLDef(0x2C800BE5)] + public partial class Contacts_ImportContacts_ : ITLMethod + { + /// List of contacts to import + public InputContact[] contacts; + } /// Imports contacts: saves a full list on the server, adds already registered contacts to the contact list, returns added contacts and their info. See /// List of contacts to import public static Task Contacts_ImportContacts(this Client client, InputContact[] contacts) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ImportContacts_ { - writer.Write(0x2C800BE5); - writer.WriteTLVector(contacts); - return "Contacts_ImportContacts"; + contacts = contacts, }); + /// Deletes several contacts from the list. See + [TLDef(0x096A0E00)] + public partial class Contacts_DeleteContacts_ : ITLMethod + { + /// User ID list + public InputUserBase[] id; + } /// Deletes several contacts from the list. See /// User ID list public static Task Contacts_DeleteContacts(this Client client, InputUserBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_DeleteContacts_ { - writer.Write(0x096A0E00); - writer.WriteTLVector(id); - return "Contacts_DeleteContacts"; + id = id, }); + /// Delete contacts by phone number See + [TLDef(0x1013FD9E)] + public partial class Contacts_DeleteByPhones_ : ITLMethod + { + /// Phone numbers + public string[] phones; + } /// Delete contacts by phone number See /// Phone numbers public static Task Contacts_DeleteByPhones(this Client client, string[] phones) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_DeleteByPhones_ { - writer.Write(0x1013FD9E); - writer.WriteTLVector(phones); - return "Contacts_DeleteByPhones"; + phones = phones, }); + /// Adds the user to the blacklist. See + [TLDef(0x68CC1411)] + public partial class Contacts_Block_ : ITLMethod + { + /// User ID + public InputPeer id; + } /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Block(this Client client, InputPeer id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Block_ { - writer.Write(0x68CC1411); - writer.WriteTLObject(id); - return "Contacts_Block"; + id = id, }); + /// Deletes the user from the blacklist. See + [TLDef(0xBEA65D50)] + public partial class Contacts_Unblock_ : ITLMethod + { + /// User ID + public InputPeer id; + } /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID public static Task Contacts_Unblock(this Client client, InputPeer id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Unblock_ { - writer.Write(0xBEA65D50); - writer.WriteTLObject(id); - return "Contacts_Unblock"; + id = id, }); + /// Returns the list of blocked users. See + [TLDef(0xF57C350F)] + public partial class Contacts_GetBlocked_ : ITLMethod + { + /// The number of list elements to be skipped + public int offset; + /// The number of list elements to be returned + public int limit; + } /// Returns the list of blocked users. See /// The number of list elements to be skipped /// The number of list elements to be returned public static Task Contacts_GetBlocked(this Client client, int offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetBlocked_ { - writer.Write(0xF57C350F); - writer.Write(offset); - writer.Write(limit); - return "Contacts_GetBlocked"; + offset = offset, + limit = limit, }); + /// Returns users found by username substring. See + [TLDef(0x11F812D8)] + public partial class Contacts_Search_ : ITLMethod + { + /// Target substring + public string q; + /// Maximum number of users to be returned + public int limit; + } /// Returns users found by username substring. See Possible codes: 400 (details) /// Target substring /// Maximum number of users to be returned public static Task Contacts_Search(this Client client, string q, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_Search_ { - writer.Write(0x11F812D8); - writer.WriteTLString(q); - writer.Write(limit); - return "Contacts_Search"; + q = q, + limit = limit, }); + /// Resolve a @username to get peer info See + [TLDef(0xF93CCBA3)] + public partial class Contacts_ResolveUsername_ : ITLMethod + { + /// @username to resolve + public string username; + } /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400,401 (details) /// @username to resolve public static Task Contacts_ResolveUsername(this Client client, string username) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResolveUsername_ { - writer.Write(0xF93CCBA3); - writer.WriteTLString(username); - return "Contacts_ResolveUsername"; + username = username, }); + /// Get most used peers See + [TLDef(0x973478B6)] + public partial class Contacts_GetTopPeers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Offset for pagination + public int offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Users we've chatted most frequently with + correspondents = 0x1, + /// Most used bots + bots_pm = 0x2, + /// Most used inline bots + bots_inline = 0x4, + /// Most frequently called users + phone_calls = 0x8, + /// Users to which the users often forwards messages to + forward_users = 0x10, + /// Chats to which the users often forwards messages to + forward_chats = 0x20, + /// Often-opened groups and supergroups + groups = 0x400, + /// Most frequently visited channels + channels = 0x8000, + } + } /// Get most used peers See Possible codes: 400 (details) /// Users we've chatted most frequently with /// Most used bots @@ -13546,54 +14353,87 @@ namespace TL /// Hash for pagination, for more info click here /// a null value means contacts.topPeersNotModified 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 => + => client.CallAsync(new Contacts_GetTopPeers_ { - writer.Write(0x973478B6); - writer.Write((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0)); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "Contacts_GetTopPeers"; + flags = (Contacts_GetTopPeers_.Flags)((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0)), + offset = offset, + limit = limit, + hash = hash, }); + /// Reset rating of top peer See + [TLDef(0x1AE373AC)] + public partial class Contacts_ResetTopPeerRating_ : ITLMethod + { + /// Top peer category + public TopPeerCategory category; + /// Peer whose rating should be reset + public InputPeer peer; + } /// Reset rating of top peer See Possible codes: 400 (details) /// Top peer category /// Peer whose rating should be reset public static Task Contacts_ResetTopPeerRating(this Client client, TopPeerCategory category, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResetTopPeerRating_ { - writer.Write(0x1AE373AC); - writer.Write((uint)category); - writer.WriteTLObject(peer); - return "Contacts_ResetTopPeerRating"; + category = category, + peer = peer, }); + /// Delete saved contacts See + [TLDef(0x879537F1)] + public partial class Contacts_ResetSaved_ : ITLMethod { } /// Delete saved contacts See public static Task Contacts_ResetSaved(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ResetSaved_ { - writer.Write(0x879537F1); - return "Contacts_ResetSaved"; }); + /// Get all contacts See + [TLDef(0x82F1E39F)] + public partial class Contacts_GetSaved_ : ITLMethod { } /// Get all contacts See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetSaved_ { - writer.Write(0x82F1E39F); - return "Contacts_GetSaved"; }); + /// Enable/disable top peers See + [TLDef(0x8514BDDA)] + public partial class Contacts_ToggleTopPeers_ : ITLMethod + { + /// Enable/disable + public bool enabled; + } /// Enable/disable top peers See /// Enable/disable public static Task Contacts_ToggleTopPeers(this Client client, bool enabled) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_ToggleTopPeers_ { - writer.Write(0x8514BDDA); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Contacts_ToggleTopPeers"; + enabled = enabled, }); + /// Add an existing telegram user as contact. See + [TLDef(0xE8F463D0)] + public partial class Contacts_AddContact_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Telegram ID of the other user + public InputUserBase id; + /// First name + public string first_name; + /// Last name + public string last_name; + /// User's phone number + public string phone; + + [Flags] public enum Flags + { + /// Allow the other user to see our phone number? + add_phone_privacy_exception = 0x1, + } + } /// 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 @@ -13601,66 +14441,134 @@ namespace TL /// Last name /// User's phone number 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 => + => client.CallAsync(new Contacts_AddContact_ { - writer.Write(0xE8F463D0); - writer.Write(add_phone_privacy_exception ? 0x1 : 0); - writer.WriteTLObject(id); - writer.WriteTLString(first_name); - writer.WriteTLString(last_name); - writer.WriteTLString(phone); - return "Contacts_AddContact"; + flags = (Contacts_AddContact_.Flags)(add_phone_privacy_exception ? 0x1 : 0), + id = id, + first_name = first_name, + last_name = last_name, + phone = phone, }); + /// If the of a new user allow us to add him as contact, add that user as contact See + [TLDef(0xF831A20F)] + public partial class Contacts_AcceptContact_ : ITLMethod + { + /// The user to add as contact + public InputUserBase id; + } /// 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 public static Task Contacts_AcceptContact(this Client client, InputUserBase id) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_AcceptContact_ { - writer.Write(0xF831A20F); - writer.WriteTLObject(id); - return "Contacts_AcceptContact"; + id = id, }); + /// Get contacts near you See + [TLDef(0xD348BC44)] + public partial class Contacts_GetLocated_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Geolocation + public InputGeoPoint geo_point; + /// 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. + [IfFlag(0)] public int self_expires; + + [Flags] public enum Flags + { + /// Field has a value + has_self_expires = 0x1, + /// 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.
+ background = 0x2, + } + } /// 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. public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_GetLocated_ { - writer.Write(0xD348BC44); - writer.Write((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)); - writer.WriteTLObject(geo_point); - if (self_expires != null) - writer.Write(self_expires.Value); - return "Contacts_GetLocated"; + flags = (Contacts_GetLocated_.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + geo_point = geo_point, + self_expires = self_expires.GetValueOrDefault(), }); + /// Stop getting notifications about thread replies of a certain user in @replies See + [TLDef(0x29A8962C)] + public partial class Contacts_BlockFromReplies_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// ID of the message in the @replies chat + public int msg_id; + + [Flags] public enum Flags + { + /// Whether to delete the specified message as well + delete_message = 0x1, + /// Whether to delete all @replies messages from this user as well + delete_history = 0x2, + /// Whether to also report this user for spam + report_spam = 0x4, + } + } /// Stop getting notifications about thread replies of a certain user in @replies See /// Whether to delete the specified message as well /// Whether to delete all @replies messages from this user as well /// Whether to also report this user for spam /// ID of the message in the @replies chat public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) - => client.CallAsync(writer => + => client.CallAsync(new Contacts_BlockFromReplies_ { - writer.Write(0x29A8962C); - writer.Write((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)); - writer.Write(msg_id); - return "Contacts_BlockFromReplies"; + flags = (Contacts_BlockFromReplies_.Flags)((delete_message ? 0x1 : 0) | (delete_history ? 0x2 : 0) | (report_spam ? 0x4 : 0)), + msg_id = msg_id, }); + /// Returns the list of messages by their IDs. See + [TLDef(0x63C66506)] + public partial class Messages_GetMessages_ : ITLMethod + { + /// Message ID list + public InputMessage[] id; + } /// Returns the list of messages by their IDs. See [bots: ✓] /// Message ID list public static Task Messages_GetMessages(this Client client, InputMessage[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessages_ { - writer.Write(0x63C66506); - writer.WriteTLVector(id); - return "Messages_GetMessages"; + id = id, }); + /// Returns the current user dialog list. See + [TLDef(0xA0F4CB4F)] + public partial class Messages_GetDialogs_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + [IfFlag(1)] public int folder_id; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offset peer for pagination + public InputPeer offset_peer; + /// Number of list elements to be returned + public int limit; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Exclude pinned dialogs + exclude_pinned = 0x1, + /// Field has a value + has_folder_id = 0x2, + } + } /// Returns the current user dialog list. See Possible codes: 400 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here @@ -13670,20 +14578,38 @@ namespace TL /// Number of list elements to be returned /// Hash for pagination, for more info click here 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 => + => client.CallAsync(new Messages_GetDialogs_ { - writer.Write(0xA0F4CB4F); - writer.Write((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)); - if (folder_id != null) - writer.Write(folder_id.Value); - writer.WriteTLStamp(offset_date); - writer.Write(offset_id); - writer.WriteTLObject(offset_peer); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetDialogs"; + flags = (Messages_GetDialogs_.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + folder_id = folder_id.GetValueOrDefault(), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, }); + /// Gets back the conversation history with one interlocutor / within a chat See + [TLDef(0x4423E6C5)] + public partial class Messages_GetHistory_ : ITLMethod + { + /// Target peer + public InputPeer peer; + /// Only return messages starting from the specified message ID + public int offset_id; + /// Only return messages sent before the specified date + public DateTime offset_date; + /// Number of list elements to be skipped, negative values are also accepted. + public int add_offset; + /// Number of results to return + public int limit; + /// If a positive value was transferred, the method will return only messages with IDs less than max_id + public int max_id; + /// If a positive value was transferred, the method will return only messages with IDs more than min_id + public int min_id; + /// Result hash + public long hash; + } /// 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 @@ -13694,20 +14620,59 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash 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 => + => client.CallAsync(new Messages_GetHistory_ { - writer.Write(0x4423E6C5); - writer.WriteTLObject(peer); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_GetHistory"; + peer = peer, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, }); + /// Gets back found messages See + [TLDef(0xA0FDA762)] + public partial class Messages_Search_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// User or chat, histories with which are searched, or constructor for global search + public InputPeer peer; + /// Text search request + public string q; + /// Only return messages sent by the specified user ID + [IfFlag(0)] public InputPeer from_id; + /// Thread ID + [IfFlag(1)] public int top_msg_id; + /// Filter to return only specified message types + public MessagesFilter filter; + /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned + public DateTime min_date; + /// If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned + public DateTime max_date; + /// Only return messages starting from the specified message ID + public int offset_id; + /// Additional offset + public int add_offset; + /// Number of results to return + public int limit; + /// Maximum message ID to return + public int max_id; + /// Minimum message ID to return + public int min_id; + /// Hash + public long hash; + + [Flags] public enum Flags + { + /// Field has a value + has_from_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, + } + } /// 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 @@ -13723,97 +14688,196 @@ namespace TL /// Minimum message ID to return /// Hash 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 => + => client.CallAsync(new Messages_Search_ { - writer.Write(0xA0FDA762); - writer.Write((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLString(q); - if (from_id != null) - writer.WriteTLObject(from_id); - if (top_msg_id != null) - writer.Write(top_msg_id.Value); - writer.WriteTLObject(filter); - writer.WriteTLStamp(min_date); - writer.WriteTLStamp(max_date); - writer.Write(offset_id); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_Search"; + flags = (Messages_Search_.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + peer = peer, + q = q, + from_id = from_id, + top_msg_id = top_msg_id.GetValueOrDefault(), + filter = filter, + min_date = min_date, + max_date = max_date, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, }); + /// Marks message history as read. See + [TLDef(0x0E306D3A)] + public partial class Messages_ReadHistory_ : ITLMethod + { + /// Target user or group + public InputPeer peer; + /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read + public int max_id; + } /// 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 public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadHistory_ { - writer.Write(0x0E306D3A); - writer.WriteTLObject(peer); - writer.Write(max_id); - return "Messages_ReadHistory"; + peer = peer, + max_id = max_id, }); + /// Deletes communication history. See + [TLDef(0xB08F922A)] + public partial class Messages_DeleteHistory_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// User or chat, communication history of which will be deleted + public InputPeer peer; + /// Maximum ID of message to delete + public int max_id; + [IfFlag(2)] public DateTime min_date; + [IfFlag(3)] public DateTime max_date; + + [Flags] public enum Flags + { + /// Just clear history for the current user, without actually removing messages for every chat user + just_clear = 0x1, + /// Whether to delete the message history for all chat participants + revoke = 0x2, + /// Field has a value + has_min_date = 0x4, + /// Field has a value + has_max_date = 0x8, + } + } /// 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 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 => + => client.CallAsync(new Messages_DeleteHistory_ { - writer.Write(0xB08F922A); - writer.Write((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)); - writer.WriteTLObject(peer); - writer.Write(max_id); - if (min_date != null) - writer.WriteTLStamp(min_date.Value); - if (max_date != null) - writer.WriteTLStamp(max_date.Value); - return "Messages_DeleteHistory"; + flags = (Messages_DeleteHistory_.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + peer = peer, + max_id = max_id, + min_date = min_date.GetValueOrDefault(), + max_date = max_date.GetValueOrDefault(), }); + /// Deletes messages by their identifiers. See + [TLDef(0xE58E95D2)] + public partial class Messages_DeleteMessages_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message ID list + public int[] id; + + [Flags] public enum Flags + { + /// Whether to delete messages for all participants of the chat + revoke = 0x1, + } + } /// Deletes messages by their identifiers. See [bots: ✓] Possible codes: 403 (details) /// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteMessages_ { - writer.Write(0xE58E95D2); - writer.Write(revoke ? 0x1 : 0); - writer.WriteTLVector(id); - return "Messages_DeleteMessages"; + flags = (Messages_DeleteMessages_.Flags)(revoke ? 0x1 : 0), + id = id, }); + /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See + [TLDef(0x05A954C0)] + public partial class Messages_ReceivedMessages_ : ITLMethod + { + /// Maximum message ID available in a client. + public int max_id; + } /// Confirms receipt of messages by a client, cancels PUSH-notification sending. See /// Maximum message ID available in a client. public static Task Messages_ReceivedMessages(this Client client, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReceivedMessages_ { - writer.Write(0x05A954C0); - writer.Write(max_id); - return "Messages_ReceivedMessages"; + max_id = max_id, }); + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See + [TLDef(0x58943EE2)] + public partial class Messages_SetTyping_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Target user or group + public InputPeer peer; + /// Thread ID + [IfFlag(0)] public int top_msg_id; + /// Type of action
Parameter added in Layer 17.
+ public SendMessageAction action; + + [Flags] public enum Flags + { + /// Field has a value + has_top_msg_id = 0x1, + } + } /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) /// Target user or group /// Thread ID /// Type of action
Parameter added in Layer 17. public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetTyping_ { - writer.Write(0x58943EE2); - writer.Write(top_msg_id != null ? 0x1 : 0); - writer.WriteTLObject(peer); - if (top_msg_id != null) - writer.Write(top_msg_id.Value); - writer.WriteTLObject(action); - return "Messages_SetTyping"; + flags = (Messages_SetTyping_.Flags)(top_msg_id != null ? 0x1 : 0), + peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), + action = action, }); + /// Sends a message to a chat See + [TLDef(0x520C3870)] + public partial class Messages_SendMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The destination where the message will be sent + public InputPeer peer; + /// The message ID to which this message will reply to + [IfFlag(0)] public int reply_to_msg_id; + /// The message + public string message; + /// Unique client message ID required to prevent message resending + public long random_id; + /// Reply markup for sending bot buttons + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for sending styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Set this flag to disable generation of the webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Send this message silently (no notifications for the receivers) + silent = 0x20, + /// Send this message as background message + background = 0x40, + /// Clear the draft field + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Sends a message to a chat See [bots: ✓] 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) @@ -13827,24 +14891,59 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_SendMessage_ { - writer.Write(0x520C3870); - writer.Write((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLString(message); - writer.Write(random_id); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMessage"; + flags = (Messages_SendMessage_.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Send a media See + [TLDef(0x3491EBA9)] + public partial class Messages_SendMedia_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination + public InputPeer peer; + /// Message ID to which this message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Attached media + public InputMedia media; + /// Caption + public string message; + /// Random ID to avoid resending the same message + public long random_id; + /// Reply markup for bot keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Send message silently (no notification should be triggered) + silent = 0x20, + /// Send message in background + background = 0x40, + /// Clear the draft + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send a media See [bots: ✓] Possible codes: 400,403,420 (details) /// Send message silently (no notification should be triggered) /// Send message in background @@ -13858,25 +14957,52 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_SendMedia_ { - writer.Write(0x3491EBA9); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLObject(media); - writer.WriteTLString(message); - writer.Write(random_id); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMedia"; + flags = (Messages_SendMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + media = media, + message = message, + random_id = random_id, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Forwards messages by their IDs. See + [TLDef(0xD9FEE60E)] + public partial class Messages_ForwardMessages_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Source of messages + public InputPeer from_peer; + /// IDs of messages + public int[] id; + /// Random ID to prevent resending of messages + public long[] random_id; + /// Destination peer + public InputPeer to_peer; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Whether to send messages silently (no notification will be triggered on the destination clients) + silent = 0x20, + /// Whether to send the message in background + background = 0x40, + /// When forwarding games, whether to include your score in the game + with_my_score = 0x100, + /// Field has a value + has_schedule_date = 0x400, + /// Whether to forward messages without quoting the original author + drop_author = 0x800, + /// Whether to strip captions from media + drop_media_captions = 0x1000, + } + } /// Forwards messages by their IDs. See [bots: ✓] 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 @@ -13889,231 +15015,394 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_ForwardMessages_ { - writer.Write(0xD9FEE60E); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(from_peer); - writer.WriteTLVector(id); - writer.WriteTLVector(random_id); - writer.WriteTLObject(to_peer); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_ForwardMessages"; + flags = (Messages_ForwardMessages_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (schedule_date != null ? 0x400 : 0)), + from_peer = from_peer, + id = id, + random_id = random_id, + to_peer = to_peer, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Report a new incoming chat for spam, if the of the chat allow us to do that See + [TLDef(0xCF1592DB)] + public partial class Messages_ReportSpam_ : ITLMethod + { + /// Peer to report + public InputPeer peer; + } /// 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 public static Task Messages_ReportSpam(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReportSpam_ { - writer.Write(0xCF1592DB); - writer.WriteTLObject(peer); - return "Messages_ReportSpam"; + peer = peer, }); + /// Get peer settings See + [TLDef(0x3672E09C)] + public partial class Messages_GetPeerSettings_ : ITLMethod + { + /// The peer + public InputPeer peer; + } /// Get peer settings See Possible codes: 400 (details) /// The peer public static Task Messages_GetPeerSettings(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPeerSettings_ { - writer.Write(0x3672E09C); - writer.WriteTLObject(peer); - return "Messages_GetPeerSettings"; + peer = peer, }); + /// Report a message in a chat for violation of telegram's Terms of Service See + [TLDef(0x8953AB4E)] + public partial class Messages_Report_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// IDs of messages to report + public int[] id; + /// Why are these messages being reported + public ReportReason reason; + /// Comment for report moderation + public string message; + } /// 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 public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) - => client.CallAsync(writer => + => client.CallAsync(new Messages_Report_ { - writer.Write(0x8953AB4E); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - writer.Write((uint)reason); - writer.WriteTLString(message); - return "Messages_Report"; + peer = peer, + id = id, + reason = reason, + message = message, }); + /// Returns chat basic info on their IDs. See + [TLDef(0x49E9528F)] + public partial class Messages_GetChats_ : ITLMethod + { + /// List of chat IDs + public long[] id; + } /// Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details) /// List of chat IDs public static Task Messages_GetChats(this Client client, long[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetChats_ { - writer.Write(0x49E9528F); - writer.WriteTLVector(id); - return "Messages_GetChats"; + id = id, }); + /// Returns full chat info according to its ID. See + [TLDef(0xAEB00B34)] + public partial class Messages_GetFullChat_ : ITLMethod + { + /// Chat ID + public long chat_id; + } /// Returns full chat info according to its ID. See [bots: ✓] Possible codes: 400 (details) /// Chat ID public static Task Messages_GetFullChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFullChat_ { - writer.Write(0xAEB00B34); - writer.Write(chat_id); - return "Messages_GetFullChat"; + chat_id = chat_id, }); + /// Chanages chat name and sends a service message on it. See + [TLDef(0x73783FFD)] + public partial class Messages_EditChatTitle_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// New chat name, different from the old one + public string title; + } /// Chanages chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details) /// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatTitle_ { - writer.Write(0x73783FFD); - writer.Write(chat_id); - writer.WriteTLString(title); - return "Messages_EditChatTitle"; + chat_id = chat_id, + title = title, }); + /// Changes chat photo and sends a service message on it See + [TLDef(0x35DDD674)] + public partial class Messages_EditChatPhoto_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// Photo to be set + public InputChatPhotoBase photo; + } /// Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details) /// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatPhoto_ { - writer.Write(0x35DDD674); - writer.Write(chat_id); - writer.WriteTLObject(photo); - return "Messages_EditChatPhoto"; + chat_id = chat_id, + photo = photo, }); + /// Adds a user to a chat and sends a service message on it. See + [TLDef(0xF24753E3)] + public partial class Messages_AddChatUser_ : ITLMethod + { + /// Chat ID + public long chat_id; + /// User ID to be added + public InputUserBase user_id; + /// Number of last messages to be forwarded + public int fwd_limit; + } /// 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 public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_AddChatUser_ { - writer.Write(0xF24753E3); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - writer.Write(fwd_limit); - return "Messages_AddChatUser"; + chat_id = chat_id, + user_id = user_id, + fwd_limit = fwd_limit, }); + /// Deletes a user from a chat and sends a service message on it. See + [TLDef(0xA2185CAB)] + public partial class Messages_DeleteChatUser_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat ID + public long chat_id; + /// User ID to be deleted + public InputUserBase user_id; + + [Flags] public enum Flags + { + /// Remove the entire chat history of the specified user in this chat. + revoke_history = 0x1, + } + } /// Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details) /// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted public static Task Messages_DeleteChatUser(this Client client, long chat_id, InputUserBase user_id, bool revoke_history = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteChatUser_ { - writer.Write(0xA2185CAB); - writer.Write(revoke_history ? 0x1 : 0); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - return "Messages_DeleteChatUser"; + flags = (Messages_DeleteChatUser_.Flags)(revoke_history ? 0x1 : 0), + chat_id = chat_id, + user_id = user_id, }); + /// Creates a new chat. See + [TLDef(0x09CB126E)] + public partial class Messages_CreateChat_ : ITLMethod + { + /// List of user IDs to be invited + public InputUserBase[] users; + /// Chat name + public string title; + } /// Creates a new chat. See Possible codes: 400,403 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CreateChat_ { - writer.Write(0x09CB126E); - writer.WriteTLVector(users); - writer.WriteTLString(title); - return "Messages_CreateChat"; + users = users, + title = title, }); + /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See + [TLDef(0x26CF8950)] + public partial class Messages_GetDhConfig_ : ITLMethod + { + /// Value of the version parameter from , avialable at the client + public int version; + /// Length of the required random sequence + public int random_length; + } /// 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 public static Task Messages_GetDhConfig(this Client client, int version, int random_length) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDhConfig_ { - writer.Write(0x26CF8950); - writer.Write(version); - writer.Write(random_length); - return "Messages_GetDhConfig"; + version = version, + random_length = random_length, }); + /// Sends a request to start a secret chat to the user. See + [TLDef(0xF64DAF43)] + public partial class Messages_RequestEncryption_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Unique client request ID required to prevent resending. This also doubles as the chat ID. + public int random_id; + /// A = g ^ a mod p, see Wikipedia + public byte[] g_a; + } /// 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 public static Task Messages_RequestEncryption(this Client client, InputUserBase user_id, int random_id, byte[] g_a) - => client.CallAsync(writer => + => client.CallAsync(new Messages_RequestEncryption_ { - writer.Write(0xF64DAF43); - writer.WriteTLObject(user_id); - writer.Write(random_id); - writer.WriteTLBytes(g_a); - return "Messages_RequestEncryption"; + user_id = user_id, + random_id = random_id, + g_a = g_a, }); + /// Confirms creation of a secret chat See + [TLDef(0x3DBC0415)] + public partial class Messages_AcceptEncryption_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// B = g ^ b mod p, see Wikipedia + public byte[] g_b; + /// 64-bit fingerprint of the received key + public long key_fingerprint; + } /// 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 public static Task Messages_AcceptEncryption(this Client client, InputEncryptedChat peer, byte[] g_b, long key_fingerprint) - => client.CallAsync(writer => + => client.CallAsync(new Messages_AcceptEncryption_ { - writer.Write(0x3DBC0415); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_b); - writer.Write(key_fingerprint); - return "Messages_AcceptEncryption"; + peer = peer, + g_b = g_b, + key_fingerprint = key_fingerprint, }); + /// Cancels a request for creation and/or delete info on secret chat. See + [TLDef(0xF393AEA0)] + public partial class Messages_DiscardEncryption_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public int chat_id; + + [Flags] public enum Flags + { + /// Whether to delete the entire chat history for the other user as well + delete_history = 0x1, + } + } /// 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 public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DiscardEncryption_ { - writer.Write(0xF393AEA0); - writer.Write(delete_history ? 0x1 : 0); - writer.Write(chat_id); - return "Messages_DiscardEncryption"; + flags = (Messages_DiscardEncryption_.Flags)(delete_history ? 0x1 : 0), + chat_id = chat_id, }); + /// Send typing event by the current user to a secret chat. See + [TLDef(0x791451ED)] + public partial class Messages_SetEncryptedTyping_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// Typing.
Possible values:
, if the user started typing and more than 5 seconds have passed since the last request
, if the user stopped typing
+ public bool typing; + } ///
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 public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetEncryptedTyping_ { - writer.Write(0x791451ED); - writer.WriteTLObject(peer); - writer.Write(typing ? 0x997275B5 : 0xBC799737); - return "Messages_SetEncryptedTyping"; + peer = peer, + typing = typing, }); + /// Marks message history within a secret chat as read. See + [TLDef(0x7F4B690A)] + public partial class Messages_ReadEncryptedHistory_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// Maximum date value for received messages in history + public DateTime max_date; + } /// 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 public static Task Messages_ReadEncryptedHistory(this Client client, InputEncryptedChat peer, DateTime max_date) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadEncryptedHistory_ { - writer.Write(0x7F4B690A); - writer.WriteTLObject(peer); - writer.WriteTLStamp(max_date); - return "Messages_ReadEncryptedHistory"; + peer = peer, + max_date = max_date, }); + /// Sends a text message to a secret chat. See + [TLDef(0x44FA7A15)] + public partial class Messages_SendEncrypted_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID, necessary to avoid message resending + public long random_id; + /// TL-serialization of type, encrypted with a key that was created during chat initialization + public byte[] data; + + [Flags] public enum Flags + { + /// Send encrypted message without a notification + silent = 0x1, + } + } /// 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 public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendEncrypted_ { - writer.Write(0x44FA7A15); - writer.Write(silent ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - return "Messages_SendEncrypted"; + flags = (Messages_SendEncrypted_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, }); + /// Sends a message with a file attachment to a secret chat See + [TLDef(0x5559481D)] + public partial class Messages_SendEncryptedFile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID necessary to prevent message resending + public long random_id; + /// TL-serialization of type, encrypted with a key generated during chat initialization + public byte[] data; + /// File attachment for the secret chat + public InputEncryptedFileBase file; + + [Flags] public enum Flags + { + /// Whether to send the file without triggering a notification + silent = 0x1, + } + } /// 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 @@ -14121,226 +15410,388 @@ namespace TL /// TL-serialization of type, encrypted with a key generated during chat initialization /// File attachment for the secret chat public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendEncryptedFile_ { - writer.Write(0x5559481D); - writer.Write(silent ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - writer.WriteTLObject(file); - return "Messages_SendEncryptedFile"; + flags = (Messages_SendEncryptedFile_.Flags)(silent ? 0x1 : 0), + peer = peer, + random_id = random_id, + data = data, + file = file, }); + /// Sends a service message to a secret chat. See + [TLDef(0x32D439A4)] + public partial class Messages_SendEncryptedService_ : ITLMethod + { + /// Secret chat ID + public InputEncryptedChat peer; + /// Unique client message ID required to prevent message resending + public long random_id; + /// TL-serialization of type, encrypted with a key generated during chat initialization + public byte[] data; + } /// 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 public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendEncryptedService_ { - writer.Write(0x32D439A4); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLBytes(data); - return "Messages_SendEncryptedService"; + peer = peer, + random_id = random_id, + data = data, }); + /// Confirms receipt of messages in a secret chat by client, cancels push notifications. See + [TLDef(0x55A5BB66)] + public partial class Messages_ReceivedQueue_ : ITLMethod + { + /// Maximum qts value available at the client + public int max_qts; + } /// 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 public static Task Messages_ReceivedQueue(this Client client, int max_qts) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReceivedQueue_ { - writer.Write(0x55A5BB66); - writer.Write(max_qts); - return "Messages_ReceivedQueue"; + max_qts = max_qts, }); + /// Report a secret chat for spam See + [TLDef(0x4B0C8C0F)] + public partial class Messages_ReportEncryptedSpam_ : ITLMethod + { + /// The secret chat to report + public InputEncryptedChat peer; + } /// Report a secret chat for spam See Possible codes: 400 (details) /// The secret chat to report public static Task Messages_ReportEncryptedSpam(this Client client, InputEncryptedChat peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReportEncryptedSpam_ { - writer.Write(0x4B0C8C0F); - writer.WriteTLObject(peer); - return "Messages_ReportEncryptedSpam"; + peer = peer, }); + /// Notifies the sender about the recipient having listened a voice message or watched a video. See + [TLDef(0x36A73F77)] + public partial class Messages_ReadMessageContents_ : ITLMethod + { + /// Message ID list + public int[] id; + } /// Notifies the sender about the recipient having listened a voice message or watched a video. See /// Message ID list public static Task Messages_ReadMessageContents(this Client client, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadMessageContents_ { - writer.Write(0x36A73F77); - writer.WriteTLVector(id); - return "Messages_ReadMessageContents"; + id = id, }); + /// Get stickers by emoji See + [TLDef(0xD5A5D3A1)] + public partial class Messages_GetStickers_ : ITLMethod + { + /// The emoji + public string emoticon; + /// Hash for pagination, for more info click here + public long hash; + } /// 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 public static Task Messages_GetStickers(this Client client, string emoticon, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetStickers_ { - writer.Write(0xD5A5D3A1); - writer.WriteTLString(emoticon); - writer.Write(hash); - return "Messages_GetStickers"; + emoticon = emoticon, + hash = hash, }); + /// Get all installed stickers See + [TLDef(0xB8A0A1A8)] + public partial class Messages_GetAllStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get all installed stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllStickers_ { - writer.Write(0xB8A0A1A8); - writer.Write(hash); - return "Messages_GetAllStickers"; + hash = hash, }); + /// Get preview of webpage See + [TLDef(0x8B68B0CC)] + public partial class Messages_GetWebPagePreview_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message from which to extract the preview + public string message; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_entities = 0x8, + } + } /// 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 public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetWebPagePreview_ { - writer.Write(0x8B68B0CC); - writer.Write(entities != null ? 0x8 : 0); - writer.WriteTLString(message); - if (entities != null) - writer.WriteTLVector(entities); - return "Messages_GetWebPagePreview"; + flags = (Messages_GetWebPagePreview_.Flags)(entities != null ? 0x8 : 0), + message = message, + entities = entities, }); + /// Export an invite link for a chat See + [TLDef(0xA02CE5D5)] + public partial class Messages_ExportChatInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Expiration date + [IfFlag(0)] public DateTime expire_date; + /// Maximum number of users that can join using this link + [IfFlag(1)] public int usage_limit; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + /// 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. + legacy_revoke_permanent = 0x4, + request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Export an invite link for a chat See [bots: ✓] 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 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 => + => client.CallAsync(new Messages_ExportChatInvite_ { - writer.Write(0xA02CE5D5); - writer.Write((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)); - writer.WriteTLObject(peer); - if (expire_date != null) - writer.WriteTLStamp(expire_date.Value); - if (usage_limit != null) - writer.Write(usage_limit.Value); - if (title != null) - writer.WriteTLString(title); - return "Messages_ExportChatInvite"; + flags = (Messages_ExportChatInvite_.Flags)((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)), + peer = peer, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + title = title, }); + /// Check the validity of a chat invite link and get basic info about it See + [TLDef(0x3EADB1BB)] + public partial class Messages_CheckChatInvite_ : ITLMethod + { + /// Invite hash in t.me/joinchat/hash + public string hash; + } /// 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 public static Task Messages_CheckChatInvite(this Client client, string hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckChatInvite_ { - writer.Write(0x3EADB1BB); - writer.WriteTLString(hash); - return "Messages_CheckChatInvite"; + hash = hash, }); + /// Import a chat invite and join a private chat/supergroup/channel See + [TLDef(0x6C50051C)] + public partial class Messages_ImportChatInvite_ : ITLMethod + { + /// hash from t.me/joinchat/hash + public string hash; + } /// Import a chat invite and join a private chat/supergroup/channel See Possible codes: 400 (details) /// hash from t.me/joinchat/hash public static Task Messages_ImportChatInvite(this Client client, string hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ImportChatInvite_ { - writer.Write(0x6C50051C); - writer.WriteTLString(hash); - return "Messages_ImportChatInvite"; + hash = hash, }); + /// Get info about a stickerset See + [TLDef(0x2619A90E)] + public partial class Messages_GetStickerSet_ : ITLMethod + { + /// Stickerset + public InputStickerSet stickerset; + } /// Get info about a stickerset See [bots: ✓] Possible codes: 400 (details) /// Stickerset public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetStickerSet_ { - writer.Write(0x2619A90E); - writer.WriteTLObject(stickerset); - return "Messages_GetStickerSet"; + stickerset = stickerset, }); + /// Install a stickerset See + [TLDef(0xC78FE460)] + public partial class Messages_InstallStickerSet_ : ITLMethod + { + /// Stickerset to install + public InputStickerSet stickerset; + /// Whether to archive stickerset + public bool archived; + } /// Install a stickerset See Possible codes: 400 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) - => client.CallAsync(writer => + => client.CallAsync(new Messages_InstallStickerSet_ { - writer.Write(0xC78FE460); - writer.WriteTLObject(stickerset); - writer.Write(archived ? 0x997275B5 : 0xBC799737); - return "Messages_InstallStickerSet"; + stickerset = stickerset, + archived = archived, }); + /// Uninstall a stickerset See + [TLDef(0xF96E55DE)] + public partial class Messages_UninstallStickerSet_ : ITLMethod + { + /// The stickerset to uninstall + public InputStickerSet stickerset; + } /// Uninstall a stickerset See Possible codes: 400 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UninstallStickerSet_ { - writer.Write(0xF96E55DE); - writer.WriteTLObject(stickerset); - return "Messages_UninstallStickerSet"; + stickerset = stickerset, }); + /// Start a conversation with a bot using a deep linking parameter See + [TLDef(0xE6DF7378)] + public partial class Messages_StartBot_ : ITLMethod + { + /// The bot + public InputUserBase bot; + /// The chat where to start the bot, can be the bot's private chat or a group + public InputPeer peer; + /// Random ID to avoid resending the same message + public long random_id; + /// Deep linking parameter + public string start_param; + } /// 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 public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) - => client.CallAsync(writer => + => client.CallAsync(new Messages_StartBot_ { - writer.Write(0xE6DF7378); - writer.WriteTLObject(bot); - writer.WriteTLObject(peer); - writer.Write(random_id); - writer.WriteTLString(start_param); - return "Messages_StartBot"; + bot = bot, + peer = peer, + random_id = random_id, + start_param = start_param, }); + /// Get and increase the view counter of a message sent or forwarded from a channel See + [TLDef(0x5784D3E1)] + public partial class Messages_GetMessagesViews_ : ITLMethod + { + /// Peer where the message was found + public InputPeer peer; + /// ID of message + public int[] id; + /// Whether to mark the message as viewed and increment the view counter + public bool increment; + } /// 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 public static Task Messages_GetMessagesViews(this Client client, InputPeer peer, int[] id, bool increment) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessagesViews_ { - writer.Write(0x5784D3E1); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - writer.Write(increment ? 0x997275B5 : 0xBC799737); - return "Messages_GetMessagesViews"; + peer = peer, + id = id, + increment = increment, }); + /// Make a user admin in a legacy group. See + [TLDef(0xA85BD1C2)] + public partial class Messages_EditChatAdmin_ : ITLMethod + { + /// The ID of the group + public long chat_id; + /// The user to make admin + public InputUserBase user_id; + /// Whether to make him admin + public bool is_admin; + } /// 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 public static Task Messages_EditChatAdmin(this Client client, long chat_id, InputUserBase user_id, bool is_admin) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatAdmin_ { - writer.Write(0xA85BD1C2); - writer.Write(chat_id); - writer.WriteTLObject(user_id); - writer.Write(is_admin ? 0x997275B5 : 0xBC799737); - return "Messages_EditChatAdmin"; + chat_id = chat_id, + user_id = user_id, + is_admin = is_admin, }); + /// Turn a legacy group into a supergroup See + [TLDef(0xA2875319)] + public partial class Messages_MigrateChat_ : ITLMethod + { + /// Legacy group to migrate + public long chat_id; + } /// Turn a legacy group into a supergroup See Possible codes: 400,403 (details) /// Legacy group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_MigrateChat_ { - writer.Write(0xA2875319); - writer.Write(chat_id); - return "Messages_MigrateChat"; + chat_id = chat_id, }); + /// Search for messages and peers globally See + [TLDef(0x4BC6589A)] + public partial class Messages_SearchGlobal_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + [IfFlag(0)] public int folder_id; + /// Query + public string q; + /// Global search filter + public MessagesFilter filter; + /// If a positive value was specified, the method will return only messages with date bigger than min_date + public DateTime min_date; + /// If a positive value was transferred, the method will return only messages with date smaller than max_date + public DateTime max_date; + /// Initially 0, then set to the + public int offset_rate; + /// Offsets for pagination, for more info click here + public InputPeer offset_peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_folder_id = 0x1, + } + } /// Search for messages and peers globally See Possible codes: 400 (details) /// Peer folder ID, for more info click here /// Query @@ -14352,72 +15803,126 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here 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 => + => client.CallAsync(new Messages_SearchGlobal_ { - writer.Write(0x4BC6589A); - writer.Write(folder_id != null ? 0x1 : 0); - if (folder_id != null) - writer.Write(folder_id.Value); - writer.WriteTLString(q); - writer.WriteTLObject(filter); - writer.WriteTLStamp(min_date); - writer.WriteTLStamp(max_date); - writer.Write(offset_rate); - writer.WriteTLObject(offset_peer); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_SearchGlobal"; + flags = (Messages_SearchGlobal_.Flags)(folder_id != null ? 0x1 : 0), + folder_id = folder_id.GetValueOrDefault(), + q = q, + filter = filter, + min_date = min_date, + max_date = max_date, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, }); + /// Reorder installed stickersets See + [TLDef(0x78337739)] + public partial class Messages_ReorderStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// New stickerset order by stickerset IDs + public long[] order; + + [Flags] public enum Flags + { + /// Reorder mask stickersets + masks = 0x1, + } + } /// Reorder installed stickersets See /// Reorder mask stickersets /// New stickerset order by stickerset IDs public static Task Messages_ReorderStickerSets(this Client client, long[] order, bool masks = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReorderStickerSets_ { - writer.Write(0x78337739); - writer.Write(masks ? 0x1 : 0); - writer.WriteTLVector(order); - return "Messages_ReorderStickerSets"; + flags = (Messages_ReorderStickerSets_.Flags)(masks ? 0x1 : 0), + order = order, }); + /// Get a document by its SHA256 hash, mainly used for gifs See + [TLDef(0x338E2464)] + public partial class Messages_GetDocumentByHash_ : ITLMethod + { + /// SHA256 of file + public byte[] sha256; + /// Size of the file in bytes + public int size; + /// Mime type + public string mime_type; + } /// Get a document by its SHA256 hash, mainly used for gifs See [bots: ✓] Possible codes: 400 (details) /// SHA256 of file /// Size of the file in bytes /// Mime type public static Task Messages_GetDocumentByHash(this Client client, byte[] sha256, int size, string mime_type) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDocumentByHash_ { - writer.Write(0x338E2464); - writer.WriteTLBytes(sha256); - writer.Write(size); - writer.WriteTLString(mime_type); - return "Messages_GetDocumentByHash"; + sha256 = sha256, + size = size, + mime_type = mime_type, }); + /// Get saved GIFs See + [TLDef(0x5CF09635)] + public partial class Messages_GetSavedGifs_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get saved GIFs See /// Hash for pagination, for more info click here /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSavedGifs_ { - writer.Write(0x5CF09635); - writer.Write(hash); - return "Messages_GetSavedGifs"; + hash = hash, }); + /// Add GIF to saved gifs list See + [TLDef(0x327A30CB)] + public partial class Messages_SaveGif_ : ITLMethod + { + /// GIF to save + public InputDocument id; + /// Whether to remove GIF from saved gifs list + public bool unsave; + } /// Add GIF to saved gifs list See Possible codes: 400 (details) /// GIF to save /// Whether to remove GIF from saved gifs list public static Task Messages_SaveGif(this Client client, InputDocument id, bool unsave) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SaveGif_ { - writer.Write(0x327A30CB); - writer.WriteTLObject(id); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Messages_SaveGif"; + id = id, + unsave = unsave, }); + /// Query an inline bot See + [TLDef(0x514E999D)] + public partial class Messages_GetInlineBotResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The bot to query + public InputUserBase bot; + /// The currently opened chat + public InputPeer peer; + /// The geolocation, if requested + [IfFlag(0)] public InputGeoPoint geo_point; + /// The query + public string query; + /// The offset within the results, will be passed directly as-is to the bot. + public string offset; + + [Flags] public enum Flags + { + /// Field has a value + has_geo_point = 0x1, + } + } /// Query an inline bot See Possible codes: -503,400 (details) /// The bot to query /// The currently opened chat @@ -14425,19 +15930,45 @@ namespace TL /// The query /// The offset within the results, will be passed directly as-is to the bot. public static Task Messages_GetInlineBotResults(this Client client, InputUserBase bot, InputPeer peer, string query, string offset, InputGeoPoint geo_point = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetInlineBotResults_ { - writer.Write(0x514E999D); - writer.Write(geo_point != null ? 0x1 : 0); - writer.WriteTLObject(bot); - writer.WriteTLObject(peer); - if (geo_point != null) - writer.WriteTLObject(geo_point); - writer.WriteTLString(query); - writer.WriteTLString(offset); - return "Messages_GetInlineBotResults"; + flags = (Messages_GetInlineBotResults_.Flags)(geo_point != null ? 0x1 : 0), + bot = bot, + peer = peer, + geo_point = geo_point, + query = query, + offset = offset, }); + /// Answer an inline query, for bots only See + [TLDef(0xEB5EA206)] + public partial class Messages_SetInlineBotResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the answered query + public long query_id; + /// Vector of results for the inline query + public InputBotInlineResultBase[] results; + /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. + public DateTime cache_time; + /// 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. + [IfFlag(2)] public string next_offset; + /// 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. + [IfFlag(3)] public InlineBotSwitchPM switch_pm; + + [Flags] public enum Flags + { + /// Set this flag if the results are composed of media files + gallery = 0x1, + /// 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 + private_ = 0x2, + /// Field has a value + has_next_offset = 0x4, + /// Field has a value + has_switch_pm = 0x8, + } + } /// Answer an inline query, for bots only See [bots: ✓] 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 @@ -14447,20 +15978,51 @@ namespace TL /// 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. 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 => + => client.CallAsync(new Messages_SetInlineBotResults_ { - writer.Write(0xEB5EA206); - writer.Write((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)); - writer.Write(query_id); - writer.WriteTLVector(results); - writer.WriteTLStamp(cache_time); - if (next_offset != null) - writer.WriteTLString(next_offset); - if (switch_pm != null) - writer.WriteTLObject(switch_pm); - return "Messages_SetInlineBotResults"; + flags = (Messages_SetInlineBotResults_.Flags)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), + query_id = query_id, + results = results, + cache_time = cache_time, + next_offset = next_offset, + switch_pm = switch_pm, }); + /// Send a result obtained using messages.getInlineBotResults. See + [TLDef(0x220815B0)] + public partial class Messages_SendInlineBotResult_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination + public InputPeer peer; + /// ID of the message this message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Random ID to avoid resending the same query + public long random_id; + /// Query ID from messages.getInlineBotResults + public long query_id; + /// Result ID from messages.getInlineBotResults + public string id; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Whether to send the message silently (no notification will be triggered on the other client) + silent = 0x20, + /// Whether to send the message in background + background = 0x40, + /// Whether to clear the draft + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) + hide_via = 0x800, + } + } /// 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 @@ -14473,33 +16035,73 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_SendInlineBotResult_ { - writer.Write(0x220815B0); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.Write(random_id); - writer.Write(query_id); - writer.WriteTLString(id); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendInlineBotResult"; + flags = (Messages_SendInlineBotResult_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + random_id = random_id, + query_id = query_id, + id = id, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Find out if a media message's caption can be edited See + [TLDef(0xFDA68D36)] + public partial class Messages_GetMessageEditData_ : ITLMethod + { + /// Peer where the media was sent + public InputPeer peer; + /// ID of message + public int id; + } /// 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 public static Task Messages_GetMessageEditData(this Client client, InputPeer peer, int id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessageEditData_ { - writer.Write(0xFDA68D36); - writer.WriteTLObject(peer); - writer.Write(id); - return "Messages_GetMessageEditData"; + peer = peer, + id = id, }); + /// Edit message See + [TLDef(0x48F71778)] + public partial class Messages_EditMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Where was the message sent + public InputPeer peer; + /// ID of the message to edit + public int id; + /// New message + [IfFlag(11)] public string message; + /// New attached media + [IfFlag(14)] public InputMedia media; + /// Reply markup for inline keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + /// Scheduled message date for scheduled messages + [IfFlag(15)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + /// Field has a value + has_schedule_date = 0x8000, + } + } /// Edit message See [bots: ✓] Possible codes: 400,403 (details) /// Disable webpage preview /// Where was the message sent @@ -14510,25 +16112,49 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_EditMessage_ { - writer.Write(0x48F71778); - writer.Write((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - if (message != null) - writer.WriteTLString(message); - if (media != null) - writer.WriteTLObject(media); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_EditMessage"; + flags = (Messages_EditMessage_.Flags)((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0)), + peer = peer, + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Edit an inline bot message See + [TLDef(0x83557DBA)] + public partial class Messages_EditInlineBotMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Sent inline message ID + public InputBotInlineMessageIDBase id; + /// Message + [IfFlag(11)] public string message; + /// Media + [IfFlag(14)] public InputMedia media; + /// Reply markup for inline keyboards + [IfFlag(2)] public ReplyMarkup reply_markup; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Disable webpage preview + no_webpage = 0x2, + /// Field has a value + has_reply_markup = 0x4, + /// Field has a value + has_entities = 0x8, + /// Field has a value + has_message = 0x800, + /// Field has a value + has_media = 0x4000, + } + } /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview /// Sent inline message ID @@ -14537,22 +16163,41 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text 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 => + => client.CallAsync(new Messages_EditInlineBotMessage_ { - writer.Write(0x83557DBA); - writer.Write((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)); - writer.WriteTLObject(id); - if (message != null) - writer.WriteTLString(message); - if (media != null) - writer.WriteTLObject(media); - if (reply_markup != null) - writer.WriteTLObject(reply_markup); - if (entities != null) - writer.WriteTLVector(entities); - return "Messages_EditInlineBotMessage"; + flags = (Messages_EditInlineBotMessage_.Flags)((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), + id = id, + message = message, + media = media, + reply_markup = reply_markup, + entities = entities, }); + /// Press an inline callback button and get a callback answer from the bot See + [TLDef(0x9342CA07)] + public partial class Messages_GetBotCallbackAnswer_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Where was the inline keyboard sent + public InputPeer peer; + /// ID of the Message with the inline keyboard + public int msg_id; + /// Callback data + [IfFlag(0)] public byte[] data; + /// For buttons , the SRP payload generated using SRP. + [IfFlag(2)] public InputCheckPasswordSRP password; + + [Flags] public enum Flags + { + /// Field has a value + has_data = 0x1, + /// Whether this is a "play game" button + game = 0x2, + /// Field has a value + has_password = 0x4, + } + } /// 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 @@ -14560,19 +16205,40 @@ namespace TL /// Callback data /// For buttons , the SRP payload generated using SRP. 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 => + => client.CallAsync(new Messages_GetBotCallbackAnswer_ { - writer.Write(0x9342CA07); - writer.Write((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (data != null) - writer.WriteTLBytes(data); - if (password != null) - writer.WriteTLObject(password); - return "Messages_GetBotCallbackAnswer"; + flags = (Messages_GetBotCallbackAnswer_.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id, + data = data, + password = password, }); + /// Set the callback answer to a user button press (bots only) See + [TLDef(0xD58F130A)] + public partial class Messages_SetBotCallbackAnswer_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Query ID + public long query_id; + /// Popup to show + [IfFlag(0)] public string message; + /// URL to open + [IfFlag(2)] public string url; + /// Cache validity + public DateTime cache_time; + + [Flags] public enum Flags + { + /// Field has a value + has_message = 0x1, + /// Whether to show the message as a popup instead of a toast notification + alert = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID @@ -14580,29 +16246,55 @@ namespace TL /// URL to open /// Cache validity 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 => + => client.CallAsync(new Messages_SetBotCallbackAnswer_ { - writer.Write(0xD58F130A); - writer.Write((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)); - writer.Write(query_id); - if (message != null) - writer.WriteTLString(message); - if (url != null) - writer.WriteTLString(url); - writer.WriteTLStamp(cache_time); - return "Messages_SetBotCallbackAnswer"; + flags = (Messages_SetBotCallbackAnswer_.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + query_id = query_id, + message = message, + url = url, + cache_time = cache_time, }); + /// Get dialog info of specified peers See + [TLDef(0xE470BCFD)] + public partial class Messages_GetPeerDialogs_ : ITLMethod + { + /// Peers + public InputDialogPeerBase[] peers; + } /// Get dialog info of specified peers See Possible codes: 400 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, InputDialogPeerBase[] peers) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPeerDialogs_ { - writer.Write(0xE470BCFD); - writer.WriteTLVector(peers); - return "Messages_GetPeerDialogs"; + peers = peers, }); + /// Save a message draft associated to a chat. See + [TLDef(0xBC39E14B)] + public partial class Messages_SaveDraft_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Message ID the message should reply to + [IfFlag(0)] public int reply_to_msg_id; + /// Destination of the message that should be sent + public InputPeer peer; + /// The draft + public string message; + /// Message entities for styled text + [IfFlag(3)] public MessageEntity[] entities; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Disable generation of the webpage preview + no_webpage = 0x2, + /// Field has a value + has_entities = 0x8, + } + } /// 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 @@ -14610,119 +16302,213 @@ namespace TL /// The draft /// Message entities for styled text 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 => + => client.CallAsync(new Messages_SaveDraft_ { - writer.Write(0xBC39E14B); - writer.Write((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLObject(peer); - writer.WriteTLString(message); - if (entities != null) - writer.WriteTLVector(entities); - return "Messages_SaveDraft"; + flags = (Messages_SaveDraft_.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + peer = peer, + message = message, + entities = entities, }); + /// Save get all message drafts. See + [TLDef(0x6A3F8D65)] + public partial class Messages_GetAllDrafts_ : ITLMethod { } /// Save get all message drafts. See public static Task Messages_GetAllDrafts(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllDrafts_ { - writer.Write(0x6A3F8D65); - return "Messages_GetAllDrafts"; }); + /// Get featured stickers See + [TLDef(0x64780B14)] + public partial class Messages_GetFeaturedStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get featured stickers See /// Hash for pagination, for more info click here public static Task Messages_GetFeaturedStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFeaturedStickers_ { - writer.Write(0x64780B14); - writer.Write(hash); - return "Messages_GetFeaturedStickers"; + hash = hash, }); + /// Mark new featured stickers as read See + [TLDef(0x5B118126)] + public partial class Messages_ReadFeaturedStickers_ : ITLMethod + { + /// IDs of stickersets to mark as read + public long[] id; + } /// Mark new featured stickers as read See /// IDs of stickersets to mark as read public static Task Messages_ReadFeaturedStickers(this Client client, long[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadFeaturedStickers_ { - writer.Write(0x5B118126); - writer.WriteTLVector(id); - return "Messages_ReadFeaturedStickers"; + id = id, }); + /// Get recent stickers See + [TLDef(0x9DA9403B)] + public partial class Messages_GetRecentStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Get stickers recently attached to photo or video files + attached = 0x1, + } + } /// Get recent stickers See /// Get stickers recently attached to photo or video files /// Hash for pagination, for more info click here /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetRecentStickers_ { - writer.Write(0x9DA9403B); - writer.Write(attached ? 0x1 : 0); - writer.Write(hash); - return "Messages_GetRecentStickers"; + flags = (Messages_GetRecentStickers_.Flags)(attached ? 0x1 : 0), + hash = hash, }); + /// Add/remove sticker from recent stickers list See + [TLDef(0x392718F8)] + public partial class Messages_SaveRecentSticker_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Sticker + public InputDocument id; + /// Whether to save or unsave the sticker + public bool unsave; + + [Flags] public enum Flags + { + /// Whether to add/remove stickers recently attached to photo or video files + attached = 0x1, + } + } /// 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 public static Task Messages_SaveRecentSticker(this Client client, InputDocument id, bool unsave, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SaveRecentSticker_ { - writer.Write(0x392718F8); - writer.Write(attached ? 0x1 : 0); - writer.WriteTLObject(id); - writer.Write(unsave ? 0x997275B5 : 0xBC799737); - return "Messages_SaveRecentSticker"; + flags = (Messages_SaveRecentSticker_.Flags)(attached ? 0x1 : 0), + id = id, + unsave = unsave, }); + /// Clear recent stickers See + [TLDef(0x8999602D)] + public partial class Messages_ClearRecentStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Set this flag to clear the list of stickers recently attached to photo or video files + attached = 0x1, + } + } /// Clear recent stickers See /// Set this flag to clear the list of stickers recently attached to photo or video files public static Task Messages_ClearRecentStickers(this Client client, bool attached = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ClearRecentStickers_ { - writer.Write(0x8999602D); - writer.Write(attached ? 0x1 : 0); - return "Messages_ClearRecentStickers"; + flags = (Messages_ClearRecentStickers_.Flags)(attached ? 0x1 : 0), }); + /// Get all archived stickers See + [TLDef(0x57F17692)] + public partial class Messages_GetArchivedStickers_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Offsets for pagination, for more info click here + public long offset_id; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Get mask stickers + masks = 0x1, + } + } /// Get all archived stickers See /// Get mask stickers /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetArchivedStickers(this Client client, long offset_id, int limit, bool masks = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetArchivedStickers_ { - writer.Write(0x57F17692); - writer.Write(masks ? 0x1 : 0); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_GetArchivedStickers"; + flags = (Messages_GetArchivedStickers_.Flags)(masks ? 0x1 : 0), + offset_id = offset_id, + limit = limit, }); + /// Get installed mask stickers See + [TLDef(0x640F82B8)] + public partial class Messages_GetMaskStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get installed mask stickers See /// Hash for pagination, for more info click here /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMaskStickers_ { - writer.Write(0x640F82B8); - writer.Write(hash); - return "Messages_GetMaskStickers"; + hash = hash, }); + /// Get stickers attached to a photo or video See + [TLDef(0xCC5B67CC)] + public partial class Messages_GetAttachedStickers_ : ITLMethod + { + /// Stickered media + public InputStickeredMedia media; + } /// Get stickers attached to a photo or video See /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAttachedStickers_ { - writer.Write(0xCC5B67CC); - writer.WriteTLObject(media); - return "Messages_GetAttachedStickers"; + media = media, }); + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See + [TLDef(0x8EF8ECC0)] + public partial class Messages_SetGameScore_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier of target chat + public InputPeer peer; + /// Identifier of the sent message + public int id; + /// User identifier + public InputUserBase user_id; + /// New score + public int score; + + [Flags] public enum Flags + { + /// Set this flag if the game message should be automatically edited to include the current scoreboard + edit_message = 0x1, + /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters + force = 0x2, + } + } /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: ✓] 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 @@ -14731,17 +16517,36 @@ namespace TL /// User identifier /// New score 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 => + => client.CallAsync(new Messages_SetGameScore_ { - writer.Write(0x8EF8ECC0); - writer.Write((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - writer.WriteTLObject(user_id); - writer.Write(score); - return "Messages_SetGameScore"; + flags = (Messages_SetGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + peer = peer, + id = id, + user_id = user_id, + score = score, }); + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See + [TLDef(0x15AD9F64)] + public partial class Messages_SetInlineGameScore_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// ID of the inline message + public InputBotInlineMessageIDBase id; + /// User identifier + public InputUserBase user_id; + /// New score + public int score; + + [Flags] public enum Flags + { + /// Set this flag if the game message should be automatically edited to include the current scoreboard + edit_message = 0x1, + /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters + force = 0x2, + } + } /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: ✓] 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 @@ -14749,196 +16554,342 @@ namespace TL /// User identifier /// New score 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 => + => client.CallAsync(new Messages_SetInlineGameScore_ { - writer.Write(0x15AD9F64); - writer.Write((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)); - writer.WriteTLObject(id); - writer.WriteTLObject(user_id); - writer.Write(score); - return "Messages_SetInlineGameScore"; + flags = (Messages_SetInlineGameScore_.Flags)((edit_message ? 0x1 : 0) | (force ? 0x2 : 0)), + id = id, + user_id = user_id, + score = score, }); + /// Get highscores of a game See + [TLDef(0xE822649D)] + public partial class Messages_GetGameHighScores_ : ITLMethod + { + /// Where was the game sent + public InputPeer peer; + /// ID of message with game media attachment + public int id; + /// Get high scores made by a certain user + public InputUserBase user_id; + } /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user public static Task Messages_GetGameHighScores(this Client client, InputPeer peer, int id, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetGameHighScores_ { - writer.Write(0xE822649D); - writer.WriteTLObject(peer); - writer.Write(id); - writer.WriteTLObject(user_id); - return "Messages_GetGameHighScores"; + peer = peer, + id = id, + user_id = user_id, }); + /// Get highscores of a game sent using an inline bot See + [TLDef(0x0F635E1B)] + public partial class Messages_GetInlineGameHighScores_ : ITLMethod + { + /// ID of inline message + public InputBotInlineMessageIDBase id; + /// Get high scores of a certain user + public InputUserBase user_id; + } /// Get highscores of a game sent using an inline bot See [bots: ✓] Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetInlineGameHighScores_ { - writer.Write(0x0F635E1B); - writer.WriteTLObject(id); - writer.WriteTLObject(user_id); - return "Messages_GetInlineGameHighScores"; + id = id, + user_id = user_id, }); + /// Get chats in common with a user See + [TLDef(0xE40CA104)] + public partial class Messages_GetCommonChats_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Maximum ID of chat to return (see pagination) + public long max_id; + /// Maximum number of results to return, see pagination + public int limit; + } /// 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 public static Task Messages_GetCommonChats(this Client client, InputUserBase user_id, long max_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetCommonChats_ { - writer.Write(0xE40CA104); - writer.WriteTLObject(user_id); - writer.Write(max_id); - writer.Write(limit); - return "Messages_GetCommonChats"; + user_id = user_id, + max_id = max_id, + limit = limit, }); + /// Get all chats, channels and supergroups See + [TLDef(0x875F74BE)] + public partial class Messages_GetAllChats_ : ITLMethod + { + /// Except these chats/channels/supergroups + public long[] except_ids; + } /// Get all chats, channels and supergroups See /// Except these chats/channels/supergroups public static Task Messages_GetAllChats(this Client client, long[] except_ids) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAllChats_ { - writer.Write(0x875F74BE); - writer.WriteTLVector(except_ids); - return "Messages_GetAllChats"; + except_ids = except_ids, }); + /// Get instant view page See + [TLDef(0x32CA8F91)] + public partial class Messages_GetWebPage_ : ITLMethod + { + /// URL of IV page to fetch + public string url; + /// Hash for pagination, for more info click here + public int hash; + } /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here public static Task Messages_GetWebPage(this Client client, string url, int hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetWebPage_ { - writer.Write(0x32CA8F91); - writer.WriteTLString(url); - writer.Write(hash); - return "Messages_GetWebPage"; + url = url, + hash = hash, }); + /// Pin/unpin a dialog See + [TLDef(0xA731E257)] + public partial class Messages_ToggleDialogPin_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The dialog to pin + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + /// Whether to pin or unpin the dialog + pinned = 0x1, + } + } /// Pin/unpin a dialog See Possible codes: 400 (details) /// Whether to pin or unpin the dialog /// The dialog to pin public static Task Messages_ToggleDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ToggleDialogPin_ { - writer.Write(0xA731E257); - writer.Write(pinned ? 0x1 : 0); - writer.WriteTLObject(peer); - return "Messages_ToggleDialogPin"; + flags = (Messages_ToggleDialogPin_.Flags)(pinned ? 0x1 : 0), + peer = peer, }); + /// Reorder pinned dialogs See + [TLDef(0x3B1ADF37)] + public partial class Messages_ReorderPinnedDialogs_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer folder ID, for more info click here + public int folder_id; + /// New dialog order + public InputDialogPeerBase[] order; + + [Flags] public enum Flags + { + /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + force = 0x1, + } + } /// 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 public static Task Messages_ReorderPinnedDialogs(this Client client, int folder_id, InputDialogPeerBase[] order, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReorderPinnedDialogs_ { - writer.Write(0x3B1ADF37); - writer.Write(force ? 0x1 : 0); - writer.Write(folder_id); - writer.WriteTLVector(order); - return "Messages_ReorderPinnedDialogs"; + flags = (Messages_ReorderPinnedDialogs_.Flags)(force ? 0x1 : 0), + folder_id = folder_id, + order = order, }); + /// Get pinned dialogs See + [TLDef(0xD6B94DF2)] + public partial class Messages_GetPinnedDialogs_ : ITLMethod + { + /// Peer folder ID, for more info click here + public int folder_id; + } /// Get pinned dialogs See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Messages_GetPinnedDialogs(this Client client, int folder_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPinnedDialogs_ { - writer.Write(0xD6B94DF2); - writer.Write(folder_id); - return "Messages_GetPinnedDialogs"; + folder_id = folder_id, }); + /// 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 + [TLDef(0xE5F672FA)] + public partial class Messages_SetBotShippingResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the query to be answered + public long query_id; + /// 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. + [IfFlag(0)] public string error; + /// A vector of available shipping options. + [IfFlag(1)] public ShippingOption[] shipping_options; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// Field has a value + has_shipping_options = 0x2, + } + } /// 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 [bots: ✓] 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. public static Task Messages_SetBotShippingResults(this Client client, long query_id, string error = null, ShippingOption[] shipping_options = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetBotShippingResults_ { - writer.Write(0xE5F672FA); - writer.Write((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)); - writer.Write(query_id); - if (error != null) - writer.WriteTLString(error); - if (shipping_options != null) - writer.WriteTLVector(shipping_options); - return "Messages_SetBotShippingResults"; + flags = (Messages_SetBotShippingResults_.Flags)((error != null ? 0x1 : 0) | (shipping_options != null ? 0x2 : 0)), + query_id = query_id, + error = error, + shipping_options = shipping_options, }); + /// 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
+ [TLDef(0x09C2DD95)] + public partial class Messages_SetBotPrecheckoutResults_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Unique identifier for the query to be answered + public long query_id; + /// 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. + [IfFlag(0)] public string error; + + [Flags] public enum Flags + { + /// Field has a value + has_error = 0x1, + /// 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 + success = 0x2, + } + } /// 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 [bots: ✓] 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. public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, bool success = false, string error = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetBotPrecheckoutResults_ { - writer.Write(0x09C2DD95); - writer.Write((success ? 0x2 : 0) | (error != null ? 0x1 : 0)); - writer.Write(query_id); - if (error != null) - writer.WriteTLString(error); - return "Messages_SetBotPrecheckoutResults"; + flags = (Messages_SetBotPrecheckoutResults_.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + query_id = query_id, + error = error, }); + /// Upload a file and associate it to a chat (without actually sending it to the chat) See + [TLDef(0x519BC2B1)] + public partial class Messages_UploadMedia_ : ITLMethod + { + /// The chat, can be an for bots + public InputPeer peer; + /// File uploaded in chunks as described in files » + public InputMedia media; + } /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] 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 public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadMedia_ { - writer.Write(0x519BC2B1); - writer.WriteTLObject(peer); - writer.WriteTLObject(media); - return "Messages_UploadMedia"; + peer = peer, + media = media, }); + /// Notify the other user in a private chat that a screenshot of the chat was taken See + [TLDef(0xC97DF020)] + public partial class Messages_SendScreenshotNotification_ : ITLMethod + { + /// Other user + public InputPeer peer; + /// ID of message that was screenshotted, can be 0 + public int reply_to_msg_id; + /// Random ID to avoid message resending + public long random_id; + } /// 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 public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendScreenshotNotification_ { - writer.Write(0xC97DF020); - writer.WriteTLObject(peer); - writer.Write(reply_to_msg_id); - writer.Write(random_id); - return "Messages_SendScreenshotNotification"; + peer = peer, + reply_to_msg_id = reply_to_msg_id, + random_id = random_id, }); + /// Get faved stickers See + [TLDef(0x04F1AAA9)] + public partial class Messages_GetFavedStickers_ : ITLMethod + { + /// Hash for pagination, for more info click here + public long hash; + } /// Get faved stickers See /// Hash for pagination, for more info click here /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetFavedStickers_ { - writer.Write(0x04F1AAA9); - writer.Write(hash); - return "Messages_GetFavedStickers"; + hash = hash, }); + /// Mark a sticker as favorite See + [TLDef(0xB9FFC55B)] + public partial class Messages_FaveSticker_ : ITLMethod + { + /// Sticker to mark as favorite + public InputDocument id; + /// Unfavorite + public bool unfave; + } /// Mark a sticker as favorite See Possible codes: 400 (details) /// Sticker to mark as favorite /// Unfavorite public static Task Messages_FaveSticker(this Client client, InputDocument id, bool unfave) - => client.CallAsync(writer => + => client.CallAsync(new Messages_FaveSticker_ { - writer.Write(0xB9FFC55B); - writer.WriteTLObject(id); - writer.Write(unfave ? 0x997275B5 : 0xBC799737); - return "Messages_FaveSticker"; + id = id, + unfave = unfave, }); + /// Get unread messages where we were mentioned See + [TLDef(0x46578472)] + public partial class Messages_GetUnreadMentions_ : ITLMethod + { + /// Peer where to look for mentions + public InputPeer peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public int add_offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Maximum message ID to return, see pagination + public int max_id; + /// Minimum message ID to return, see pagination + public int min_id; + } /// 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 @@ -14947,42 +16898,83 @@ namespace TL /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination 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 => + => client.CallAsync(new Messages_GetUnreadMentions_ { - writer.Write(0x46578472); - writer.WriteTLObject(peer); - writer.Write(offset_id); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - return "Messages_GetUnreadMentions"; + peer = peer, + offset_id = offset_id, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, }); + /// Mark mentions as read See + [TLDef(0x0F0189D3)] + public partial class Messages_ReadMentions_ : ITLMethod + { + /// Dialog + public InputPeer peer; + } /// Mark mentions as read See Possible codes: 400 (details) /// Dialog public static Task Messages_ReadMentions(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadMentions_ { - writer.Write(0x0F0189D3); - writer.WriteTLObject(peer); - return "Messages_ReadMentions"; + peer = peer, }); + /// Get live location history of a certain user See + [TLDef(0x702A40E0)] + public partial class Messages_GetRecentLocations_ : ITLMethod + { + /// User + public InputPeer peer; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + } /// Get live location history of a certain user See /// User /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetRecentLocations_ { - writer.Write(0x702A40E0); - writer.WriteTLObject(peer); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetRecentLocations"; + peer = peer, + limit = limit, + hash = hash, }); + /// Send an album or grouped media See + [TLDef(0xCC0110CB)] + public partial class Messages_SendMultiMedia_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The destination chat + public InputPeer peer; + /// The message to reply to + [IfFlag(0)] public int reply_to_msg_id; + /// The medias to send + public InputSingleMedia[] multi_media; + /// Scheduled message date for scheduled messages + [IfFlag(10)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_reply_to_msg_id = 0x1, + /// Whether to send the album silently (no notification triggered) + silent = 0x20, + /// Send in background? + background = 0x40, + /// Whether to clear drafts + clear_draft = 0x80, + /// Field has a value + has_schedule_date = 0x400, + } + } /// Send an album or grouped media See [bots: ✓] Possible codes: 400,420 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? @@ -14992,83 +16984,138 @@ namespace TL /// The medias to send /// Scheduled message date for scheduled messages 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 => + => client.CallAsync(new Messages_SendMultiMedia_ { - writer.Write(0xCC0110CB); - writer.Write((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)); - writer.WriteTLObject(peer); - if (reply_to_msg_id != null) - writer.Write(reply_to_msg_id.Value); - writer.WriteTLVector(multi_media); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Messages_SendMultiMedia"; + flags = (Messages_SendMultiMedia_.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0)), + peer = peer, + reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + multi_media = multi_media, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Upload encrypted file and associate it to a secret chat See + [TLDef(0x5057C497)] + public partial class Messages_UploadEncryptedFile_ : ITLMethod + { + /// The secret chat to associate the file to + public InputEncryptedChat peer; + /// The file + public InputEncryptedFileBase file; + } /// Upload encrypted file and associate it to a secret chat See /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty public static Task Messages_UploadEncryptedFile(this Client client, InputEncryptedChat peer, InputEncryptedFileBase file) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadEncryptedFile_ { - writer.Write(0x5057C497); - writer.WriteTLObject(peer); - writer.WriteTLObject(file); - return "Messages_UploadEncryptedFile"; + peer = peer, + file = file, }); + /// Search for stickersets See + [TLDef(0x35705B8A)] + public partial class Messages_SearchStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Query string + public string q; + /// Hash for pagination, for more info click here + public long hash; + + [Flags] public enum Flags + { + /// Exclude featured stickersets from results + exclude_featured = 0x1, + } + } /// Search for stickersets See /// Exclude featured stickersets from results /// Query string /// Hash for pagination, for more info click here /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchStickerSets(this Client client, string q, long hash, bool exclude_featured = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SearchStickerSets_ { - writer.Write(0x35705B8A); - writer.Write(exclude_featured ? 0x1 : 0); - writer.WriteTLString(q); - writer.Write(hash); - return "Messages_SearchStickerSets"; + flags = (Messages_SearchStickerSets_.Flags)(exclude_featured ? 0x1 : 0), + q = q, + hash = hash, }); + /// Get message ranges for saving the user's chat history See + [TLDef(0x1CFF7E08)] + public partial class Messages_GetSplitRanges_ : ITLMethod { } /// Get message ranges for saving the user's chat history See public static Task Messages_GetSplitRanges(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSplitRanges_ { - writer.Write(0x1CFF7E08); - return "Messages_GetSplitRanges"; }); + /// Manually mark dialog as unread See + [TLDef(0xC286D98F)] + public partial class Messages_MarkDialogUnread_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Dialog + public InputDialogPeerBase peer; + + [Flags] public enum Flags + { + /// Mark as unread/read + unread = 0x1, + } + } /// Manually mark dialog as unread See /// Mark as unread/read /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_MarkDialogUnread_ { - writer.Write(0xC286D98F); - writer.Write(unread ? 0x1 : 0); - writer.WriteTLObject(peer); - return "Messages_MarkDialogUnread"; + flags = (Messages_MarkDialogUnread_.Flags)(unread ? 0x1 : 0), + peer = peer, }); + /// Get dialogs manually marked as unread See + [TLDef(0x22E24E22)] + public partial class Messages_GetDialogUnreadMarks_ : ITLMethod { } /// Get dialogs manually marked as unread See public static Task Messages_GetDialogUnreadMarks(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDialogUnreadMarks_ { - writer.Write(0x22E24E22); - return "Messages_GetDialogUnreadMarks"; }); + /// Clear all drafts. See + [TLDef(0x7E58EE9C)] + public partial class Messages_ClearAllDrafts_ : ITLMethod { } /// Clear all drafts. See public static Task Messages_ClearAllDrafts(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ClearAllDrafts_ { - writer.Write(0x7E58EE9C); - return "Messages_ClearAllDrafts"; }); + /// Pin a message See + [TLDef(0xD2AAF7EC)] + public partial class Messages_UpdatePinnedMessage_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The peer where to pin the message + public InputPeer peer; + /// The message to pin or unpin + public int id; + + [Flags] public enum Flags + { + /// Pin the message silently, without triggering a notification + silent = 0x1, + /// Whether the message should unpinned or pinned + unpin = 0x2, + /// Whether the message should only be pinned on the local side of a one-to-one chat + pm_oneside = 0x4, + } + } /// Pin a message See [bots: ✓] Possible codes: 400,403 (details) /// Pin the message silently, without triggering a notification /// Whether the message should unpinned or pinned @@ -15076,150 +17123,254 @@ namespace TL /// The peer where to pin the message /// The message to pin or unpin 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 => + => client.CallAsync(new Messages_UpdatePinnedMessage_ { - writer.Write(0xD2AAF7EC); - writer.Write((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - return "Messages_UpdatePinnedMessage"; + flags = (Messages_UpdatePinnedMessage_.Flags)((silent ? 0x1 : 0) | (unpin ? 0x2 : 0) | (pm_oneside ? 0x4 : 0)), + peer = peer, + id = id, }); + /// Vote in a See + [TLDef(0x10EA6184)] + public partial class Messages_SendVote_ : ITLMethod + { + /// The chat where the poll was sent + public InputPeer peer; + /// The message ID of the poll + public int msg_id; + /// The options that were chosen + public byte[][] options; + } /// 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 public static Task Messages_SendVote(this Client client, InputPeer peer, int msg_id, byte[][] options) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendVote_ { - writer.Write(0x10EA6184); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.WriteTLVector(options); - return "Messages_SendVote"; + peer = peer, + msg_id = msg_id, + options = options, }); + /// Get poll results See + [TLDef(0x73BB643B)] + public partial class Messages_GetPollResults_ : ITLMethod + { + /// Peer where the poll was found + public InputPeer peer; + /// Message ID of poll message + public int msg_id; + } /// Get poll results See Possible codes: 400 (details) /// Peer where the poll was found /// Message ID of poll message public static Task Messages_GetPollResults(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPollResults_ { - writer.Write(0x73BB643B); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetPollResults"; + peer = peer, + msg_id = msg_id, }); + /// Get count of online users in a chat See + [TLDef(0x6E2BE050)] + public partial class Messages_GetOnlines_ : ITLMethod + { + /// The chat + public InputPeer peer; + } /// Get count of online users in a chat See Possible codes: 400 (details) /// The chat public static Task Messages_GetOnlines(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetOnlines_ { - writer.Write(0x6E2BE050); - writer.WriteTLObject(peer); - return "Messages_GetOnlines"; + peer = peer, }); + /// Edit the description of a group/supergroup/channel. See + [TLDef(0xDEF60797)] + public partial class Messages_EditChatAbout_ : ITLMethod + { + /// The group/supergroup/channel. + public InputPeer peer; + /// The new description + public string about; + } /// Edit the description of a group/supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The group/supergroup/channel. /// The new description public static Task Messages_EditChatAbout(this Client client, InputPeer peer, string about) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatAbout_ { - writer.Write(0xDEF60797); - writer.WriteTLObject(peer); - writer.WriteTLString(about); - return "Messages_EditChatAbout"; + peer = peer, + about = about, }); + /// Edit the default banned rights of a channel/supergroup/group. See + [TLDef(0xA5866B41)] + public partial class Messages_EditChatDefaultBannedRights_ : ITLMethod + { + /// The peer + public InputPeer peer; + /// The new global rights + public ChatBannedRights banned_rights; + } /// Edit the default banned rights of a channel/supergroup/group. See [bots: ✓] Possible codes: 400,403 (details) /// The peer /// The new global rights public static Task Messages_EditChatDefaultBannedRights(this Client client, InputPeer peer, ChatBannedRights banned_rights) - => client.CallAsync(writer => + => client.CallAsync(new Messages_EditChatDefaultBannedRights_ { - writer.Write(0xA5866B41); - writer.WriteTLObject(peer); - writer.WriteTLObject(banned_rights); - return "Messages_EditChatDefaultBannedRights"; + peer = peer, + banned_rights = banned_rights, }); + /// Get localized emoji keywords See + [TLDef(0x35A0E062)] + public partial class Messages_GetEmojiKeywords_ : ITLMethod + { + /// Language code + public string lang_code; + } /// Get localized emoji keywords See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywords_ { - writer.Write(0x35A0E062); - writer.WriteTLString(lang_code); - return "Messages_GetEmojiKeywords"; + lang_code = lang_code, }); + /// Get changed emoji keywords See + [TLDef(0x1508B6AF)] + public partial class Messages_GetEmojiKeywordsDifference_ : ITLMethod + { + /// Language code + public string lang_code; + /// Previous emoji keyword localization version + public int from_version; + } /// Get changed emoji keywords See /// Language code /// Previous emoji keyword localization version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywordsDifference_ { - writer.Write(0x1508B6AF); - writer.WriteTLString(lang_code); - writer.Write(from_version); - return "Messages_GetEmojiKeywordsDifference"; + lang_code = lang_code, + from_version = from_version, }); + /// Get info about an emoji keyword localization See + [TLDef(0x4E9963B2)] + public partial class Messages_GetEmojiKeywordsLanguages_ : ITLMethod + { + /// Language codes + public string[] lang_codes; + } /// Get info about an emoji keyword localization See /// Language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, string[] lang_codes) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiKeywordsLanguages_ { - writer.Write(0x4E9963B2); - writer.WriteTLVector(lang_codes); - return "Messages_GetEmojiKeywordsLanguages"; + lang_codes = lang_codes, }); + /// Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation See + [TLDef(0xD5B10C26)] + public partial class Messages_GetEmojiURL_ : ITLMethod + { + /// Language code for which the emoji replacements will be suggested + public string lang_code; + } /// Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation See /// Language code for which the emoji replacements will be suggested public static Task Messages_GetEmojiURL(this Client client, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetEmojiURL_ { - writer.Write(0xD5B10C26); - writer.WriteTLString(lang_code); - return "Messages_GetEmojiURL"; + lang_code = lang_code, }); + /// Get the number of results that would be found by a messages.search call with the same parameters See + [TLDef(0x732EEF00)] + public partial class Messages_GetSearchCounters_ : ITLMethod + { + /// Peer where to search + public InputPeer peer; + /// Search filters + public MessagesFilter[] filters; + } /// 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 public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchCounters_ { - writer.Write(0x732EEF00); - writer.WriteTLObject(peer); - writer.WriteTLVector(filters); - return "Messages_GetSearchCounters"; + peer = peer, + filters = filters, }); + /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See + [TLDef(0x198FB446)] + public partial class Messages_RequestUrlAuth_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer where the message is located + [IfFlag(1)] public InputPeer peer; + /// The message + [IfFlag(1)] public int msg_id; + /// The ID of the button with the authorization request + [IfFlag(1)] public int button_id; + /// URL used for link URL authorization, click here for more info » + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Get more info about a Seamless Telegram Login authorization request, for more info click here » See /// Peer where the message is located /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_RequestUrlAuth_ { - writer.Write(0x198FB446); - writer.Write((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - if (msg_id != null) - writer.Write(msg_id.Value); - if (button_id != null) - writer.Write(button_id.Value); - if (url != null) - writer.WriteTLString(url); - return "Messages_RequestUrlAuth"; + flags = (Messages_RequestUrlAuth_.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + url = url, }); + /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See + [TLDef(0xB12C7125)] + public partial class Messages_AcceptUrlAuth_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The location of the message + [IfFlag(1)] public InputPeer peer; + /// Message ID of the message with the login button + [IfFlag(1)] public int msg_id; + /// ID of the login button + [IfFlag(1)] public int button_id; + /// URL used for link URL authorization, click here for more info » + [IfFlag(2)] public string url; + + [Flags] public enum Flags + { + /// Set this flag to allow the bot to send messages to you (if requested) + write_allowed = 0x1, + /// Field has a value + has_peer = 0x2, + /// Field has a value + has_url = 0x4, + } + } /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See /// Set this flag to allow the bot to send messages to you (if requested) /// The location of the message @@ -15227,79 +17378,131 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » public static Task Messages_AcceptUrlAuth(this Client client, bool write_allowed = false, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_AcceptUrlAuth_ { - writer.Write(0xB12C7125); - writer.Write((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)); - if (peer != null) - writer.WriteTLObject(peer); - if (msg_id != null) - writer.Write(msg_id.Value); - if (button_id != null) - writer.Write(button_id.Value); - if (url != null) - writer.WriteTLString(url); - return "Messages_AcceptUrlAuth"; + flags = (Messages_AcceptUrlAuth_.Flags)((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), + peer = peer, + msg_id = msg_id.GetValueOrDefault(), + button_id = button_id.GetValueOrDefault(), + url = url, }); + /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the . See + [TLDef(0x4FACB138)] + public partial class Messages_HidePeerSettingsBar_ : ITLMethod + { + /// Peer + public InputPeer peer; + } /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the . See /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_HidePeerSettingsBar_ { - writer.Write(0x4FACB138); - writer.WriteTLObject(peer); - return "Messages_HidePeerSettingsBar"; + peer = peer, }); + /// Get scheduled messages See + [TLDef(0xF516760B)] + public partial class Messages_GetScheduledHistory_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Hash for pagination, for more info click here + public long hash; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// Hash for pagination, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetScheduledHistory_ { - writer.Write(0xF516760B); - writer.WriteTLObject(peer); - writer.Write(hash); - return "Messages_GetScheduledHistory"; + peer = peer, + hash = hash, }); + /// Get scheduled messages See + [TLDef(0xBDBB0464)] + public partial class Messages_GetScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// IDs of scheduled messages + public int[] id; + } /// Get scheduled messages See Possible codes: 400 (details) /// Peer /// IDs of scheduled messages public static Task Messages_GetScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetScheduledMessages_ { - writer.Write(0xBDBB0464); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_GetScheduledMessages"; + peer = peer, + id = id, }); + /// Send scheduled messages right away See + [TLDef(0xBD38850A)] + public partial class Messages_SendScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Scheduled message IDs + public int[] id; + } /// Send scheduled messages right away See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SendScheduledMessages_ { - writer.Write(0xBD38850A); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_SendScheduledMessages"; + peer = peer, + id = id, }); + /// Delete scheduled messages See + [TLDef(0x59AE2B16)] + public partial class Messages_DeleteScheduledMessages_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Scheduled message IDs + public int[] id; + } /// Delete scheduled messages See /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteScheduledMessages_ { - writer.Write(0x59AE2B16); - writer.WriteTLObject(peer); - writer.WriteTLVector(id); - return "Messages_DeleteScheduledMessages"; + peer = peer, + id = id, }); + /// Get poll results for non-anonymous polls See + [TLDef(0xB86E380E)] + public partial class Messages_GetPollVotes_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat where the poll was sent + public InputPeer peer; + /// Message ID + public int id; + /// Get only results for the specified poll option + [IfFlag(0)] public byte[] 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.
+ [IfFlag(1)] public string offset; + /// Number of results to return + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_option = 0x1, + /// Field has a value + has_offset = 0x2, + } + } /// Get poll results for non-anonymous polls See Possible codes: 400,403 (details) /// Chat where the poll was sent /// Message ID @@ -15307,88 +17510,154 @@ namespace TL /// 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 public static Task Messages_GetPollVotes(this Client client, InputPeer peer, int id, int limit, byte[] option = null, string offset = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetPollVotes_ { - writer.Write(0xB86E380E); - writer.Write((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(id); - if (option != null) - writer.WriteTLBytes(option); - if (offset != null) - writer.WriteTLString(offset); - writer.Write(limit); - return "Messages_GetPollVotes"; + flags = (Messages_GetPollVotes_.Flags)((option != null ? 0x1 : 0) | (offset != null ? 0x2 : 0)), + peer = peer, + id = id, + option = option, + offset = offset, + limit = limit, }); + /// Apply changes to multiple stickersets See + [TLDef(0xB5052FEA)] + public partial class Messages_ToggleStickerSets_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Stickersets to act upon + public InputStickerSet[] stickersets; + + [Flags] public enum Flags + { + /// Uninstall the specified stickersets + uninstall = 0x1, + /// Archive the specified stickersets + archive = 0x2, + /// Unarchive the specified stickersets + unarchive = 0x4, + } + } /// Apply changes to multiple stickersets See /// Uninstall the specified stickersets /// Archive the specified stickersets /// Unarchive the specified stickersets /// Stickersets to act upon public static Task Messages_ToggleStickerSets(this Client client, InputStickerSet[] stickersets, bool uninstall = false, bool archive = false, bool unarchive = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ToggleStickerSets_ { - writer.Write(0xB5052FEA); - writer.Write((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)); - writer.WriteTLVector(stickersets); - return "Messages_ToggleStickerSets"; + flags = (Messages_ToggleStickerSets_.Flags)((uninstall ? 0x1 : 0) | (archive ? 0x2 : 0) | (unarchive ? 0x4 : 0)), + stickersets = stickersets, }); + /// Get folders See + [TLDef(0xF19ED96D)] + public partial class Messages_GetDialogFilters_ : ITLMethod { } /// Get folders See public static Task Messages_GetDialogFilters(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDialogFilters_ { - writer.Write(0xF19ED96D); - return "Messages_GetDialogFilters"; }); + /// Get suggested folders See + [TLDef(0xA29CD42C)] + public partial class Messages_GetSuggestedDialogFilters_ : ITLMethod { } /// Get suggested folders See public static Task Messages_GetSuggestedDialogFilters(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSuggestedDialogFilters_ { - writer.Write(0xA29CD42C); - return "Messages_GetSuggestedDialogFilters"; }); + /// Update folder See + [TLDef(0x1AD4A04A)] + public partial class Messages_UpdateDialogFilter_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Folder ID + public int id; + /// Folder info + [IfFlag(0)] public DialogFilter filter; + + [Flags] public enum Flags + { + /// Field has a value + has_filter = 0x1, + } + } /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UpdateDialogFilter_ { - writer.Write(0x1AD4A04A); - writer.Write(filter != null ? 0x1 : 0); - writer.Write(id); - if (filter != null) - writer.WriteTLObject(filter); - return "Messages_UpdateDialogFilter"; + flags = (Messages_UpdateDialogFilter_.Flags)(filter != null ? 0x1 : 0), + id = id, + filter = filter, }); + /// Reorder folders See + [TLDef(0xC563C1E4)] + public partial class Messages_UpdateDialogFiltersOrder_ : ITLMethod + { + /// New folder order + public int[] order; + } /// Reorder folders See /// New folder order public static Task Messages_UpdateDialogFiltersOrder(this Client client, int[] order) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UpdateDialogFiltersOrder_ { - writer.Write(0xC563C1E4); - writer.WriteTLVector(order); - return "Messages_UpdateDialogFiltersOrder"; + order = order, }); + /// Method for fetching previously featured stickers See + [TLDef(0x7ED094A1)] + public partial class Messages_GetOldFeaturedStickers_ : ITLMethod + { + /// Offset + public int offset; + /// Maximum number of results to return, see pagination + public int limit; + /// Hash for pagination, for more info click here + public long hash; + } /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination /// Hash for pagination, for more info click here public static Task Messages_GetOldFeaturedStickers(this Client client, int offset, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetOldFeaturedStickers_ { - writer.Write(0x7ED094A1); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "Messages_GetOldFeaturedStickers"; + offset = offset, + limit = limit, + hash = hash, }); + /// Get messages in a reply thread See + [TLDef(0x22DDD30C)] + public partial class Messages_GetReplies_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Message ID + public int msg_id; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// Offsets for pagination, for more info click here + public int add_offset; + /// Maximum number of results to return, see pagination + public int limit; + /// If a positive value was transferred, the method will return only messages with ID smaller than max_id + public int max_id; + /// If a positive value was transferred, the method will return only messages with ID bigger than min_id + public int min_id; + /// Hash for pagination, for more info click here + public long hash; + } /// Get messages in a reply thread See Possible codes: 400 (details) /// Peer /// Message ID @@ -15400,101 +17669,163 @@ namespace TL /// 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 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 => + => client.CallAsync(new Messages_GetReplies_ { - writer.Write(0x22DDD30C); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - writer.Write(add_offset); - writer.Write(limit); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(hash); - return "Messages_GetReplies"; + peer = peer, + msg_id = msg_id, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, }); + /// 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 + [TLDef(0x446972FD)] + public partial class Messages_GetDiscussionMessage_ : ITLMethod + { + /// Channel ID + public InputPeer peer; + /// Message ID + public int msg_id; + } /// 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 public static Task Messages_GetDiscussionMessage(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetDiscussionMessage_ { - writer.Write(0x446972FD); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetDiscussionMessage"; + peer = peer, + msg_id = msg_id, }); + /// Mark a thread as read See + [TLDef(0xF731A9F4)] + public partial class Messages_ReadDiscussion_ : ITLMethod + { + /// Group ID + public InputPeer peer; + /// ID of message that started the thread + public int msg_id; + /// ID up to which thread messages were read + public int read_max_id; + } /// 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 public static Task Messages_ReadDiscussion(this Client client, InputPeer peer, int msg_id, int read_max_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_ReadDiscussion_ { - writer.Write(0xF731A9F4); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.Write(read_max_id); - return "Messages_ReadDiscussion"; + peer = peer, + msg_id = msg_id, + read_max_id = read_max_id, }); + /// Unpin all pinned messages See + [TLDef(0xF025BC8B)] + public partial class Messages_UnpinAllMessages_ : ITLMethod + { + /// Chat where to unpin + public InputPeer peer; + } /// Unpin all pinned messages See [bots: ✓] /// Chat where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UnpinAllMessages_ { - writer.Write(0xF025BC8B); - writer.WriteTLObject(peer); - return "Messages_UnpinAllMessages"; + peer = peer, }); + /// Delete a chat See + [TLDef(0x5BD0EE50)] + public partial class Messages_DeleteChat_ : ITLMethod + { + /// Chat ID + public long chat_id; + } /// Delete a chat See Possible codes: 400 (details) /// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteChat_ { - writer.Write(0x5BD0EE50); - writer.Write(chat_id); - return "Messages_DeleteChat"; + chat_id = chat_id, }); + /// Delete the entire phone call history. See + [TLDef(0xF9CBE409)] + public partial class Messages_DeletePhoneCallHistory_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Whether to remove phone call history for participants as well + revoke = 0x1, + } + } /// Delete the entire phone call history. See /// Whether to remove phone call history for participants as well public static Task Messages_DeletePhoneCallHistory(this Client client, bool revoke = false) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeletePhoneCallHistory_ { - writer.Write(0xF9CBE409); - writer.Write(revoke ? 0x1 : 0); - return "Messages_DeletePhoneCallHistory"; + flags = (Messages_DeletePhoneCallHistory_.Flags)(revoke ? 0x1 : 0), }); + /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See + [TLDef(0x43FE19F3)] + public partial class Messages_CheckHistoryImport_ : ITLMethod + { + /// Beginning of the message file; up to 100 lines. + public string import_head; + } /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See /// Beginning of the message file; up to 100 lines. public static Task Messages_CheckHistoryImport(this Client client, string import_head) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckHistoryImport_ { - writer.Write(0x43FE19F3); - writer.WriteTLString(import_head); - return "Messages_CheckHistoryImport"; + import_head = import_head, }); + /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See + [TLDef(0x34090C3B)] + public partial class Messages_InitHistoryImport_ : ITLMethod + { + /// The Telegram chat where the history should be imported. + public InputPeer peer; + /// File with messages to import. + public InputFileBase file; + /// Number of media files associated with the chat that will be uploaded using messages.uploadImportedMedia. + public int media_count; + } /// 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. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) - => client.CallAsync(writer => + => client.CallAsync(new Messages_InitHistoryImport_ { - writer.Write(0x34090C3B); - writer.WriteTLObject(peer); - writer.WriteTLObject(file); - writer.Write(media_count); - return "Messages_InitHistoryImport"; + peer = peer, + file = file, + media_count = media_count, }); + /// Upload a media file associated with an imported chat, click here for more info ». See + [TLDef(0x2A862092)] + public partial class Messages_UploadImportedMedia_ : ITLMethod + { + /// The Telegram chat where the media will be imported + public InputPeer peer; + /// Identifier of a history import session, returned by messages.initHistoryImport + public long import_id; + /// File name + public string file_name; + /// Media metadata + public InputMedia media; + } /// Upload a media file associated with an imported chat, click here for more info ». See /// The Telegram chat where the media will be imported /// Identifier of a history import session, returned by messages.initHistoryImport @@ -15502,28 +17833,58 @@ namespace TL /// Media metadata /// a null value means messageMediaEmpty public static Task Messages_UploadImportedMedia(this Client client, InputPeer peer, long import_id, string file_name, InputMedia media) - => client.CallAsync(writer => + => client.CallAsync(new Messages_UploadImportedMedia_ { - writer.Write(0x2A862092); - writer.WriteTLObject(peer); - writer.Write(import_id); - writer.WriteTLString(file_name); - writer.WriteTLObject(media); - return "Messages_UploadImportedMedia"; + peer = peer, + import_id = import_id, + file_name = file_name, + media = media, }); + /// 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
+ [TLDef(0xB43DF344)] + public partial class Messages_StartHistoryImport_ : ITLMethod + { + /// The Telegram chat where the messages should be imported, click here for more info » + public InputPeer peer; + /// Identifier of a history import session, returned by messages.initHistoryImport. + public long import_id; + } /// 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. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_StartHistoryImport_ { - writer.Write(0xB43DF344); - writer.WriteTLObject(peer); - writer.Write(import_id); - return "Messages_StartHistoryImport"; + peer = peer, + import_id = import_id, }); + /// Get info about the chat invites of a specific chat See + [TLDef(0xA2B5A3F6)] + public partial class Messages_GetExportedChatInvites_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Whether to only fetch chat invites from this admin + public InputUserBase admin_id; + /// Offsets for pagination, for more info click here + [IfFlag(2)] public DateTime offset_date; + /// Offsets for pagination, for more info click here + [IfFlag(2)] public string offset_link; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_offset_date = 0x4, + /// Whether to fetch revoked chat invites + revoked = 0x8, + } + } /// Get info about the chat invites of a specific chat See /// Whether to fetch revoked chat invites /// Chat @@ -15532,32 +17893,66 @@ namespace TL /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id, int limit, bool revoked = false, DateTime? offset_date = null, string offset_link = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetExportedChatInvites_ { - writer.Write(0xA2B5A3F6); - writer.Write((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLObject(admin_id); - if (offset_date != null) - writer.WriteTLStamp(offset_date.Value); - if (offset_link != null) - writer.WriteTLString(offset_link); - writer.Write(limit); - return "Messages_GetExportedChatInvites"; + flags = (Messages_GetExportedChatInvites_.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + peer = peer, + admin_id = admin_id, + offset_date = offset_date.GetValueOrDefault(), + offset_link = offset_link, + limit = limit, }); + /// Get info about a chat invite See + [TLDef(0x73746F5C)] + public partial class Messages_GetExportedChatInvite_ : ITLMethod + { + /// Chat + public InputPeer peer; + /// Invite link + public string link; + } /// Get info about a chat invite See /// Chat /// Invite link public static Task Messages_GetExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetExportedChatInvite_ { - writer.Write(0x73746F5C); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - return "Messages_GetExportedChatInvite"; + peer = peer, + link = link, }); + /// Edit an exported chat invite See + [TLDef(0xBDCA2F75)] + public partial class Messages_EditExportedChatInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Chat + public InputPeer peer; + /// Invite link + public string link; + /// New expiration date + [IfFlag(0)] public DateTime expire_date; + /// Maximum number of users that can join using this link + [IfFlag(1)] public int usage_limit; + [IfFlag(3)] public bool request_needed; + [IfFlag(4)] public string title; + + [Flags] public enum Flags + { + /// Field has a value + has_expire_date = 0x1, + /// Field has a value + has_usage_limit = 0x2, + /// Whether to revoke the chat invite + revoked = 0x4, + /// Field has a value + has_request_needed = 0x8, + /// Field has a value + has_title = 0x10, + } + } /// Edit an exported chat invite See [bots: ✓] Possible codes: 400 (details) /// Whether to revoke the chat invite /// Chat @@ -15565,57 +17960,96 @@ namespace TL /// New expiration date /// Maximum number of users that can join using this link 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 => + => client.CallAsync(new Messages_EditExportedChatInvite_ { - writer.Write(0xBDCA2F75); - writer.Write((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - if (expire_date != null) - writer.WriteTLStamp(expire_date.Value); - if (usage_limit != null) - writer.Write(usage_limit.Value); - if (request_needed != default) - writer.Write(request_needed.Value ? 0x997275B5 : 0xBC799737); - if (title != null) - writer.WriteTLString(title); - return "Messages_EditExportedChatInvite"; + flags = (Messages_EditExportedChatInvite_.Flags)((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)), + peer = peer, + link = link, + expire_date = expire_date.GetValueOrDefault(), + usage_limit = usage_limit.GetValueOrDefault(), + request_needed = request_needed.GetValueOrDefault(), + title = title, }); + /// Delete all revoked chat invites See + [TLDef(0x56987BD5)] + public partial class Messages_DeleteRevokedExportedChatInvites_ : ITLMethod + { + /// Chat + public InputPeer peer; + /// ID of the admin that originally generated the revoked chat invites + public InputUserBase admin_id; + } /// Delete all revoked chat invites See /// Chat /// ID of the admin that originally generated the revoked chat invites public static Task Messages_DeleteRevokedExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteRevokedExportedChatInvites_ { - writer.Write(0x56987BD5); - writer.WriteTLObject(peer); - writer.WriteTLObject(admin_id); - return "Messages_DeleteRevokedExportedChatInvites"; + peer = peer, + admin_id = admin_id, }); + /// Delete a chat invite See + [TLDef(0xD464A42B)] + public partial class Messages_DeleteExportedChatInvite_ : ITLMethod + { + /// Peer + public InputPeer peer; + /// Invite link + public string link; + } /// Delete a chat invite See /// Peer /// Invite link public static Task Messages_DeleteExportedChatInvite(this Client client, InputPeer peer, string link) - => client.CallAsync(writer => + => client.CallAsync(new Messages_DeleteExportedChatInvite_ { - writer.Write(0xD464A42B); - writer.WriteTLObject(peer); - writer.WriteTLString(link); - return "Messages_DeleteExportedChatInvite"; + peer = peer, + link = link, }); + /// Get info about chat invites generated by admins. See + [TLDef(0x3920E6EF)] + public partial class Messages_GetAdminsWithInvites_ : ITLMethod + { + /// Chat + public InputPeer peer; + } /// Get info about chat invites generated by admins. See /// Chat public static Task Messages_GetAdminsWithInvites(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetAdminsWithInvites_ { - writer.Write(0x3920E6EF); - writer.WriteTLObject(peer); - return "Messages_GetAdminsWithInvites"; + peer = peer, }); + /// Get info about the users that joined the chat using a specific chat invite See + [TLDef(0xDF04DD4E)] + public partial class Messages_GetChatInviteImporters_ : ITLMethod + { + public Flags flags; + /// Chat + public InputPeer peer; + /// Invite link + [IfFlag(1)] public string link; + [IfFlag(2)] public string q; + /// Offsets for pagination, for more info click here + public DateTime offset_date; + /// User ID for pagination + public InputUserBase offset_user; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + requested = 0x1, + /// Field has a value + has_link = 0x2, + /// Field has a value + has_q = 0x4, + } + } /// Get info about the users that joined the chat using a specific chat invite See /// Chat /// Invite link @@ -15623,128 +18057,215 @@ namespace TL /// User ID for pagination /// Maximum number of results to return, see pagination public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date, InputUserBase offset_user, int limit, bool requested = false, string link = null, string q = null) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetChatInviteImporters_ { - writer.Write(0xDF04DD4E); - writer.Write((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)); - writer.WriteTLObject(peer); - if (link != null) - writer.WriteTLString(link); - if (q != null) - writer.WriteTLString(q); - writer.WriteTLStamp(offset_date); - writer.WriteTLObject(offset_user); - writer.Write(limit); - return "Messages_GetChatInviteImporters"; + flags = (Messages_GetChatInviteImporters_.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + peer = peer, + link = link, + q = q, + offset_date = offset_date, + offset_user = offset_user, + limit = limit, }); + /// Set maximum Time-To-Live of all messages in the specified chat See + [TLDef(0xB80E5FE4)] + public partial class Messages_SetHistoryTTL_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// Automatically delete all messages sent in the chat after this many seconds + public int period; + } /// 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 public static Task Messages_SetHistoryTTL(this Client client, InputPeer peer, int period) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetHistoryTTL_ { - writer.Write(0xB80E5FE4); - writer.WriteTLObject(peer); - writer.Write(period); - return "Messages_SetHistoryTTL"; + peer = peer, + period = period, }); + /// Check whether chat history exported from another chat app can be imported into a specific Telegram chat, click here for more info ». See + [TLDef(0x5DC60F03)] + public partial class Messages_CheckHistoryImportPeer_ : ITLMethod + { + /// The chat where we want to import history ». + public InputPeer peer; + } /// 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 ». public static Task Messages_CheckHistoryImportPeer(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Messages_CheckHistoryImportPeer_ { - writer.Write(0x5DC60F03); - writer.WriteTLObject(peer); - return "Messages_CheckHistoryImportPeer"; + peer = peer, }); + /// Change the chat theme of a certain chat See + [TLDef(0xE63BE13F)] + public partial class Messages_SetChatTheme_ : ITLMethod + { + /// Private chat where to change theme + public InputPeer peer; + /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes + public string emoticon; + } /// 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 public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) - => client.CallAsync(writer => + => client.CallAsync(new Messages_SetChatTheme_ { - writer.Write(0xE63BE13F); - writer.WriteTLObject(peer); - writer.WriteTLString(emoticon); - return "Messages_SetChatTheme"; + peer = peer, + emoticon = emoticon, }); + /// 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 + [TLDef(0x2C6F97B7)] + public partial class Messages_GetMessageReadParticipants_ : ITLMethod + { + /// Dialog + public InputPeer peer; + /// Message ID + public int msg_id; + } /// 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 public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetMessageReadParticipants_ { - writer.Write(0x2C6F97B7); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Messages_GetMessageReadParticipants"; + peer = peer, + msg_id = msg_id, }); + /// See + [TLDef(0x49F0BDE9)] + public partial class Messages_GetSearchResultsCalendar_ : ITLMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public DateTime offset_date; + } /// See public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, DateTime offset_date) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchResultsCalendar_ { - writer.Write(0x49F0BDE9); - writer.WriteTLObject(peer); - writer.WriteTLObject(filter); - writer.Write(offset_id); - writer.WriteTLStamp(offset_date); - return "Messages_GetSearchResultsCalendar"; + peer = peer, + filter = filter, + offset_id = offset_id, + offset_date = offset_date, }); + /// See + [TLDef(0x6E9583A3)] + public partial class Messages_GetSearchResultsPositions_ : ITLMethod + { + public InputPeer peer; + public MessagesFilter filter; + public int offset_id; + public int limit; + } /// See public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter, int offset_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Messages_GetSearchResultsPositions_ { - writer.Write(0x6E9583A3); - writer.WriteTLObject(peer); - writer.WriteTLObject(filter); - writer.Write(offset_id); - writer.Write(limit); - return "Messages_GetSearchResultsPositions"; + peer = peer, + filter = filter, + offset_id = offset_id, + limit = limit, }); /// See - public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) - => client.CallAsync(writer => + [TLDef(0x7FE7E815)] + public partial class Messages_HideChatJoinRequest_ : ITLMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase user_id; + + [Flags] public enum Flags { - writer.Write(0x7FE7E815); - writer.Write(approved ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.WriteTLObject(user_id); - return "Messages_HideChatJoinRequest"; + approved = 0x1, + } + } + /// See + public static Task Messages_HideChatJoinRequest(this Client client, InputPeer peer, InputUserBase user_id, bool approved = false) + => client.CallAsync(new Messages_HideChatJoinRequest_ + { + flags = (Messages_HideChatJoinRequest_.Flags)(approved ? 0x1 : 0), + peer = peer, + user_id = user_id, }); + /// Returns a current state of updates. See + [TLDef(0xEDD4882A)] + public partial class Updates_GetState_ : ITLMethod { } /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetState_ { - writer.Write(0xEDD4882A); - return "Updates_GetState"; }); + /// Get new updates. See + [TLDef(0x25939651)] + public partial class Updates_GetDifference_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// PTS, see updates. + public int pts; + /// 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
+ [IfFlag(0)] public int pts_total_limit; + /// date, see updates. + public DateTime date; + /// QTS, see updates. + public int qts; + + [Flags] public enum Flags + { + /// Field has a value + has_pts_total_limit = 0x1, + } + } /// Get new updates. See [bots: ✓] 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. public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetDifference_ { - writer.Write(0x25939651); - writer.Write(pts_total_limit != null ? 0x1 : 0); - writer.Write(pts); - if (pts_total_limit != null) - writer.Write(pts_total_limit.Value); - writer.WriteTLStamp(date); - writer.Write(qts); - return "Updates_GetDifference"; + flags = (Updates_GetDifference_.Flags)(pts_total_limit != null ? 0x1 : 0), + pts = pts, + pts_total_limit = pts_total_limit.GetValueOrDefault(), + date = date, + qts = qts, }); + /// Returns the difference between the current state of updates of a certain channel and transmitted. See + [TLDef(0x03173D78)] + public partial class Updates_GetChannelDifference_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The channel + public InputChannelBase channel; + /// Messsage filter + public ChannelMessagesFilter filter; + /// Persistent timestamp (see updates) + public int pts; + /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100
+ public int limit; + + [Flags] public enum Flags + { + /// Set to true to skip some possibly unneeded updates and reduce server-side load + force = 0x1, + } + } /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel @@ -15752,85 +18273,152 @@ namespace TL /// Persistent timestamp (see updates) /// How many updates to fetch, max 100000
Ordinary (non-bot) users are supposed to pass 10-100 public static Task Updates_GetChannelDifference(this Client client, InputChannelBase channel, ChannelMessagesFilter filter, int pts, int limit, bool force = false) - => client.CallAsync(writer => + => client.CallAsync(new Updates_GetChannelDifference_ { - writer.Write(0x03173D78); - writer.Write(force ? 0x1 : 0); - writer.WriteTLObject(channel); - writer.WriteTLObject(filter); - writer.Write(pts); - writer.Write(limit); - return "Updates_GetChannelDifference"; + flags = (Updates_GetChannelDifference_.Flags)(force ? 0x1 : 0), + channel = channel, + filter = filter, + pts = pts, + limit = limit, }); + /// Installs a previously uploaded photo as a profile photo. See + [TLDef(0x72D4742C)] + public partial class Photos_UpdateProfilePhoto_ : ITLMethod + { + /// Input photo + public InputPhoto id; + } /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) /// Input photo public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) - => client.CallAsync(writer => + => client.CallAsync(new Photos_UpdateProfilePhoto_ { - writer.Write(0x72D4742C); - writer.WriteTLObject(id); - return "Photos_UpdateProfilePhoto"; + id = id, }); + /// Updates current user profile photo. See + [TLDef(0x89F30F69)] + public partial class Photos_UploadProfilePhoto_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// File saved in parts by means of upload.saveFilePart method + [IfFlag(0)] public InputFileBase file; + /// Animated profile picture video + [IfFlag(1)] public InputFileBase video; + /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. + [IfFlag(2)] public double video_start_ts; + + [Flags] public enum Flags + { + /// Field has a value + has_file = 0x1, + /// Field has a value + has_video = 0x2, + /// Field has a value + has_video_start_ts = 0x4, + } + } /// 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. public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) - => client.CallAsync(writer => + => client.CallAsync(new Photos_UploadProfilePhoto_ { - writer.Write(0x89F30F69); - writer.Write((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)); - if (file != null) - writer.WriteTLObject(file); - if (video != null) - writer.WriteTLObject(video); - if (video_start_ts != null) - writer.Write(video_start_ts.Value); - return "Photos_UploadProfilePhoto"; + flags = (Photos_UploadProfilePhoto_.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), + file = file, + video = video, + video_start_ts = video_start_ts.GetValueOrDefault(), }); + /// Deletes profile photos. See + [TLDef(0x87CF7F2F)] + public partial class Photos_DeletePhotos_ : ITLMethod + { + /// Input photos to delete + public InputPhoto[] id; + } /// Deletes profile photos. See /// Input photos to delete public static Task Photos_DeletePhotos(this Client client, InputPhoto[] id) - => client.CallAsync(writer => + => client.CallAsync(new Photos_DeletePhotos_ { - writer.Write(0x87CF7F2F); - writer.WriteTLVector(id); - return "Photos_DeletePhotos"; + id = id, }); + /// Returns the list of user photos. See + [TLDef(0x91CD32A8)] + public partial class Photos_GetUserPhotos_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + /// Number of list elements to be skipped + public int offset; + /// If a positive value was transferred, the method will return only photos with IDs less than the set one + public long max_id; + /// Number of list elements to be returned + public int limit; + } /// Returns the list of user photos. See [bots: ✓] 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 public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset, long max_id, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Photos_GetUserPhotos_ { - writer.Write(0x91CD32A8); - writer.WriteTLObject(user_id); - writer.Write(offset); - writer.Write(max_id); - writer.Write(limit); - return "Photos_GetUserPhotos"; + user_id = user_id, + offset = offset, + max_id = max_id, + limit = limit, }); + /// Saves a part of file for futher sending to one of the methods. See + [TLDef(0xB304A621)] + public partial class Upload_SaveFilePart_ : ITLMethod + { + /// Random file identifier created by the client + public long file_id; + /// Numerical order of a part + public int file_part; + /// Binary data, contend of a part + public byte[] bytes; + } /// Saves a part of file for futher sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part /// Binary data, contend of a part public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Upload_SaveFilePart_ { - writer.Write(0xB304A621); - writer.Write(file_id); - writer.Write(file_part); - writer.WriteTLBytes(bytes); - return "Upload_SaveFilePart"; + file_id = file_id, + file_part = file_part, + bytes = bytes, }); + /// Returns content of a whole file or its part. See + [TLDef(0xB15A9AFC)] + public partial class Upload_GetFile_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// File location + public InputFileLocationBase location; + /// Number of bytes to be skipped + public int offset; + /// Number of bytes to be returned + public int limit; + + [Flags] public enum Flags + { + /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes + precise = 0x1, + /// Whether the current client supports CDN downloads + cdn_supported = 0x2, + } + } /// Returns content of a whole file or its part. See [bots: ✓] 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 @@ -15838,376 +18426,560 @@ namespace TL /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetFile(this Client client, InputFileLocationBase location, int offset, int limit, bool precise = false, bool cdn_supported = false) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetFile_ { - writer.Write(0xB15A9AFC); - writer.Write((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)); - writer.WriteTLObject(location); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetFile"; + flags = (Upload_GetFile_.Flags)((precise ? 0x1 : 0) | (cdn_supported ? 0x2 : 0)), + location = location, + offset = offset, + limit = limit, }); + /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See + [TLDef(0xDE7B673D)] + public partial class Upload_SaveBigFilePart_ : ITLMethod + { + /// Random file id, created by the client + public long file_id; + /// Part sequence number + public int file_part; + /// Total number of parts + public int file_total_parts; + /// Binary data, part contents + public byte[] bytes; + } /// Saves a part of a large file (over 10Mb in size) to be later passed to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file id, created by the client /// Part sequence number /// Total number of parts /// Binary data, part contents public static Task Upload_SaveBigFilePart(this Client client, long file_id, int file_part, int file_total_parts, byte[] bytes) - => client.CallAsync(writer => + => client.CallAsync(new Upload_SaveBigFilePart_ { - writer.Write(0xDE7B673D); - writer.Write(file_id); - writer.Write(file_part); - writer.Write(file_total_parts); - writer.WriteTLBytes(bytes); - return "Upload_SaveBigFilePart"; + file_id = file_id, + file_part = file_part, + file_total_parts = file_total_parts, + bytes = bytes, }); + /// See + [TLDef(0x24E6818D)] + public partial class Upload_GetWebFile_ : ITLMethod + { + /// The file to download + public InputWebFileLocationBase location; + /// Number of bytes to be skipped + public int offset; + /// Number of bytes to be returned + public int limit; + } /// See Possible codes: 400 (details) /// The file to download /// Number of bytes to be skipped /// Number of bytes to be returned public static Task Upload_GetWebFile(this Client client, InputWebFileLocationBase location, int offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetWebFile_ { - writer.Write(0x24E6818D); - writer.WriteTLObject(location); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetWebFile"; + location = location, + offset = offset, + limit = limit, }); + /// Download a CDN file. See + [TLDef(0x2000BCC3)] + public partial class Upload_GetCdnFile_ : ITLMethod + { + /// File token + public byte[] file_token; + /// Offset of chunk to download + public int offset; + /// Length of chunk to download + public int limit; + } /// Download a CDN file. See /// File token /// Offset of chunk to download /// Length of chunk to download public static Task Upload_GetCdnFile(this Client client, byte[] file_token, int offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetCdnFile_ { - writer.Write(0x2000BCC3); - writer.WriteTLBytes(file_token); - writer.Write(offset); - writer.Write(limit); - return "Upload_GetCdnFile"; + file_token = file_token, + offset = offset, + limit = limit, }); + /// Request a reupload of a certain file to a CDN DC. See + [TLDef(0x9B2754A8)] + public partial class Upload_ReuploadCdnFile_ : ITLMethod + { + /// File token + public byte[] file_token; + /// Request token + public byte[] request_token; + } /// Request a reupload of a certain file to a CDN DC. See [bots: ✓] Possible codes: 400 (details) /// File token /// Request token public static Task Upload_ReuploadCdnFile(this Client client, byte[] file_token, byte[] request_token) - => client.CallAsync(writer => + => client.CallAsync(new Upload_ReuploadCdnFile_ { - writer.Write(0x9B2754A8); - writer.WriteTLBytes(file_token); - writer.WriteTLBytes(request_token); - return "Upload_ReuploadCdnFile"; + file_token = file_token, + request_token = request_token, }); + /// Get SHA256 hashes for verifying downloaded CDN files See + [TLDef(0x4DA54231)] + public partial class Upload_GetCdnFileHashes_ : ITLMethod + { + /// File + public byte[] file_token; + /// Offset from which to start getting hashes + public int offset; + } /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetCdnFileHashes_ { - writer.Write(0x4DA54231); - writer.WriteTLBytes(file_token); - writer.Write(offset); - return "Upload_GetCdnFileHashes"; + file_token = file_token, + offset = offset, }); + /// Get SHA256 hashes for verifying downloaded files See + [TLDef(0xC7025931)] + public partial class Upload_GetFileHashes_ : ITLMethod + { + /// File + public InputFileLocationBase location; + /// Offset from which to get file hashes + public int offset; + } /// Get SHA256 hashes for verifying downloaded files See [bots: ✓] Possible codes: 400 (details) /// File /// Offset from which to get file hashes public static Task Upload_GetFileHashes(this Client client, InputFileLocationBase location, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Upload_GetFileHashes_ { - writer.Write(0xC7025931); - writer.WriteTLObject(location); - writer.Write(offset); - return "Upload_GetFileHashes"; + location = location, + offset = offset, }); + /// Returns current configuration, including data center configuration. See + [TLDef(0xC4F9186B)] + public partial class Help_GetConfig_ : ITLMethod { } /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) - public static Task Help_GetConfig(this Client client) => client.CallAsync(Help_GetConfig); - public static string Help_GetConfig(BinaryWriter writer) - { - writer.Write(0xC4F9186B); - return "Help_GetConfig"; - } + public static Task Help_GetConfig(this Client client) + => client.CallAsync(new Help_GetConfig_ + { + }); + /// Returns info on data centre nearest to the user. See + [TLDef(0x1FB33026)] + public partial class Help_GetNearestDc_ : ITLMethod { } /// Returns info on data centre nearest to the user. See public static Task Help_GetNearestDc(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetNearestDc_ { - writer.Write(0x1FB33026); - return "Help_GetNearestDc"; }); + /// Returns information on update availability for the current application. See + [TLDef(0x522D5A7D)] + public partial class Help_GetAppUpdate_ : ITLMethod + { + /// Source + public string source; + } /// Returns information on update availability for the current application. See /// Source /// a null value means help.noAppUpdate public static Task Help_GetAppUpdate(this Client client, string source) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetAppUpdate_ { - writer.Write(0x522D5A7D); - writer.WriteTLString(source); - return "Help_GetAppUpdate"; + source = source, }); + /// Returns localized text of a text message with an invitation. See + [TLDef(0x4D392343)] + public partial class Help_GetInviteText_ : ITLMethod { } /// Returns localized text of a text message with an invitation. See public static Task Help_GetInviteText(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetInviteText_ { - writer.Write(0x4D392343); - return "Help_GetInviteText"; }); + /// Returns the support user for the 'ask a question' feature. See + [TLDef(0x9CDF08CD)] + public partial class Help_GetSupport_ : ITLMethod { } /// Returns the support user for the 'ask a question' feature. See public static Task Help_GetSupport(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetSupport_ { - writer.Write(0x9CDF08CD); - return "Help_GetSupport"; }); + /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
+ [TLDef(0x9010EF6F)] + public partial class Help_GetAppChangelog_ : ITLMethod + { + /// Previous app version + public string prev_app_version; + } /// Get changelog of current app.
Typically, an constructor will be returned, containing one or more updates with app-specific changelogs. See
/// Previous app version public static Task Help_GetAppChangelog(this Client client, string prev_app_version) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetAppChangelog_ { - writer.Write(0x9010EF6F); - writer.WriteTLString(prev_app_version); - return "Help_GetAppChangelog"; + prev_app_version = prev_app_version, }); + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See + [TLDef(0xEC22CFCD)] + public partial class Help_SetBotUpdatesStatus_ : ITLMethod + { + /// Number of pending updates + public int pending_updates_count; + /// Error message, if present + public string message; + } /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) - => client.CallAsync(writer => + => client.CallAsync(new Help_SetBotUpdatesStatus_ { - writer.Write(0xEC22CFCD); - writer.Write(pending_updates_count); - writer.WriteTLString(message); - return "Help_SetBotUpdatesStatus"; + pending_updates_count = pending_updates_count, + message = message, }); + /// Get configuration for CDN file downloads. See + [TLDef(0x52029342)] + public partial class Help_GetCdnConfig_ : ITLMethod { } /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: 401 (details) public static Task Help_GetCdnConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetCdnConfig_ { - writer.Write(0x52029342); - return "Help_GetCdnConfig"; }); + /// Get recently used t.me links See + [TLDef(0x3DC0F114)] + public partial class Help_GetRecentMeUrls_ : ITLMethod + { + /// Referer + public string referer; + } /// Get recently used t.me links See /// Referer public static Task Help_GetRecentMeUrls(this Client client, string referer) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetRecentMeUrls_ { - writer.Write(0x3DC0F114); - writer.WriteTLString(referer); - return "Help_GetRecentMeUrls"; + referer = referer, }); + /// Look for updates of telegram's terms of service See + [TLDef(0x2CA51FD1)] + public partial class Help_GetTermsOfServiceUpdate_ : ITLMethod { } /// Look for updates of telegram's terms of service See public static Task Help_GetTermsOfServiceUpdate(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetTermsOfServiceUpdate_ { - writer.Write(0x2CA51FD1); - return "Help_GetTermsOfServiceUpdate"; }); + /// Accept the new terms of service See + [TLDef(0xEE72F79A)] + public partial class Help_AcceptTermsOfService_ : ITLMethod + { + /// ID of terms of service + public DataJSON id; + } /// Accept the new terms of service See /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) - => client.CallAsync(writer => + => client.CallAsync(new Help_AcceptTermsOfService_ { - writer.Write(0xEE72F79A); - writer.WriteTLObject(id); - return "Help_AcceptTermsOfService"; + id = id, }); + /// Get info about a t.me link See + [TLDef(0x3FEDC75F)] + public partial class Help_GetDeepLinkInfo_ : ITLMethod + { + /// Path in t.me/path + public string path; + } /// Get info about a t.me link See /// Path in t.me/path /// a null value means help.deepLinkInfoEmpty public static Task Help_GetDeepLinkInfo(this Client client, string path) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetDeepLinkInfo_ { - writer.Write(0x3FEDC75F); - writer.WriteTLString(path); - return "Help_GetDeepLinkInfo"; + path = path, }); + /// Get app-specific configuration, see client configuration for more info on the result. See + [TLDef(0x98914110)] + public partial class Help_GetAppConfig_ : ITLMethod { } /// Get app-specific configuration, see client configuration for more info on the result. See public static Task Help_GetAppConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetAppConfig_ { - writer.Write(0x98914110); - return "Help_GetAppConfig"; }); + /// Saves logs of application on the server. See + [TLDef(0x6F02F748)] + public partial class Help_SaveAppLog_ : ITLMethod + { + /// List of input events + public InputAppEvent[] events; + } /// Saves logs of application on the server. See /// List of input events public static Task Help_SaveAppLog(this Client client, InputAppEvent[] events) - => client.CallAsync(writer => + => client.CallAsync(new Help_SaveAppLog_ { - writer.Write(0x6F02F748); - writer.WriteTLVector(events); - return "Help_SaveAppLog"; + events = events, }); + /// Get passport configuration See + [TLDef(0xC661AD08)] + public partial class Help_GetPassportConfig_ : ITLMethod + { + /// Hash for pagination, for more info click here + public int hash; + } /// Get passport configuration See /// Hash for pagination, for more info click here /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetPassportConfig_ { - writer.Write(0xC661AD08); - writer.Write(hash); - return "Help_GetPassportConfig"; + hash = hash, }); + /// Get localized name of the telegram support user See + [TLDef(0xD360E72C)] + public partial class Help_GetSupportName_ : ITLMethod { } /// Get localized name of the telegram support user See Possible codes: 403 (details) public static Task Help_GetSupportName(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetSupportName_ { - writer.Write(0xD360E72C); - return "Help_GetSupportName"; }); + /// Internal use See + [TLDef(0x038A08D3)] + public partial class Help_GetUserInfo_ : ITLMethod + { + /// User ID + public InputUserBase user_id; + } /// Internal use See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetUserInfo_ { - writer.Write(0x038A08D3); - writer.WriteTLObject(user_id); - return "Help_GetUserInfo"; + user_id = user_id, }); + /// Internal use See + [TLDef(0x66B91B70)] + public partial class Help_EditUserInfo_ : ITLMethod + { + /// User + public InputUserBase user_id; + /// Message + public string message; + /// Message entities for styled text + public MessageEntity[] entities; + } /// Internal use See Possible codes: 400 (details) /// User /// Message /// Message entities for styled text /// a null value means help.userInfoEmpty public static Task Help_EditUserInfo(this Client client, InputUserBase user_id, string message, MessageEntity[] entities) - => client.CallAsync(writer => + => client.CallAsync(new Help_EditUserInfo_ { - writer.Write(0x66B91B70); - writer.WriteTLObject(user_id); - writer.WriteTLString(message); - writer.WriteTLVector(entities); - return "Help_EditUserInfo"; + user_id = user_id, + message = message, + entities = entities, }); + /// Get MTProxy/Public Service Announcement information See + [TLDef(0xC0977421)] + public partial class Help_GetPromoData_ : ITLMethod { } /// Get MTProxy/Public Service Announcement information See public static Task Help_GetPromoData(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetPromoData_ { - writer.Write(0xC0977421); - return "Help_GetPromoData"; }); + /// Hide MTProxy/Public Service Announcement information See + [TLDef(0x1E251C95)] + public partial class Help_HidePromoData_ : ITLMethod + { + /// Peer to hide + public InputPeer peer; + } /// Hide MTProxy/Public Service Announcement information See /// Peer to hide public static Task Help_HidePromoData(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Help_HidePromoData_ { - writer.Write(0x1E251C95); - writer.WriteTLObject(peer); - return "Help_HidePromoData"; + peer = peer, }); + /// Dismiss a suggestion, see here for more info ». See + [TLDef(0xF50DBAA1)] + public partial class Help_DismissSuggestion_ : ITLMethod + { + /// In the case of pending suggestions in , the channel ID. + public InputPeer peer; + /// Suggestion, see here for more info ». + public string suggestion; + } /// Dismiss a suggestion, see here for more info ». See /// In the case of pending suggestions in , the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) - => client.CallAsync(writer => + => client.CallAsync(new Help_DismissSuggestion_ { - writer.Write(0xF50DBAA1); - writer.WriteTLObject(peer); - writer.WriteTLString(suggestion); - return "Help_DismissSuggestion"; + peer = peer, + suggestion = suggestion, }); + /// Get name, ISO code, localized name and phone codes/patterns of all available countries See + [TLDef(0x735787A8)] + public partial class Help_GetCountriesList_ : ITLMethod + { + /// Language code of the current user + public string lang_code; + /// Hash for pagination, for more info click here + public int hash; + } /// Get name, ISO code, localized name and phone codes/patterns of all available countries See /// Language code of the current user /// Hash for pagination, for more info click here /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash) - => client.CallAsync(writer => + => client.CallAsync(new Help_GetCountriesList_ { - writer.Write(0x735787A8); - writer.WriteTLString(lang_code); - writer.Write(hash); - return "Help_GetCountriesList"; + lang_code = lang_code, + hash = hash, }); + /// Mark channel/supergroup history as read See + [TLDef(0xCC104937)] + public partial class Channels_ReadHistory_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// ID of message up to which messages should be marked as read + public int max_id; + } /// 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 public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReadHistory_ { - writer.Write(0xCC104937); - writer.WriteTLObject(channel); - writer.Write(max_id); - return "Channels_ReadHistory"; + channel = channel, + max_id = max_id, }); + /// Delete messages in a channel/supergroup See + [TLDef(0x84C1FD4E)] + public partial class Channels_DeleteMessages_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages to delete + public int[] id; + } /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteMessages_ { - writer.Write(0x84C1FD4E); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_DeleteMessages"; + channel = channel, + id = id, }); + /// Delete all messages sent by a certain user in a supergroup See + [TLDef(0xD10DD71B)] + public partial class Channels_DeleteUserHistory_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// User whose messages should be deleted + public InputUserBase user_id; + } /// Delete all messages sent by a certain user in a supergroup See Possible codes: 400,403 (details) /// Supergroup /// User whose messages should be deleted public static Task Channels_DeleteUserHistory(this Client client, InputChannelBase channel, InputUserBase user_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteUserHistory_ { - writer.Write(0xD10DD71B); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - return "Channels_DeleteUserHistory"; + channel = channel, + user_id = user_id, }); + /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See + [TLDef(0xFE087810)] + public partial class Channels_ReportSpam_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// ID of the user that sent the spam messages + public InputUserBase user_id; + /// IDs of spam messages + public int[] id; + } /// 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 public static Task Channels_ReportSpam(this Client client, InputChannelBase channel, InputUserBase user_id, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReportSpam_ { - writer.Write(0xFE087810); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLVector(id); - return "Channels_ReportSpam"; + channel = channel, + user_id = user_id, + id = id, }); + /// Get channel/supergroup messages See + [TLDef(0xAD8C9A23)] + public partial class Channels_GetMessages_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages to get + public InputMessage[] id; + } /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, InputMessage[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetMessages_ { - writer.Write(0xAD8C9A23); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_GetMessages"; + channel = channel, + id = id, }); + /// Get the participants of a supergroup/channel See + [TLDef(0x77CED9D0)] + public partial class Channels_GetParticipants_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// Which participant types to fetch + public ChannelParticipantsFilter filter; + /// Offset + public int offset; + /// Limit + public int limit; + /// Hash + public long hash; + } /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) /// Channel /// Which participant types to fetch @@ -16216,49 +18988,91 @@ namespace TL /// Hash /// a null value means channels.channelParticipantsNotModified public static Task Channels_GetParticipants(this Client client, InputChannelBase channel, ChannelParticipantsFilter filter, int offset, int limit, long hash) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetParticipants_ { - writer.Write(0x77CED9D0); - writer.WriteTLObject(channel); - writer.WriteTLObject(filter); - writer.Write(offset); - writer.Write(limit); - writer.Write(hash); - return "Channels_GetParticipants"; + channel = channel, + filter = filter, + offset = offset, + limit = limit, + hash = hash, }); + /// Get info about a channel/supergroup participant See + [TLDef(0xA0AB6CC6)] + public partial class Channels_GetParticipant_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Participant to get info about + public InputPeer participant; + } /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetParticipant_ { - writer.Write(0xA0AB6CC6); - writer.WriteTLObject(channel); - writer.WriteTLObject(participant); - return "Channels_GetParticipant"; + channel = channel, + participant = participant, }); + /// Get info about channels/supergroups See + [TLDef(0x0A7F6BBB)] + public partial class Channels_GetChannels_ : ITLMethod + { + /// IDs of channels/supergroups to get info about + public InputChannelBase[] id; + } /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, InputChannelBase[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetChannels_ { - writer.Write(0x0A7F6BBB); - writer.WriteTLVector(id); - return "Channels_GetChannels"; + id = id, }); + /// Get full info about a channel See + [TLDef(0x08736A09)] + public partial class Channels_GetFullChannel_ : ITLMethod + { + /// The channel to get info about + public InputChannelBase channel; + } /// Get full info about a channel See [bots: ✓] Possible codes: 400,403 (details) /// The channel to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetFullChannel_ { - writer.Write(0x08736A09); - writer.WriteTLObject(channel); - return "Channels_GetFullChannel"; + channel = channel, }); + /// Create a supergroup/channel. See + [TLDef(0x3D5FB10F)] + public partial class Channels_CreateChannel_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel title + public string title; + /// Channel description + public string about; + /// Geogroup location + [IfFlag(2)] public InputGeoPoint geo_point; + /// Geogroup address + [IfFlag(2)] public string address; + + [Flags] public enum Flags + { + /// Whether to create a channel + broadcast = 0x1, + /// Whether to create a supergroup + megagroup = 0x2, + /// Field has a value + has_geo_point = 0x4, + /// Whether the supergroup is being created to import messages from a foreign chat service using messages.initHistoryImport + for_import = 0x8, + } + } /// Create a supergroup/channel. See Possible codes: 400,403 (details) /// Whether to create a channel /// Whether to create a supergroup @@ -16268,177 +19082,309 @@ namespace TL /// Geogroup location /// Geogroup address 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 => + => client.CallAsync(new Channels_CreateChannel_ { - writer.Write(0x3D5FB10F); - writer.Write((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0)); - writer.WriteTLString(title); - writer.WriteTLString(about); - if (geo_point != null) - writer.WriteTLObject(geo_point); - if (address != null) - writer.WriteTLString(address); - return "Channels_CreateChannel"; + flags = (Channels_CreateChannel_.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0)), + title = title, + about = about, + geo_point = geo_point, + address = address, }); + /// Modify the admin rights of a user in a supergroup/channel. See + [TLDef(0xD33C8902)] + public partial class Channels_EditAdmin_ : ITLMethod + { + /// The supergroup/channel. + public InputChannelBase channel; + /// The ID of the user whose admin rights should be modified + public InputUserBase user_id; + /// The admin rights + public ChatAdminRights admin_rights; + /// Indicates the role (rank) of the admin in the group: just an arbitrary string + public string rank; + } /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] 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 public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditAdmin_ { - writer.Write(0xD33C8902); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLObject(admin_rights); - writer.WriteTLString(rank); - return "Channels_EditAdmin"; + channel = channel, + user_id = user_id, + admin_rights = admin_rights, + rank = rank, }); + /// Edit the name of a channel/supergroup See + [TLDef(0x566DECD0)] + public partial class Channels_EditTitle_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// New name + public string title; + } /// Edit the name of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup /// New name public static Task Channels_EditTitle(this Client client, InputChannelBase channel, string title) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditTitle_ { - writer.Write(0x566DECD0); - writer.WriteTLObject(channel); - writer.WriteTLString(title); - return "Channels_EditTitle"; + channel = channel, + title = title, }); + /// Change the photo of a channel/supergroup See + [TLDef(0xF12E57C9)] + public partial class Channels_EditPhoto_ : ITLMethod + { + /// Channel/supergroup whose photo should be edited + public InputChannelBase channel; + /// New photo + public InputChatPhotoBase photo; + } /// Change the photo of a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup whose photo should be edited /// New photo public static Task Channels_EditPhoto(this Client client, InputChannelBase channel, InputChatPhotoBase photo) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditPhoto_ { - writer.Write(0xF12E57C9); - writer.WriteTLObject(channel); - writer.WriteTLObject(photo); - return "Channels_EditPhoto"; + channel = channel, + photo = photo, }); + /// Check if a username is free and can be assigned to a channel/supergroup See + [TLDef(0x10E6BD2C)] + public partial class Channels_CheckUsername_ : ITLMethod + { + /// The channel/supergroup that will assigned the specified username + public InputChannelBase channel; + /// The username to check + public string username; + } /// 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 public static Task Channels_CheckUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(writer => + => client.CallAsync(new Channels_CheckUsername_ { - writer.Write(0x10E6BD2C); - writer.WriteTLObject(channel); - writer.WriteTLString(username); - return "Channels_CheckUsername"; + channel = channel, + username = username, }); + /// Change the username of a supergroup/channel See + [TLDef(0x3514B3DE)] + public partial class Channels_UpdateUsername_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// New username + public string username; + } /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel /// New username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) - => client.CallAsync(writer => + => client.CallAsync(new Channels_UpdateUsername_ { - writer.Write(0x3514B3DE); - writer.WriteTLObject(channel); - writer.WriteTLString(username); - return "Channels_UpdateUsername"; + channel = channel, + username = username, }); + /// Join a channel/supergroup See + [TLDef(0x24B524C5)] + public partial class Channels_JoinChannel_ : ITLMethod + { + /// Channel/supergroup to join + public InputChannelBase channel; + } /// Join a channel/supergroup See Possible codes: 400 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_JoinChannel_ { - writer.Write(0x24B524C5); - writer.WriteTLObject(channel); - return "Channels_JoinChannel"; + channel = channel, }); + /// Leave a channel/supergroup See + [TLDef(0xF836AA95)] + public partial class Channels_LeaveChannel_ : ITLMethod + { + /// Channel/supergroup to leave + public InputChannelBase channel; + } /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_LeaveChannel_ { - writer.Write(0xF836AA95); - writer.WriteTLObject(channel); - return "Channels_LeaveChannel"; + channel = channel, }); + /// Invite users to a channel/supergroup See + [TLDef(0x199F3A6C)] + public partial class Channels_InviteToChannel_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Users to invite + public InputUserBase[] users; + } /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, InputUserBase[] users) - => client.CallAsync(writer => + => client.CallAsync(new Channels_InviteToChannel_ { - writer.Write(0x199F3A6C); - writer.WriteTLObject(channel); - writer.WriteTLVector(users); - return "Channels_InviteToChannel"; + channel = channel, + users = users, }); + /// Delete a channel/supergroup See + [TLDef(0xC0111FE3)] + public partial class Channels_DeleteChannel_ : ITLMethod + { + /// Channel/supergroup to delete + public InputChannelBase channel; + } /// Delete a channel/supergroup See Possible codes: 400,403 (details) /// Channel/supergroup to delete public static Task Channels_DeleteChannel(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteChannel_ { - writer.Write(0xC0111FE3); - writer.WriteTLObject(channel); - return "Channels_DeleteChannel"; + channel = channel, }); + /// Get link and embed info of a message in a channel/supergroup See + [TLDef(0xE63FADEB)] + public partial class Channels_ExportMessageLink_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel + public InputChannelBase channel; + /// Message ID + public int id; + + [Flags] public enum Flags + { + /// Whether to include other grouped media (for albums) + grouped = 0x1, + /// Whether to also include a thread ID, if available, inside of the link + thread = 0x2, + } + } /// 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 public static Task Channels_ExportMessageLink(this Client client, InputChannelBase channel, int id, bool grouped = false, bool thread = false) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ExportMessageLink_ { - writer.Write(0xE63FADEB); - writer.Write((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)); - writer.WriteTLObject(channel); - writer.Write(id); - return "Channels_ExportMessageLink"; + flags = (Channels_ExportMessageLink_.Flags)((grouped ? 0x1 : 0) | (thread ? 0x2 : 0)), + channel = channel, + id = id, }); + /// Enable/disable message signatures in channels See + [TLDef(0x1F69B606)] + public partial class Channels_ToggleSignatures_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// Value + public bool enabled; + } /// Enable/disable message signatures in channels See Possible codes: 400 (details) /// Channel /// Value public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ToggleSignatures_ { - writer.Write(0x1F69B606); - writer.WriteTLObject(channel); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Channels_ToggleSignatures"; + channel = channel, + enabled = enabled, }); + /// 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 + [TLDef(0xF8B036AF)] + public partial class Channels_GetAdminedPublicChannels_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Get geogroups + by_location = 0x1, + /// 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.
+ check_limit = 0x2, + } + } /// 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. public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetAdminedPublicChannels_ { - writer.Write(0xF8B036AF); - writer.Write((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)); - return "Channels_GetAdminedPublicChannels"; + flags = (Channels_GetAdminedPublicChannels_.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), }); + /// Ban/unban/kick a user in a supergroup/channel. See + [TLDef(0x96E6CD81)] + public partial class Channels_EditBanned_ : ITLMethod + { + /// The supergroup/channel. + public InputChannelBase channel; + /// Participant to ban + public InputPeer participant; + /// The banned rights + public ChatBannedRights banned_rights; + } /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights public static Task Channels_EditBanned(this Client client, InputChannelBase channel, InputPeer participant, ChatBannedRights banned_rights) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditBanned_ { - writer.Write(0x96E6CD81); - writer.WriteTLObject(channel); - writer.WriteTLObject(participant); - writer.WriteTLObject(banned_rights); - return "Channels_EditBanned"; + channel = channel, + participant = participant, + banned_rights = banned_rights, }); + /// Get the admin log of a channel/supergroup See + [TLDef(0x33DDF480)] + public partial class Channels_GetAdminLog_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel + public InputChannelBase channel; + /// Search query, can be empty + public string q; + /// Event filter + [IfFlag(0)] public ChannelAdminLogEventsFilter events_filter; + /// Only show events from these admins + [IfFlag(1)] public InputUserBase[] admins; + /// Maximum ID of message to return (see pagination) + public long max_id; + /// Minimum ID of message to return (see pagination) + public long min_id; + /// Maximum number of results to return, see pagination + public int limit; + + [Flags] public enum Flags + { + /// Field has a value + has_events_filter = 0x1, + /// Field has a value + has_admins = 0x2, + } + } /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) /// Channel /// Search query, can be empty @@ -16448,285 +19394,472 @@ namespace TL /// Minimum ID of message to return (see pagination) /// Maximum number of results to return, see pagination 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 => + => client.CallAsync(new Channels_GetAdminLog_ { - writer.Write(0x33DDF480); - writer.Write((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)); - writer.WriteTLObject(channel); - writer.WriteTLString(q); - if (events_filter != null) - writer.WriteTLObject(events_filter); - if (admins != null) - writer.WriteTLVector(admins); - writer.Write(max_id); - writer.Write(min_id); - writer.Write(limit); - return "Channels_GetAdminLog"; + flags = (Channels_GetAdminLog_.Flags)((events_filter != null ? 0x1 : 0) | (admins != null ? 0x2 : 0)), + channel = channel, + q = q, + events_filter = events_filter, + admins = admins, + max_id = max_id, + min_id = min_id, + limit = limit, }); + /// Associate a stickerset to the supergroup See + [TLDef(0xEA8CA4F9)] + public partial class Channels_SetStickers_ : ITLMethod + { + /// Supergroup + public InputChannelBase channel; + /// The stickerset to associate + public InputStickerSet stickerset; + } /// Associate a stickerset to the supergroup See [bots: ✓] Possible codes: 400,406 (details) /// Supergroup /// The stickerset to associate public static Task Channels_SetStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) - => client.CallAsync(writer => + => client.CallAsync(new Channels_SetStickers_ { - writer.Write(0xEA8CA4F9); - writer.WriteTLObject(channel); - writer.WriteTLObject(stickerset); - return "Channels_SetStickers"; + channel = channel, + stickerset = stickerset, }); + /// Mark channel/supergroup message contents as read See + [TLDef(0xEAB5DC38)] + public partial class Channels_ReadMessageContents_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// IDs of messages whose contents should be marked as read + public int[] id; + } /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, int[] id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ReadMessageContents_ { - writer.Write(0xEAB5DC38); - writer.WriteTLObject(channel); - writer.WriteTLVector(id); - return "Channels_ReadMessageContents"; + channel = channel, + id = id, }); + /// Delete the history of a supergroup See + [TLDef(0xAF369D42)] + public partial class Channels_DeleteHistory_ : ITLMethod + { + /// Supergroup whose history must be deleted + public InputChannelBase channel; + /// ID of message up to which the history must be deleted + public int max_id; + } /// 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 public static Task Channels_DeleteHistory(this Client client, InputChannelBase channel, int max_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_DeleteHistory_ { - writer.Write(0xAF369D42); - writer.WriteTLObject(channel); - writer.Write(max_id); - return "Channels_DeleteHistory"; + channel = channel, + max_id = max_id, }); + /// Hide/unhide message history for new channel/supergroup users See + [TLDef(0xEABBB94C)] + public partial class Channels_TogglePreHistoryHidden_ : ITLMethod + { + /// Channel/supergroup + public InputChannelBase channel; + /// Hide/unhide + public bool enabled; + } /// Hide/unhide message history for new channel/supergroup users See Possible codes: 400 (details) /// Channel/supergroup /// Hide/unhide public static Task Channels_TogglePreHistoryHidden(this Client client, InputChannelBase channel, bool enabled) - => client.CallAsync(writer => + => client.CallAsync(new Channels_TogglePreHistoryHidden_ { - writer.Write(0xEABBB94C); - writer.WriteTLObject(channel); - writer.Write(enabled ? 0x997275B5 : 0xBC799737); - return "Channels_TogglePreHistoryHidden"; + channel = channel, + enabled = enabled, }); + /// Get a list of channels/supergroups we left See + [TLDef(0x8341ECC0)] + public partial class Channels_GetLeftChannels_ : ITLMethod + { + /// Offset for pagination + public int offset; + } /// Get a list of channels/supergroups we left See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetLeftChannels_ { - writer.Write(0x8341ECC0); - writer.Write(offset); - return "Channels_GetLeftChannels"; + offset = offset, }); + /// Get all groups that can be used as discussion groups. See + [TLDef(0xF5DAD378)] + public partial class Channels_GetGroupsForDiscussion_ : ITLMethod { } /// Get all groups that can be used as discussion groups. See public static Task Channels_GetGroupsForDiscussion(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetGroupsForDiscussion_ { - writer.Write(0xF5DAD378); - return "Channels_GetGroupsForDiscussion"; }); + /// Associate a group to a channel as discussion group for that channel See + [TLDef(0x40582BB2)] + public partial class Channels_SetDiscussionGroup_ : ITLMethod + { + /// Channel + public InputChannelBase broadcast; + /// Discussion group to associate to the channel + public InputChannelBase group; + } /// 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 public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) - => client.CallAsync(writer => + => client.CallAsync(new Channels_SetDiscussionGroup_ { - writer.Write(0x40582BB2); - writer.WriteTLObject(broadcast); - writer.WriteTLObject(group); - return "Channels_SetDiscussionGroup"; + broadcast = broadcast, + group = group, }); + /// Transfer channel ownership See + [TLDef(0x8F38CD1F)] + public partial class Channels_EditCreator_ : ITLMethod + { + /// Channel + public InputChannelBase channel; + /// New channel owner + public InputUserBase user_id; + /// 2FA password of account + public InputCheckPasswordSRP password; + } /// Transfer channel ownership See Possible codes: 400,403 (details) /// Channel /// New channel owner /// 2FA password of account public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditCreator_ { - writer.Write(0x8F38CD1F); - writer.WriteTLObject(channel); - writer.WriteTLObject(user_id); - writer.WriteTLObject(password); - return "Channels_EditCreator"; + channel = channel, + user_id = user_id, + password = password, }); + /// Edit location of geogroup See + [TLDef(0x58E63F6D)] + public partial class Channels_EditLocation_ : ITLMethod + { + /// Geogroup + public InputChannelBase channel; + /// New geolocation + public InputGeoPoint geo_point; + /// Address string + public string address; + } /// Edit location of geogroup See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string public static Task Channels_EditLocation(this Client client, InputChannelBase channel, InputGeoPoint geo_point, string address) - => client.CallAsync(writer => + => client.CallAsync(new Channels_EditLocation_ { - writer.Write(0x58E63F6D); - writer.WriteTLObject(channel); - writer.WriteTLObject(geo_point); - writer.WriteTLString(address); - return "Channels_EditLocation"; + channel = channel, + geo_point = geo_point, + address = address, }); + /// Toggle supergroup slow mode: if enabled, users will only be able to send one message every seconds seconds See + [TLDef(0xEDD49EF0)] + public partial class Channels_ToggleSlowMode_ : ITLMethod + { + /// The supergroup + public InputChannelBase channel; + /// Users will only be able to send one message every seconds seconds, 0 to disable the limitation + public int seconds; + } /// 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 public static Task Channels_ToggleSlowMode(this Client client, InputChannelBase channel, int seconds) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ToggleSlowMode_ { - writer.Write(0xEDD49EF0); - writer.WriteTLObject(channel); - writer.Write(seconds); - return "Channels_ToggleSlowMode"; + channel = channel, + seconds = seconds, }); + /// Get inactive channels and supergroups See + [TLDef(0x11E831EE)] + public partial class Channels_GetInactiveChannels_ : ITLMethod { } /// Get inactive channels and supergroups See public static Task Channels_GetInactiveChannels(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetInactiveChannels_ { - writer.Write(0x11E831EE); - return "Channels_GetInactiveChannels"; }); + /// See + [TLDef(0x0B290C69)] + public partial class Channels_ConvertToGigagroup_ : ITLMethod + { + public InputChannelBase channel; + } /// See public static Task Channels_ConvertToGigagroup(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ConvertToGigagroup_ { - writer.Write(0x0B290C69); - writer.WriteTLObject(channel); - return "Channels_ConvertToGigagroup"; + channel = channel, }); + /// Mark a specific sponsored message as read See + [TLDef(0xBEAEDB94)] + public partial class Channels_ViewSponsoredMessage_ : ITLMethod + { + /// Peer + public InputChannelBase channel; + /// Message ID + public byte[] random_id; + } /// Mark a specific sponsored message as read See Possible codes: 400 (details) /// Peer /// Message ID public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) - => client.CallAsync(writer => + => client.CallAsync(new Channels_ViewSponsoredMessage_ { - writer.Write(0xBEAEDB94); - writer.WriteTLObject(channel); - writer.WriteTLBytes(random_id); - return "Channels_ViewSponsoredMessage"; + channel = channel, + random_id = random_id, }); + /// Get a list of sponsored messages See + [TLDef(0xEC210FBF)] + public partial class Channels_GetSponsoredMessages_ : ITLMethod + { + /// Peer + public InputChannelBase channel; + } /// Get a list of sponsored messages See /// Peer public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.CallAsync(writer => + => client.CallAsync(new Channels_GetSponsoredMessages_ { - writer.Write(0xEC210FBF); - writer.WriteTLObject(channel); - return "Channels_GetSponsoredMessages"; + channel = channel, }); + /// Sends a custom request; for bots only See + [TLDef(0xAA2769ED)] + public partial class Bots_SendCustomRequest_ : ITLMethod + { + /// The method name + public string custom_method; + /// JSON-serialized method parameters + public DataJSON params_; + } /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) - => client.CallAsync(writer => + => client.CallAsync(new Bots_SendCustomRequest_ { - writer.Write(0xAA2769ED); - writer.WriteTLString(custom_method); - writer.WriteTLObject(params_); - return "Bots_SendCustomRequest"; + custom_method = custom_method, + params_ = params_, }); + /// Answers a custom query; for bots only See + [TLDef(0xE6213F4D)] + public partial class Bots_AnswerWebhookJSONQuery_ : ITLMethod + { + /// Identifier of a custom query + public long query_id; + /// JSON-serialized answer to the query + public DataJSON data; + } /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) - => client.CallAsync(writer => + => client.CallAsync(new Bots_AnswerWebhookJSONQuery_ { - writer.Write(0xE6213F4D); - writer.Write(query_id); - writer.WriteTLObject(data); - return "Bots_AnswerWebhookJSONQuery"; + query_id = query_id, + data = data, }); + /// Set bot command list See + [TLDef(0x0517165A)] + public partial class Bots_SetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + /// Bot commands + public BotCommand[] commands; + } /// Set bot command list See [bots: ✓] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands public static Task Bots_SetBotCommands(this Client client, BotCommandScope scope, string lang_code, BotCommand[] commands) - => client.CallAsync(writer => + => client.CallAsync(new Bots_SetBotCommands_ { - writer.Write(0x0517165A); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - writer.WriteTLVector(commands); - return "Bots_SetBotCommands"; + scope = scope, + lang_code = lang_code, + commands = commands, }); + /// Clear bot commands for the specified bot scope and language code See + [TLDef(0x3D8DE0F9)] + public partial class Bots_ResetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + } /// Clear bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Bots_ResetBotCommands_ { - writer.Write(0x3D8DE0F9); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - return "Bots_ResetBotCommands"; + scope = scope, + lang_code = lang_code, }); + /// Obtain a list of bot commands for the specified bot scope and language code See + [TLDef(0xE34C0DD6)] + public partial class Bots_GetBotCommands_ : ITLMethod + { + /// Command scope + public BotCommandScope scope; + /// Language code + public string lang_code; + } /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Bots_GetBotCommands_ { - writer.Write(0xE34C0DD6); - writer.WriteTLObject(scope); - writer.WriteTLString(lang_code); - return "Bots_GetBotCommands"; + scope = scope, + lang_code = lang_code, }); + /// Get a payment form See + [TLDef(0x8A333C8D)] + public partial class Payments_GetPaymentForm_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The peer where the payment form was sent + public InputPeer peer; + /// Message ID of payment form + public int msg_id; + /// 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
+ [IfFlag(0)] public DataJSON theme_params; + + [Flags] public enum Flags + { + /// Field has a value + has_theme_params = 0x1, + } + } /// 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 public static Task Payments_GetPaymentForm(this Client client, InputPeer peer, int msg_id, DataJSON theme_params = null) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetPaymentForm_ { - writer.Write(0x8A333C8D); - writer.Write(theme_params != null ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (theme_params != null) - writer.WriteTLObject(theme_params); - return "Payments_GetPaymentForm"; + flags = (Payments_GetPaymentForm_.Flags)(theme_params != null ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + theme_params = theme_params, }); + /// Get payment receipt See + [TLDef(0x2478D1CC)] + public partial class Payments_GetPaymentReceipt_ : ITLMethod + { + /// The peer where the payment receipt was sent + public InputPeer peer; + /// Message ID of receipt + public int msg_id; + } /// Get payment receipt See Possible codes: 400 (details) /// The peer where the payment receipt was sent /// Message ID of receipt public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetPaymentReceipt_ { - writer.Write(0x2478D1CC); - writer.WriteTLObject(peer); - writer.Write(msg_id); - return "Payments_GetPaymentReceipt"; + peer = peer, + msg_id = msg_id, }); + /// Submit requested order information for validation See + [TLDef(0xDB103170)] + public partial class Payments_ValidateRequestedInfo_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Peer where the payment form was sent + public InputPeer peer; + /// Message ID of payment form + public int msg_id; + /// Requested order information + public PaymentRequestedInfo info; + + [Flags] public enum Flags + { + /// Save order information to re-use it for future orders + save = 0x1, + } + } /// 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 public static Task Payments_ValidateRequestedInfo(this Client client, InputPeer peer, int msg_id, PaymentRequestedInfo info, bool save = false) - => client.CallAsync(writer => + => client.CallAsync(new Payments_ValidateRequestedInfo_ { - writer.Write(0xDB103170); - writer.Write(save ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(msg_id); - writer.WriteTLObject(info); - return "Payments_ValidateRequestedInfo"; + flags = (Payments_ValidateRequestedInfo_.Flags)(save ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + info = info, }); + /// Send compiled payment form See + [TLDef(0x30C3BC9D)] + public partial class Payments_SendPaymentForm_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Form ID + public long form_id; + /// The peer where the payment form was sent + public InputPeer peer; + /// Message ID of form + public int msg_id; + /// ID of saved and validated + [IfFlag(0)] public string requested_info_id; + /// Chosen shipping option ID + [IfFlag(1)] public string shipping_option_id; + /// Payment credentials + public InputPaymentCredentialsBase 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). + [IfFlag(2)] public long tip_amount; + + [Flags] public enum Flags + { + /// Field has a value + has_requested_info_id = 0x1, + /// Field has a value + has_shipping_option_id = 0x2, + /// Field has a value + has_tip_amount = 0x4, + } + } /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// The peer where the payment form was sent @@ -16736,52 +19869,97 @@ namespace TL /// 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). 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 => + => client.CallAsync(new Payments_SendPaymentForm_ { - writer.Write(0x30C3BC9D); - writer.Write((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)); - writer.Write(form_id); - writer.WriteTLObject(peer); - writer.Write(msg_id); - if (requested_info_id != null) - writer.WriteTLString(requested_info_id); - if (shipping_option_id != null) - writer.WriteTLString(shipping_option_id); - writer.WriteTLObject(credentials); - if (tip_amount != null) - writer.Write(tip_amount.Value); - return "Payments_SendPaymentForm"; + flags = (Payments_SendPaymentForm_.Flags)((requested_info_id != null ? 0x1 : 0) | (shipping_option_id != null ? 0x2 : 0) | (tip_amount != null ? 0x4 : 0)), + form_id = form_id, + peer = peer, + msg_id = msg_id, + requested_info_id = requested_info_id, + shipping_option_id = shipping_option_id, + credentials = credentials, + tip_amount = tip_amount.GetValueOrDefault(), }); + /// Get saved payment information See + [TLDef(0x227D824B)] + public partial class Payments_GetSavedInfo_ : ITLMethod { } /// Get saved payment information See public static Task Payments_GetSavedInfo(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetSavedInfo_ { - writer.Write(0x227D824B); - return "Payments_GetSavedInfo"; }); + /// Clear saved payment information See + [TLDef(0xD83D70C1)] + public partial class Payments_ClearSavedInfo_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + + [Flags] public enum Flags + { + /// Remove saved payment credentials + credentials = 0x1, + /// Clear the last order settings saved by the user + info = 0x2, + } + } /// Clear saved payment information See /// Remove saved payment credentials /// Clear the last order settings saved by the user public static Task Payments_ClearSavedInfo(this Client client, bool credentials = false, bool info = false) - => client.CallAsync(writer => + => client.CallAsync(new Payments_ClearSavedInfo_ { - writer.Write(0xD83D70C1); - writer.Write((credentials ? 0x1 : 0) | (info ? 0x2 : 0)); - return "Payments_ClearSavedInfo"; + flags = (Payments_ClearSavedInfo_.Flags)((credentials ? 0x1 : 0) | (info ? 0x2 : 0)), }); + /// Get info about a credit card See + [TLDef(0x2E79D779)] + public partial class Payments_GetBankCardData_ : ITLMethod + { + /// Credit card number + public string number; + } /// Get info about a credit card See Possible codes: 400 (details) /// Credit card number public static Task Payments_GetBankCardData(this Client client, string number) - => client.CallAsync(writer => + => client.CallAsync(new Payments_GetBankCardData_ { - writer.Write(0x2E79D779); - writer.WriteTLString(number); - return "Payments_GetBankCardData"; + number = number, }); + /// Create a stickerset, bots only. See + [TLDef(0x9021AB67)] + public partial class Stickers_CreateStickerSet_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Stickerset owner + public InputUserBase user_id; + /// Stickerset name, 1-64 chars + public string title; + /// Sticker set name. Can contain only English letters, digits and underscores. Must end with "by" ( is case insensitive); 1-64 characters + public string short_name; + /// Thumbnail + [IfFlag(2)] public InputDocument thumb; + /// Stickers + public InputStickerSetItem[] stickers; + /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers + [IfFlag(3)] public string software; + + [Flags] public enum Flags + { + /// Whether this is a mask stickerset + masks = 0x1, + /// Whether this is an animated stickerset + animated = 0x2, + /// Field has a value + has_thumb = 0x4, + /// Field has a value + has_software = 0x8, + } + } /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -16792,95 +19970,149 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers 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 => + => client.CallAsync(new Stickers_CreateStickerSet_ { - writer.Write(0x9021AB67); - writer.Write((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)); - writer.WriteTLObject(user_id); - writer.WriteTLString(title); - writer.WriteTLString(short_name); - if (thumb != null) - writer.WriteTLObject(thumb); - writer.WriteTLVector(stickers); - if (software != null) - writer.WriteTLString(software); - return "Stickers_CreateStickerSet"; + flags = (Stickers_CreateStickerSet_.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + user_id = user_id, + title = title, + short_name = short_name, + thumb = thumb, + stickers = stickers, + software = software, }); + /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See + [TLDef(0xF7760F51)] + public partial class Stickers_RemoveStickerFromSet_ : ITLMethod + { + /// The sticker to remove + public InputDocument sticker; + } /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The sticker to remove public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_RemoveStickerFromSet_ { - writer.Write(0xF7760F51); - writer.WriteTLObject(sticker); - return "Stickers_RemoveStickerFromSet"; + sticker = sticker, }); + /// 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 + [TLDef(0xFFB6D4CA)] + public partial class Stickers_ChangeStickerPosition_ : ITLMethod + { + /// The sticker + public InputDocument sticker; + /// The new position of the sticker, zero-based + public int position; + } /// 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 [bots: ✓] Possible codes: 400 (details) /// The sticker /// The new position of the sticker, zero-based public static Task Stickers_ChangeStickerPosition(this Client client, InputDocument sticker, int position) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_ChangeStickerPosition_ { - writer.Write(0xFFB6D4CA); - writer.WriteTLObject(sticker); - writer.Write(position); - return "Stickers_ChangeStickerPosition"; + sticker = sticker, + position = position, }); + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See + [TLDef(0x8653FEBE)] + public partial class Stickers_AddStickerToSet_ : ITLMethod + { + /// The stickerset + public InputStickerSet stickerset; + /// The sticker + public InputStickerSetItem sticker; + } /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) /// The stickerset /// The sticker public static Task Stickers_AddStickerToSet(this Client client, InputStickerSet stickerset, InputStickerSetItem sticker) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_AddStickerToSet_ { - writer.Write(0x8653FEBE); - writer.WriteTLObject(stickerset); - writer.WriteTLObject(sticker); - return "Stickers_AddStickerToSet"; + stickerset = stickerset, + sticker = sticker, }); + /// Set stickerset thumbnail See + [TLDef(0x9A364E30)] + public partial class Stickers_SetStickerSetThumb_ : ITLMethod + { + /// Stickerset + public InputStickerSet stickerset; + /// Thumbnail + public InputDocument thumb; + } /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset /// Thumbnail public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_SetStickerSetThumb_ { - writer.Write(0x9A364E30); - writer.WriteTLObject(stickerset); - writer.WriteTLObject(thumb); - return "Stickers_SetStickerSetThumb"; + stickerset = stickerset, + thumb = thumb, }); + /// Check whether the given short name is available See + [TLDef(0x284B3639)] + public partial class Stickers_CheckShortName_ : ITLMethod + { + /// Short name + public string short_name; + } /// Check whether the given short name is available See Possible codes: 400 (details) /// Short name public static Task Stickers_CheckShortName(this Client client, string short_name) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_CheckShortName_ { - writer.Write(0x284B3639); - writer.WriteTLString(short_name); - return "Stickers_CheckShortName"; + short_name = short_name, }); + /// Suggests a short name for a given stickerpack name See + [TLDef(0x4DAFC503)] + public partial class Stickers_SuggestShortName_ : ITLMethod + { + /// Sticker pack name + public string title; + } /// Suggests a short name for a given stickerpack name See Possible codes: 400 (details) /// Sticker pack name public static Task Stickers_SuggestShortName(this Client client, string title) - => client.CallAsync(writer => + => client.CallAsync(new Stickers_SuggestShortName_ { - writer.Write(0x4DAFC503); - writer.WriteTLString(title); - return "Stickers_SuggestShortName"; + title = title, }); + /// Get phone call configuration to be passed to libtgvoip's shared config See + [TLDef(0x55451FA9)] + public partial class Phone_GetCallConfig_ : ITLMethod { } /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetCallConfig_ { - writer.Write(0x55451FA9); - return "Phone_GetCallConfig"; }); + /// Start a telegram phone call See + [TLDef(0x42FF96ED)] + public partial class Phone_RequestCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Destination of the phone call + public InputUserBase user_id; + /// Random ID to avoid resending the same object + public int random_id; + /// Parameter for E2E encryption key exchange » + public byte[] g_a_hash; + /// Phone call settings + public PhoneCallProtocol protocol; + + [Flags] public enum Flags + { + /// Whether to start a video call + video = 0x1, + } + } /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call @@ -16888,57 +20120,101 @@ namespace TL /// Parameter for E2E encryption key exchange » /// Phone call settings 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 => + => client.CallAsync(new Phone_RequestCall_ { - writer.Write(0x42FF96ED); - writer.Write(video ? 0x1 : 0); - writer.WriteTLObject(user_id); - writer.Write(random_id); - writer.WriteTLBytes(g_a_hash); - writer.WriteTLObject(protocol); - return "Phone_RequestCall"; + flags = (Phone_RequestCall_.Flags)(video ? 0x1 : 0), + user_id = user_id, + random_id = random_id, + g_a_hash = g_a_hash, + protocol = protocol, }); + /// Accept incoming call See + [TLDef(0x3BD2B4A0)] + public partial class Phone_AcceptCall_ : ITLMethod + { + /// The call to accept + public InputPhoneCall peer; + /// Parameter for E2E encryption key exchange » + public byte[] g_b; + /// Phone call settings + public PhoneCallProtocol protocol; + } /// Accept incoming call See Possible codes: 400 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings public static Task Phone_AcceptCall(this Client client, InputPhoneCall peer, byte[] g_b, PhoneCallProtocol protocol) - => client.CallAsync(writer => + => client.CallAsync(new Phone_AcceptCall_ { - writer.Write(0x3BD2B4A0); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_b); - writer.WriteTLObject(protocol); - return "Phone_AcceptCall"; + peer = peer, + g_b = g_b, + protocol = protocol, }); + /// Complete phone call E2E encryption key exchange » See + [TLDef(0x2EFE1722)] + public partial class Phone_ConfirmCall_ : ITLMethod + { + /// The phone call + public InputPhoneCall peer; + /// Parameter for E2E encryption key exchange » + public byte[] g_a; + /// Key fingerprint + public long key_fingerprint; + /// Phone call settings + public PhoneCallProtocol protocol; + } /// 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 public static Task Phone_ConfirmCall(this Client client, InputPhoneCall peer, byte[] g_a, long key_fingerprint, PhoneCallProtocol protocol) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ConfirmCall_ { - writer.Write(0x2EFE1722); - writer.WriteTLObject(peer); - writer.WriteTLBytes(g_a); - writer.Write(key_fingerprint); - writer.WriteTLObject(protocol); - return "Phone_ConfirmCall"; + peer = peer, + g_a = g_a, + key_fingerprint = key_fingerprint, + protocol = protocol, }); + /// 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 + [TLDef(0x17D54F61)] + public partial class Phone_ReceivedCall_ : ITLMethod + { + /// The phone call we're currently in + public InputPhoneCall peer; + } /// 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 public static Task Phone_ReceivedCall(this Client client, InputPhoneCall peer) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ReceivedCall_ { - writer.Write(0x17D54F61); - writer.WriteTLObject(peer); - return "Phone_ReceivedCall"; + peer = peer, }); + /// Refuse or end running call See + [TLDef(0xB2CBC1C0)] + public partial class Phone_DiscardCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The phone call + public InputPhoneCall peer; + /// Call duration + public int duration; + /// Why was the call discarded + public PhoneCallDiscardReason reason; + /// Preferred libtgvoip relay ID + public long connection_id; + + [Flags] public enum Flags + { + /// Whether this is a video call + video = 0x1, + } + } /// Refuse or end running call See Possible codes: 400 (details) /// Whether this is a video call /// The phone call @@ -16946,76 +20222,149 @@ namespace TL /// Why was the call discarded /// Preferred libtgvoip relay ID public static Task Phone_DiscardCall(this Client client, InputPhoneCall peer, int duration, PhoneCallDiscardReason reason, long connection_id, bool video = false) - => client.CallAsync(writer => + => client.CallAsync(new Phone_DiscardCall_ { - writer.Write(0xB2CBC1C0); - writer.Write(video ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(duration); - writer.Write((uint)reason); - writer.Write(connection_id); - return "Phone_DiscardCall"; + flags = (Phone_DiscardCall_.Flags)(video ? 0x1 : 0), + peer = peer, + duration = duration, + reason = reason, + connection_id = connection_id, }); + /// Rate a call See + [TLDef(0x59EAD627)] + public partial class Phone_SetCallRating_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The call to rate + public InputPhoneCall peer; + /// Rating in 1-5 stars + public int rating; + /// An additional comment + public string comment; + + [Flags] public enum Flags + { + /// Whether the user decided on their own initiative to rate the call + user_initiative = 0x1, + } + } /// 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 public static Task Phone_SetCallRating(this Client client, InputPhoneCall peer, int rating, string comment, bool user_initiative = false) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SetCallRating_ { - writer.Write(0x59EAD627); - writer.Write(user_initiative ? 0x1 : 0); - writer.WriteTLObject(peer); - writer.Write(rating); - writer.WriteTLString(comment); - return "Phone_SetCallRating"; + flags = (Phone_SetCallRating_.Flags)(user_initiative ? 0x1 : 0), + peer = peer, + rating = rating, + comment = comment, }); + /// Send phone call debug data to server See + [TLDef(0x277ADD7E)] + public partial class Phone_SaveCallDebug_ : ITLMethod + { + /// Phone call + public InputPhoneCall peer; + /// Debug statistics obtained from libtgvoip + public DataJSON debug; + } /// Send phone call debug data to server See Possible codes: 400 (details) /// Phone call /// Debug statistics obtained from libtgvoip public static Task Phone_SaveCallDebug(this Client client, InputPhoneCall peer, DataJSON debug) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SaveCallDebug_ { - writer.Write(0x277ADD7E); - writer.WriteTLObject(peer); - writer.WriteTLObject(debug); - return "Phone_SaveCallDebug"; + peer = peer, + debug = debug, }); + /// Send VoIP signaling data See + [TLDef(0xFF7A9383)] + public partial class Phone_SendSignalingData_ : ITLMethod + { + /// Phone call + public InputPhoneCall peer; + /// Signaling payload + public byte[] data; + } /// Send VoIP signaling data See /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SendSignalingData_ { - writer.Write(0xFF7A9383); - writer.WriteTLObject(peer); - writer.WriteTLBytes(data); - return "Phone_SendSignalingData"; + peer = peer, + data = data, }); + /// Create a group call or livestream See + [TLDef(0x48CDC6D8)] + public partial class Phone_CreateGroupCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Associate the group call or livestream to the provided group/supergroup/channel + public InputPeer peer; + /// Unique client message ID required to prevent creation of duplicate group calls + public int random_id; + /// Call title + [IfFlag(0)] public string title; + /// For scheduled group call or livestreams, the absolute date when the group call will start + [IfFlag(1)] public DateTime schedule_date; + + [Flags] public enum Flags + { + /// Field has a value + has_title = 0x1, + /// Field has a value + has_schedule_date = 0x2, + } + } /// 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 public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, string title = null, DateTime? schedule_date = null) - => client.CallAsync(writer => + => client.CallAsync(new Phone_CreateGroupCall_ { - writer.Write(0x48CDC6D8); - writer.Write((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)); - writer.WriteTLObject(peer); - writer.Write(random_id); - if (title != null) - writer.WriteTLString(title); - if (schedule_date != null) - writer.WriteTLStamp(schedule_date.Value); - return "Phone_CreateGroupCall"; + flags = (Phone_CreateGroupCall_.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + peer = peer, + random_id = random_id, + title = title, + schedule_date = schedule_date.GetValueOrDefault(), }); + /// Join a group call See + [TLDef(0xB132FF7B)] + public partial class Phone_JoinGroupCall_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + /// Join the group call, presenting yourself as the specified user/channel + public InputPeer join_as; + /// The invitation hash from the invite link: https://t.me/username?voicechat=hash + [IfFlag(1)] public string invite_hash; + /// WebRTC parameters + public DataJSON params_; + + [Flags] public enum Flags + { + /// If set, the user will be muted by default upon joining. + muted = 0x1, + /// Field has a value + has_invite_hash = 0x2, + /// If set, the user's video will be disabled by default upon joining. + video_stopped = 0x4, + } + } /// 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. @@ -17024,79 +20373,133 @@ namespace TL /// The invitation hash from the invite link: https://t.me/username?voicechat=hash /// WebRTC parameters 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 => + => client.CallAsync(new Phone_JoinGroupCall_ { - writer.Write(0xB132FF7B); - writer.Write((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)); - writer.WriteTLObject(call); - writer.WriteTLObject(join_as); - if (invite_hash != null) - writer.WriteTLString(invite_hash); - writer.WriteTLObject(params_); - return "Phone_JoinGroupCall"; + flags = (Phone_JoinGroupCall_.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + call = call, + join_as = join_as, + invite_hash = invite_hash, + params_ = params_, }); + /// Leave a group call See + [TLDef(0x500377F9)] + public partial class Phone_LeaveGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// Your source ID + public int source; + } /// Leave a group call See /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) - => client.CallAsync(writer => + => client.CallAsync(new Phone_LeaveGroupCall_ { - writer.Write(0x500377F9); - writer.WriteTLObject(call); - writer.Write(source); - return "Phone_LeaveGroupCall"; + call = call, + source = source, }); + /// Invite a set of users to a group call. See + [TLDef(0x7B393160)] + public partial class Phone_InviteToGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// The users to invite. + public InputUserBase[] users; + } /// Invite a set of users to a group call. See Possible codes: 403 (details) /// The group call /// The users to invite. public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, InputUserBase[] users) - => client.CallAsync(writer => + => client.CallAsync(new Phone_InviteToGroupCall_ { - writer.Write(0x7B393160); - writer.WriteTLObject(call); - writer.WriteTLVector(users); - return "Phone_InviteToGroupCall"; + call = call, + users = users, }); + /// Terminate a group call See + [TLDef(0x7A777135)] + public partial class Phone_DiscardGroupCall_ : ITLMethod + { + /// The group call to terminate + public InputGroupCall call; + } /// Terminate a group call See /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_DiscardGroupCall_ { - writer.Write(0x7A777135); - writer.WriteTLObject(call); - return "Phone_DiscardGroupCall"; + call = call, }); + /// Change group call settings See + [TLDef(0x74BBB43D)] + public partial class Phone_ToggleGroupCallSettings_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Group call + public InputGroupCall call; + /// Whether all users will bthat join this group calle muted by default upon joining the group call + [IfFlag(0)] public bool join_muted; + + [Flags] public enum Flags + { + /// Field has a value + has_join_muted = 0x1, + /// Invalidate existing invite links + reset_invite_hash = 0x2, + } + } /// 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 public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallSettings_ { - writer.Write(0x74BBB43D); - writer.Write((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)); - writer.WriteTLObject(call); - if (join_muted != default) - writer.Write(join_muted.Value ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallSettings"; + flags = (Phone_ToggleGroupCallSettings_.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + call = call, + join_muted = join_muted.GetValueOrDefault(), }); + /// Get info about a group call See + [TLDef(0x041845DB)] + public partial class Phone_GetGroupCall_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// Maximum number of results to return, see pagination + public int limit; + } /// Get info about a group call See /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupCall_ { - writer.Write(0x041845DB); - writer.WriteTLObject(call); - writer.Write(limit); - return "Phone_GetGroupCall"; + call = call, + limit = limit, }); + /// Get group call participants See + [TLDef(0xC558D8AB)] + public partial class Phone_GetGroupParticipants_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// If specified, will fetch group participant info about the specified peers + public InputPeer[] ids; + /// If specified, will fetch group participant info about the specified WebRTC source IDs + public int[] sources; + /// 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.
+ public string offset; + ///
Maximum number of results to return, see pagination + public int limit; + } /// Get group call participants See /// Group call /// If specified, will fetch group participant info about the specified peers @@ -17104,29 +20507,57 @@ namespace TL /// 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. /// Maximum number of results to return,
see pagination public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupParticipants_ { - writer.Write(0xC558D8AB); - writer.WriteTLObject(call); - writer.WriteTLVector(ids); - writer.WriteTLVector(sources); - writer.WriteTLString(offset); - writer.Write(limit); - return "Phone_GetGroupParticipants"; + call = call, + ids = ids, + sources = sources, + offset = offset, + limit = limit, }); + /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See + [TLDef(0xB59CF977)] + public partial class Phone_CheckGroupCall_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// Source IDs + public int[] sources; + } /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs See /// Group call /// Source IDs public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, int[] sources) - => client.CallAsync(writer => + => client.CallAsync(new Phone_CheckGroupCall_ { - writer.Write(0xB59CF977); - writer.WriteTLObject(call); - writer.WriteTLVector(sources); - return "Phone_CheckGroupCall"; + call = call, + sources = sources, }); + /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See + [TLDef(0xF128C708)] + public partial class Phone_ToggleGroupCallRecord_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call or livestream + public InputGroupCall call; + /// Recording title + [IfFlag(1)] public string title; + /// If video stream recording is enabled, whether to record in portrait or landscape mode + [IfFlag(2)] public bool video_portrait; + + [Flags] public enum Flags + { + /// Whether to start or stop recording + start = 0x1, + /// Field has a value + has_title = 0x2, + /// Whether to also record video streams + video = 0x4, + } + } /// Start or stop recording a group call: the recorded audio and video streams will be automatically sent to Saved messages (the chat with ourselves). See /// Whether to start or stop recording /// Whether to also record video streams @@ -17134,18 +20565,53 @@ namespace TL /// Recording title /// If video stream recording is enabled, whether to record in portrait or landscape mode public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, bool start = false, bool video = false, string title = null, bool? video_portrait = default) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallRecord_ { - writer.Write(0xF128C708); - writer.Write((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)); - writer.WriteTLObject(call); - if (title != null) - writer.WriteTLString(title); - if (video_portrait != default) - writer.Write(video_portrait.Value ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallRecord"; + flags = (Phone_ToggleGroupCallRecord_.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), + call = call, + title = title, + video_portrait = video_portrait.GetValueOrDefault(), }); + /// Edit information about a given group call participant See + [TLDef(0xA5273ABF)] + public partial class Phone_EditGroupCallParticipant_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + /// The group call participant (can also be the user itself) + public InputPeer participant; + /// Whether to mute or unmute the specified participant + [IfFlag(0)] public bool muted; + /// New volume + [IfFlag(1)] public int volume; + /// Raise or lower hand + [IfFlag(2)] public bool raise_hand; + /// Start or stop the video stream + [IfFlag(3)] public bool video_stopped; + /// Pause or resume the video stream + [IfFlag(4)] public bool video_paused; + /// Pause or resume the screen sharing stream + [IfFlag(5)] public bool presentation_paused; + + [Flags] public enum Flags + { + /// Field has a value + has_muted = 0x1, + /// Field has a value + has_volume = 0x2, + /// Field has a value + has_raise_hand = 0x4, + /// Field has a value + has_video_stopped = 0x8, + /// Field has a value + has_video_paused = 0x10, + /// Field has a value + has_presentation_paused = 0x20, + } + } /// 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) @@ -17156,237 +20622,389 @@ namespace TL /// Pause or resume the video stream /// Pause or resume the screen sharing stream 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 => + => client.CallAsync(new Phone_EditGroupCallParticipant_ { - writer.Write(0xA5273ABF); - writer.Write((muted != default ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != default ? 0x4 : 0) | (video_stopped != default ? 0x8 : 0) | (video_paused != default ? 0x10 : 0) | (presentation_paused != default ? 0x20 : 0)); - writer.WriteTLObject(call); - writer.WriteTLObject(participant); - if (muted != default) - writer.Write(muted.Value ? 0x997275B5 : 0xBC799737); - if (volume != null) - writer.Write(volume.Value); - if (raise_hand != default) - writer.Write(raise_hand.Value ? 0x997275B5 : 0xBC799737); - if (video_stopped != default) - writer.Write(video_stopped.Value ? 0x997275B5 : 0xBC799737); - if (video_paused != default) - writer.Write(video_paused.Value ? 0x997275B5 : 0xBC799737); - if (presentation_paused != default) - writer.Write(presentation_paused.Value ? 0x997275B5 : 0xBC799737); - return "Phone_EditGroupCallParticipant"; + flags = (Phone_EditGroupCallParticipant_.Flags)((muted != default ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != default ? 0x4 : 0) | (video_stopped != default ? 0x8 : 0) | (video_paused != default ? 0x10 : 0) | (presentation_paused != default ? 0x20 : 0)), + call = call, + participant = participant, + muted = muted.GetValueOrDefault(), + volume = volume.GetValueOrDefault(), + raise_hand = raise_hand.GetValueOrDefault(), + video_stopped = video_stopped.GetValueOrDefault(), + video_paused = video_paused.GetValueOrDefault(), + presentation_paused = presentation_paused.GetValueOrDefault(), }); + /// Edit the title of a group call or livestream See + [TLDef(0x1CA6AC0A)] + public partial class Phone_EditGroupCallTitle_ : ITLMethod + { + /// Group call + public InputGroupCall call; + /// New title + public string title; + } /// Edit the title of a group call or livestream See /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) - => client.CallAsync(writer => + => client.CallAsync(new Phone_EditGroupCallTitle_ { - writer.Write(0x1CA6AC0A); - writer.WriteTLObject(call); - writer.WriteTLString(title); - return "Phone_EditGroupCallTitle"; + call = call, + title = title, }); + /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See + [TLDef(0xEF7C213A)] + public partial class Phone_GetGroupCallJoinAs_ : ITLMethod + { + /// The dialog whose group call or livestream we're trying to join + public InputPeer peer; + } /// Get a list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See /// The dialog whose group call or livestream we're trying to join public static Task Phone_GetGroupCallJoinAs(this Client client, InputPeer peer) - => client.CallAsync(writer => + => client.CallAsync(new Phone_GetGroupCallJoinAs_ { - writer.Write(0xEF7C213A); - writer.WriteTLObject(peer); - return "Phone_GetGroupCallJoinAs"; + peer = peer, }); + /// Get an invite link for a group call or livestream See + [TLDef(0xE6AA647F)] + public partial class Phone_ExportGroupCallInvite_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The group call + public InputGroupCall call; + + [Flags] public enum Flags + { + /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). + can_self_unmute = 0x1, + } + } /// Get an invite link for a group call or livestream See /// For livestreams, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). /// The group call public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ExportGroupCallInvite_ { - writer.Write(0xE6AA647F); - writer.Write(can_self_unmute ? 0x1 : 0); - writer.WriteTLObject(call); - return "Phone_ExportGroupCallInvite"; + flags = (Phone_ExportGroupCallInvite_.Flags)(can_self_unmute ? 0x1 : 0), + call = call, }); + /// Subscribe or unsubscribe to a scheduled group call See + [TLDef(0x219C34E6)] + public partial class Phone_ToggleGroupCallStartSubscription_ : ITLMethod + { + /// Scheduled group call + public InputGroupCall call; + /// Enable or disable subscription + public bool subscribed; + } /// Subscribe or unsubscribe to a scheduled group call See /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) - => client.CallAsync(writer => + => client.CallAsync(new Phone_ToggleGroupCallStartSubscription_ { - writer.Write(0x219C34E6); - writer.WriteTLObject(call); - writer.Write(subscribed ? 0x997275B5 : 0xBC799737); - return "Phone_ToggleGroupCallStartSubscription"; + call = call, + subscribed = subscribed, }); + /// Start a scheduled group call. See + [TLDef(0x5680E342)] + public partial class Phone_StartScheduledGroupCall_ : ITLMethod + { + /// The scheduled group call + public InputGroupCall call; + } /// Start a scheduled group call. See /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_StartScheduledGroupCall_ { - writer.Write(0x5680E342); - writer.WriteTLObject(call); - return "Phone_StartScheduledGroupCall"; + call = call, }); + /// Set the default peer that will be used to join a group call in a specific dialog. See + [TLDef(0x575E1F8C)] + public partial class Phone_SaveDefaultGroupCallJoinAs_ : ITLMethod + { + /// The dialog + public InputPeer peer; + /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. + public InputPeer join_as; + } /// Set the default peer that will be used to join a group call in a specific dialog. See /// The dialog /// The default peer that will be used to join group calls in this dialog, presenting yourself as a specific user/channel. public static Task Phone_SaveDefaultGroupCallJoinAs(this Client client, InputPeer peer, InputPeer join_as) - => client.CallAsync(writer => + => client.CallAsync(new Phone_SaveDefaultGroupCallJoinAs_ { - writer.Write(0x575E1F8C); - writer.WriteTLObject(peer); - writer.WriteTLObject(join_as); - return "Phone_SaveDefaultGroupCallJoinAs"; + peer = peer, + join_as = join_as, }); + /// Start screen sharing in a call See + [TLDef(0xCBEA6BC4)] + public partial class Phone_JoinGroupCallPresentation_ : ITLMethod + { + /// The group call + public InputGroupCall call; + /// WebRTC parameters + public DataJSON params_; + } /// Start screen sharing in a call See Possible codes: 403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) - => client.CallAsync(writer => + => client.CallAsync(new Phone_JoinGroupCallPresentation_ { - writer.Write(0xCBEA6BC4); - writer.WriteTLObject(call); - writer.WriteTLObject(params_); - return "Phone_JoinGroupCallPresentation"; + call = call, + params_ = params_, }); + /// Stop screen sharing in a group call See + [TLDef(0x1C50D144)] + public partial class Phone_LeaveGroupCallPresentation_ : ITLMethod + { + /// The group call + public InputGroupCall call; + } /// Stop screen sharing in a group call See /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) - => client.CallAsync(writer => + => client.CallAsync(new Phone_LeaveGroupCallPresentation_ { - writer.Write(0x1C50D144); - writer.WriteTLObject(call); - return "Phone_LeaveGroupCallPresentation"; + call = call, }); + /// Get localization pack strings See + [TLDef(0xF2F2330A)] + public partial class Langpack_GetLangPack_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + } /// Get localization pack strings See Possible codes: 400 (details) /// Language pack name /// Language code public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLangPack_ { - writer.Write(0xF2F2330A); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - return "Langpack_GetLangPack"; + lang_pack = lang_pack, + lang_code = lang_code, }); + /// Get strings from a language pack See + [TLDef(0xEFEA3803)] + public partial class Langpack_GetStrings_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + /// Strings to get + public string[] keys; + } /// Get strings from a language pack See Possible codes: 400 (details) /// Language pack name /// Language code /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, string[] keys) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetStrings_ { - writer.Write(0xEFEA3803); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - writer.WriteTLVector(keys); - return "Langpack_GetStrings"; + lang_pack = lang_pack, + lang_code = lang_code, + keys = keys, }); + /// Get new strings in languagepack See + [TLDef(0xCD984AA5)] + public partial class Langpack_GetDifference_ : ITLMethod + { + /// Language pack + public string lang_pack; + /// Language code + public string lang_code; + /// Previous localization pack version + public int from_version; + } /// Get new strings in languagepack See Possible codes: 400 (details) /// Language pack /// Language code /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetDifference_ { - writer.Write(0xCD984AA5); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - writer.Write(from_version); - return "Langpack_GetDifference"; + lang_pack = lang_pack, + lang_code = lang_code, + from_version = from_version, }); + /// Get information about all languages in a localization pack See + [TLDef(0x42C6978F)] + public partial class Langpack_GetLanguages_ : ITLMethod + { + /// Language pack + public string lang_pack; + } /// Get information about all languages in a localization pack See Possible codes: 400 (details) /// Language pack public static Task Langpack_GetLanguages(this Client client, string lang_pack) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLanguages_ { - writer.Write(0x42C6978F); - writer.WriteTLString(lang_pack); - return "Langpack_GetLanguages"; + lang_pack = lang_pack, }); + /// Get information about a language in a localization pack See + [TLDef(0x6A596502)] + public partial class Langpack_GetLanguage_ : ITLMethod + { + /// Language pack name + public string lang_pack; + /// Language code + public string lang_code; + } /// Get information about a language in a localization pack See /// Language pack name /// Language code public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) - => client.CallAsync(writer => + => client.CallAsync(new Langpack_GetLanguage_ { - writer.Write(0x6A596502); - writer.WriteTLString(lang_pack); - writer.WriteTLString(lang_code); - return "Langpack_GetLanguage"; + lang_pack = lang_pack, + lang_code = lang_code, }); + /// Edit peers in peer folder See + [TLDef(0x6847D0AB)] + public partial class Folders_EditPeerFolders_ : ITLMethod + { + /// New peer list + public InputFolderPeer[] folder_peers; + } /// Edit peers in peer folder See Possible codes: 400 (details) /// New peer list public static Task Folders_EditPeerFolders(this Client client, InputFolderPeer[] folder_peers) - => client.CallAsync(writer => + => client.CallAsync(new Folders_EditPeerFolders_ { - writer.Write(0x6847D0AB); - writer.WriteTLVector(folder_peers); - return "Folders_EditPeerFolders"; + folder_peers = folder_peers, }); + /// Delete a peer folder See + [TLDef(0x1C295881)] + public partial class Folders_DeleteFolder_ : ITLMethod + { + /// Peer folder ID, for more info click here + public int folder_id; + } /// Delete a peer folder See Possible codes: 400 (details) /// Peer folder ID, for more info click here public static Task Folders_DeleteFolder(this Client client, int folder_id) - => client.CallAsync(writer => + => client.CallAsync(new Folders_DeleteFolder_ { - writer.Write(0x1C295881); - writer.Write(folder_id); - return "Folders_DeleteFolder"; + folder_id = folder_id, }); + /// Get channel statistics See + [TLDef(0xAB42441A)] + public partial class Stats_GetBroadcastStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// The channel + public InputChannelBase channel; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get channel statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetBroadcastStats_ { - writer.Write(0xAB42441A); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - return "Stats_GetBroadcastStats"; + flags = (Stats_GetBroadcastStats_.Flags)(dark ? 0x1 : 0), + channel = channel, }); + /// Load channel statistics graph asynchronously See + [TLDef(0x621D5FA0)] + public partial class Stats_LoadAsyncGraph_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Graph token from constructor + public string token; + /// Zoom value, if required + [IfFlag(0)] public long x; + + [Flags] public enum Flags + { + /// Field has a value + has_x = 0x1, + } + } /// Load channel statistics graph asynchronously See Possible codes: 400 (details) /// Graph token from constructor /// Zoom value, if required public static Task Stats_LoadAsyncGraph(this Client client, string token, long? x = null) - => client.CallAsync(writer => + => client.CallAsync(new Stats_LoadAsyncGraph_ { - writer.Write(0x621D5FA0); - writer.Write(x != null ? 0x1 : 0); - writer.WriteTLString(token); - if (x != null) - writer.Write(x.Value); - return "Stats_LoadAsyncGraph"; + flags = (Stats_LoadAsyncGraph_.Flags)(x != null ? 0x1 : 0), + token = token, + x = x.GetValueOrDefault(), }); + /// Get supergroup statistics See + [TLDef(0xDCDF8607)] + public partial class Stats_GetMegagroupStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Supergroup ID + public InputChannelBase channel; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get supergroup statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetMegagroupStats_ { - writer.Write(0xDCDF8607); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - return "Stats_GetMegagroupStats"; + flags = (Stats_GetMegagroupStats_.Flags)(dark ? 0x1 : 0), + channel = channel, }); + /// 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
+ [TLDef(0x5630281B)] + public partial class Stats_GetMessagePublicForwards_ : ITLMethod + { + /// Source channel + public InputChannelBase channel; + /// Source message ID + public int msg_id; + /// Initially 0, then set to the next_rate parameter of + public int offset_rate; + /// Offsets for pagination, for more info click here + public InputPeer offset_peer; + /// Offsets for pagination, for more info click here + public int offset_id; + /// Maximum number of results to return, see pagination + public int limit; + } /// 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 @@ -17395,30 +21013,43 @@ namespace TL /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination 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 => + => client.CallAsync(new Stats_GetMessagePublicForwards_ { - writer.Write(0x5630281B); - writer.WriteTLObject(channel); - writer.Write(msg_id); - writer.Write(offset_rate); - writer.WriteTLObject(offset_peer); - writer.Write(offset_id); - writer.Write(limit); - return "Stats_GetMessagePublicForwards"; + channel = channel, + msg_id = msg_id, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, }); + /// Get message statistics See + [TLDef(0xB6E0A3F5)] + public partial class Stats_GetMessageStats_ : ITLMethod + { + /// Flags, see TL conditional fields + public Flags flags; + /// Channel ID + public InputChannelBase channel; + /// Message ID + public int msg_id; + + [Flags] public enum Flags + { + /// Whether to enable dark theme for graph colors + dark = 0x1, + } + } /// Get message statistics See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Channel ID /// Message ID public static Task Stats_GetMessageStats(this Client client, InputChannelBase channel, int msg_id, bool dark = false) - => client.CallAsync(writer => + => client.CallAsync(new Stats_GetMessageStats_ { - writer.Write(0xB6E0A3F5); - writer.Write(dark ? 0x1 : 0); - writer.WriteTLObject(channel); - writer.Write(msg_id); - return "Stats_GetMessageStats"; + flags = (Stats_GetMessageStats_.Flags)(dark ? 0x1 : 0), + channel = channel, + msg_id = msg_id, }); } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 127554e..37e3e53 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -34,7 +34,7 @@ namespace TL [0x3BCBF734] = typeof(DhGenOk), [0x46DC1FB9] = typeof(DhGenRetry), [0xA69DAE02] = typeof(DhGenFail), - [0x7ABE77EC] = typeof(Ping), + [0x7ABE77EC] = typeof(MTProto.Ping_), [0x62D6B459] = typeof(MsgsAck), [0xA7EFF811] = typeof(BadMsgNotification), [0xEDAB447B] = typeof(BadServerSalt), diff --git a/src/TL.cs b/src/TL.cs index e9b2d30..b8086c6 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -10,7 +10,7 @@ using System.Text; namespace TL { public interface ITLObject { } - public delegate string ITLFunction(BinaryWriter writer); + public interface ITLMethod : ITLObject { } public static class Serialization { @@ -94,6 +94,8 @@ namespace TL if (type.IsArray) if (value is byte[] bytes) writer.WriteTLBytes(bytes); + else if (value is _Message[] messages) + writer.WriteTLMessages(messages); else writer.WriteTLVector((Array)value); else if (value is Int128 int128) @@ -164,6 +166,26 @@ namespace TL writer.WriteTLValue(array.GetValue(i), elementType); } + internal static void WriteTLMessages(this BinaryWriter writer, _Message[] messages) + { + writer.Write(messages.Length); + foreach (var msg in messages) + { + writer.Write(msg.msg_id); + writer.Write(msg.seqno); + var patchPos = writer.BaseStream.Position; + writer.Write(0); // patched below + writer.WriteTLObject(msg.body); + if ((msg.seqno & 1) != 0) + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40} #{(short)msg.msg_id.GetHashCode():X4}"); + else + WTelegram.Helpers.Log(1, $" Sending → {msg.body.GetType().Name,-40}"); + writer.BaseStream.Position = patchPos; + writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field + writer.Seek(0, SeekOrigin.End); + } + } + internal static Array ReadTLVector(this BinaryReader reader, Type type) { var elementType = type.GetElementType();