"""File generated by TLObjects' generator. All changes will be ERASED""" from ...tl.tlobject import TLObject from ...tl.tlobject import TLRequest from typing import Optional, List, Union, TYPE_CHECKING import os import struct from datetime import datetime if TYPE_CHECKING: from ...tl.types import TypeCodeSettings, TypeEmailVerification, TypeInputCheckPasswordSRP from ...tl.types.account import TypePasswordInputSettings class AcceptLoginTokenRequest(TLRequest): CONSTRUCTOR_ID = 0xe894ad4d SUBCLASS_OF_ID = 0xc913c01a def __init__(self, token: bytes): """ :returns Authorization: Instance of Authorization. """ self.token = token def to_dict(self): return { '_': 'AcceptLoginTokenRequest', 'token': self.token } def _bytes(self): return b''.join(( b'M\xad\x94\xe8', self.serialize_bytes(self.token), )) @classmethod def from_reader(cls, reader): _token = reader.tgread_bytes() return cls(token=_token) class BindTempAuthKeyRequest(TLRequest): CONSTRUCTOR_ID = 0xcdd42a05 SUBCLASS_OF_ID = 0xf5b399ac def __init__(self, perm_auth_key_id: int, nonce: int, expires_at: Optional[datetime], encrypted_message: bytes): """ :returns Bool: This type has no constructors. """ self.perm_auth_key_id = perm_auth_key_id self.nonce = nonce self.expires_at = expires_at self.encrypted_message = encrypted_message def to_dict(self): return { '_': 'BindTempAuthKeyRequest', 'perm_auth_key_id': self.perm_auth_key_id, 'nonce': self.nonce, 'expires_at': self.expires_at, 'encrypted_message': self.encrypted_message } def _bytes(self): return b''.join(( b'\x05*\xd4\xcd', struct.pack('', )) @classmethod def from_reader(cls, reader): return cls() class RecoverPasswordRequest(TLRequest): CONSTRUCTOR_ID = 0x37096c70 SUBCLASS_OF_ID = 0xb9e04e39 def __init__(self, code: str, new_settings: Optional['TypePasswordInputSettings']=None): """ :returns auth.Authorization: Instance of either Authorization, AuthorizationSignUpRequired. """ self.code = code self.new_settings = new_settings def to_dict(self): return { '_': 'RecoverPasswordRequest', 'code': self.code, 'new_settings': self.new_settings.to_dict() if isinstance(self.new_settings, TLObject) else self.new_settings } def _bytes(self): return b''.join(( b'pl\t7', struct.pack('', self.serialize_bytes(self.phone_number), self.serialize_bytes(self.phone_code_hash), )) @classmethod def from_reader(cls, reader): _phone_number = reader.tgread_string() _phone_code_hash = reader.tgread_string() return cls(phone_number=_phone_number, phone_code_hash=_phone_code_hash) class ResetAuthorizationsRequest(TLRequest): CONSTRUCTOR_ID = 0x9fab0d1a SUBCLASS_OF_ID = 0xf5b399ac def to_dict(self): return { '_': 'ResetAuthorizationsRequest' } def _bytes(self): return b''.join(( b'\x1a\r\xab\x9f', )) @classmethod def from_reader(cls, reader): return cls() class ResetLoginEmailRequest(TLRequest): CONSTRUCTOR_ID = 0x7e960193 SUBCLASS_OF_ID = 0x6ce87081 def __init__(self, phone_number: str, phone_code_hash: str): """ :returns auth.SentCode: Instance of either SentCode, SentCodeSuccess. """ self.phone_number = phone_number self.phone_code_hash = phone_code_hash def to_dict(self): return { '_': 'ResetLoginEmailRequest', 'phone_number': self.phone_number, 'phone_code_hash': self.phone_code_hash } def _bytes(self): return b''.join(( b'\x93\x01\x96~', self.serialize_bytes(self.phone_number), self.serialize_bytes(self.phone_code_hash), )) @classmethod def from_reader(cls, reader): _phone_number = reader.tgread_string() _phone_code_hash = reader.tgread_string() return cls(phone_number=_phone_number, phone_code_hash=_phone_code_hash) class SendCodeRequest(TLRequest): CONSTRUCTOR_ID = 0xa677244f SUBCLASS_OF_ID = 0x6ce87081 def __init__(self, phone_number: str, api_id: int, api_hash: str, settings: 'TypeCodeSettings'): """ :returns auth.SentCode: Instance of either SentCode, SentCodeSuccess. """ self.phone_number = phone_number self.api_id = api_id self.api_hash = api_hash self.settings = settings def to_dict(self): return { '_': 'SendCodeRequest', 'phone_number': self.phone_number, 'api_id': self.api_id, 'api_hash': self.api_hash, 'settings': self.settings.to_dict() if isinstance(self.settings, TLObject) else self.settings } def _bytes(self): return b''.join(( b'O$w\xa6', self.serialize_bytes(self.phone_number), struct.pack('