diff --git a/TLSharp.Core/TelegramClient.cs b/TLSharp.Core/TelegramClient.cs index f7e0258..d86b349 100644 --- a/TLSharp.Core/TelegramClient.cs +++ b/TLSharp.Core/TelegramClient.cs @@ -234,6 +234,36 @@ namespace TLSharp.Core return (T)result; } + public async Task ImportContactsAsync(IReadOnlyList contacts) + { + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestImportContacts { Contacts = new TLVector(contacts)}; + + return await SendRequestAsync(req); + } + + public async Task DeleteContactsAsync(IReadOnlyList users) + { + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestDeleteContacts {Id = new TLVector(users)}; + + return await SendRequestAsync(req); + } + + public async Task DeleteContactAsync(TLAbsInputUser user) + { + if (!IsUserAuthorized()) + throw new InvalidOperationException("Authorize user first!"); + + var req = new TLRequestDeleteContact {Id = user}; + + return await SendRequestAsync(req); + } + public async Task GetContactsAsync() { if (!IsUserAuthorized()) diff --git a/TeleSharp.TL/TLVector.cs b/TeleSharp.TL/TLVector.cs index 4df828b..29f82e7 100644 --- a/TeleSharp.TL/TLVector.cs +++ b/TeleSharp.TL/TLVector.cs @@ -11,7 +11,17 @@ namespace TeleSharp.TL public class TLVector : TLObject, IList { [TLObject(481674261)] - private List lists = new List(); + private List lists; + + public TLVector(IEnumerable collection) + { + lists = new List(collection); + } + + public TLVector() + { + lists = new List(); + } public T this[int index] {