mirror of
https://github.com/sochix/TLSharp.git
synced 2026-04-05 06:26:44 +00:00
Add methods for working with contacts. (#896)
Added methods for working with contacts: * Import contact list * Delete contact list * Delete one contact
This commit is contained in:
parent
3c6f53be68
commit
c9ac0bab87
2 changed files with 41 additions and 1 deletions
|
|
@ -234,6 +234,36 @@ namespace TLSharp.Core
|
|||
return (T)result;
|
||||
}
|
||||
|
||||
public async Task<TLImportedContacts> ImportContactsAsync(IReadOnlyList<TLInputPhoneContact> contacts)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
var req = new TLRequestImportContacts { Contacts = new TLVector<TLInputPhoneContact>(contacts)};
|
||||
|
||||
return await SendRequestAsync<TLImportedContacts>(req);
|
||||
}
|
||||
|
||||
public async Task<bool> DeleteContactsAsync(IReadOnlyList<TLAbsInputUser> users)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
var req = new TLRequestDeleteContacts {Id = new TLVector<TLAbsInputUser>(users)};
|
||||
|
||||
return await SendRequestAsync<bool>(req);
|
||||
}
|
||||
|
||||
public async Task<TLLink> DeleteContactAsync(TLAbsInputUser user)
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
throw new InvalidOperationException("Authorize user first!");
|
||||
|
||||
var req = new TLRequestDeleteContact {Id = user};
|
||||
|
||||
return await SendRequestAsync<TLLink>(req);
|
||||
}
|
||||
|
||||
public async Task<TLContacts> GetContactsAsync()
|
||||
{
|
||||
if (!IsUserAuthorized())
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue