2015-09-28 04:01:17 +02:00
|
|
|
|
using System;
|
|
|
|
|
|
using System.IO;
|
2016-09-22 15:31:59 +02:00
|
|
|
|
using TeleSharp.TL;
|
2015-09-28 04:01:17 +02:00
|
|
|
|
namespace TLSharp.Core.Requests
|
|
|
|
|
|
{
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public class AuthSignInRequest : MTProtoRequest
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
private SignInArgs args = new SignInArgs();
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public User user;
|
|
|
|
|
|
public int SessionExpires;
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public AuthSignInRequest(string phoneNumber, string phoneCodeHash, string code)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
args.phone_number = phoneNumber;
|
|
|
|
|
|
args.phone_code_hash = phoneCodeHash;
|
|
|
|
|
|
args.phone_code = code;
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnSend(BinaryWriter writer)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
Serializer.Serialize(args, typeof(SignInArgs), writer);
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnResponse(BinaryReader reader)
|
|
|
|
|
|
{
|
2016-09-22 15:31:59 +02:00
|
|
|
|
var auth = (Authorization)Deserializer.Deserialize(typeof(Authorization), reader);
|
|
|
|
|
|
user = auth.user;
|
2016-04-18 12:50:57 +02:00
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override void OnException(Exception exception)
|
|
|
|
|
|
{
|
|
|
|
|
|
throw new NotImplementedException();
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
|
2016-04-18 12:50:57 +02:00
|
|
|
|
public override bool Confirmed => true;
|
|
|
|
|
|
public override bool Responded { get; }
|
|
|
|
|
|
}
|
2015-09-28 04:01:17 +02:00
|
|
|
|
}
|