mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Add methods for working with usernames. (#897)
Added methods for working with usernames: Check username (Validates a username and checks availability) Update username (Changes username for the current user)
This commit is contained in:
parent
c9ac0bab87
commit
0a91487ea7
|
|
@ -234,6 +234,26 @@ namespace TLSharp.Core
|
||||||
return (T)result;
|
return (T)result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public async Task<TLUser> UpdateUsernameAsync(string username)
|
||||||
|
{
|
||||||
|
if (!IsUserAuthorized())
|
||||||
|
throw new InvalidOperationException("Authorize user first!");
|
||||||
|
|
||||||
|
var req = new TLRequestUpdateUsername { Username = username };
|
||||||
|
|
||||||
|
return await SendRequestAsync<TLUser>(req);
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task<bool> CheckUsernameAsync(string username)
|
||||||
|
{
|
||||||
|
if (!IsUserAuthorized())
|
||||||
|
throw new InvalidOperationException("Authorize user first!");
|
||||||
|
|
||||||
|
var req = new TLRequestCheckUsername { Username = username };
|
||||||
|
|
||||||
|
return await SendRequestAsync<bool>(req);
|
||||||
|
}
|
||||||
|
|
||||||
public async Task<TLImportedContacts> ImportContactsAsync(IReadOnlyList<TLInputPhoneContact> contacts)
|
public async Task<TLImportedContacts> ImportContactsAsync(IReadOnlyList<TLInputPhoneContact> contacts)
|
||||||
{
|
{
|
||||||
if (!IsUserAuthorized())
|
if (!IsUserAuthorized())
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue