mirror of
https://github.com/sochix/TLSharp.git
synced 2025-12-06 08:02:00 +01:00
Require some parameters as non empty & not null before proceeding
This commit is contained in:
parent
a029c33e34
commit
34e89f3f37
|
|
@ -99,6 +99,9 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber)
|
public async Task<bool> IsPhoneRegisteredAsync(string phoneNumber)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||||
|
throw new ArgumentNullException(nameof(phoneNumber));
|
||||||
|
|
||||||
if (_sender == null)
|
if (_sender == null)
|
||||||
throw new InvalidOperationException("Not connected!");
|
throw new InvalidOperationException("Not connected!");
|
||||||
|
|
||||||
|
|
@ -111,6 +114,9 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
public async Task<string> SendCodeRequestAsync(string phoneNumber)
|
public async Task<string> SendCodeRequestAsync(string phoneNumber)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||||
|
throw new ArgumentNullException(nameof(phoneNumber));
|
||||||
|
|
||||||
var completed = false;
|
var completed = false;
|
||||||
|
|
||||||
TLRequestSendCode request = null;
|
TLRequestSendCode request = null;
|
||||||
|
|
@ -136,6 +142,15 @@ namespace TLSharp.Core
|
||||||
|
|
||||||
public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code)
|
public async Task<TLUser> MakeAuthAsync(string phoneNumber, string phoneCodeHash, string code)
|
||||||
{
|
{
|
||||||
|
if (String.IsNullOrWhiteSpace(phoneNumber))
|
||||||
|
throw new ArgumentNullException(nameof(phoneNumber));
|
||||||
|
|
||||||
|
if (String.IsNullOrWhiteSpace(phoneCodeHash))
|
||||||
|
throw new ArgumentNullException(nameof(phoneCodeHash));
|
||||||
|
|
||||||
|
if (String.IsNullOrWhiteSpace(code))
|
||||||
|
throw new ArgumentNullException(nameof(code));
|
||||||
|
|
||||||
var request = new TLRequestSignIn() { phone_number = phoneNumber, phone_code_hash = phoneCodeHash, phone_code = code };
|
var request = new TLRequestSignIn() { phone_number = phoneNumber, phone_code_hash = phoneCodeHash, phone_code = code };
|
||||||
await _sender.Send(request);
|
await _sender.Send(request);
|
||||||
await _sender.Receive(request);
|
await _sender.Receive(request);
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue