public static async Task <TlContacts> GetContactsAsync(this ITelegramClient client)
        {
            if (!client.IsUserAuthorized())
            {
                throw new InvalidOperationException("Authorize user first!");
            }

            var req = new TlRequestGetContacts {
                Hash = ""
            };

            return(await client.SendRequestAsync <TlContacts>(req));
        }
        public static async Task <TlAbsMessages> GetHistoryAsync(this ITelegramClient client, TlAbsInputPeer peer, int offset, int maxId, int limit)
        {
            if (!client.IsUserAuthorized())
            {
                throw new InvalidOperationException("Authorize user first!");
            }

            var req = new TlRequestGetHistory
            {
                Peer      = peer,
                AddOffset = offset,
                MaxId     = maxId,
                Limit     = limit
            };

            return(await client.SendRequestAsync <TlAbsMessages>(req));
        }
 public bool Authorize()
 {
     _client.ConnectAsync().Wait();
     return(_client.IsUserAuthorized());
 }