#
# Autogenerated by Thrift Compiler (0.13.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#
#  options string: py
#

from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
from thrift.protocol.TProtocol import TProtocolException
from thrift.TRecursive import fix_spec

import sys
import logging
from .ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
all_structs = []


class Iface(object):
    def openSession(self, request):
        """
        Parameters:
         - request

        """
        pass

    def getAcctVerifMethod(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        pass

    def registerPrimaryUsingPhone(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        pass

    def migratePrimaryUsingPhone(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        pass

    def getPhoneVerifMethod(self, authSessionId, device, userPhoneNumber):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber

        """
        pass

    def verifyPhone(self, authSessionId, device, userPhoneNumber, pinCode):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber
         - pinCode

        """
        pass

    def verifyAccountUsingPwd(self, authSessionId, accountIdentifier, encryptedPassword):
        """
        Parameters:
         - authSessionId
         - accountIdentifier
         - encryptedPassword

        """
        pass

    def validateProfile(self, authSessionId, displayName):
        """
        Parameters:
         - authSessionId
         - displayName

        """
        pass

    def getUserProfile(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        pass

    def issueWebAuthDetailsForAcctVerif(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        pass

    def issueWebAuthDetailsForSecondAuth(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        pass

    def exchangeEncryptionKey(self, authSessionId, request):
        """
        Parameters:
         - authSessionId
         - request

        """
        pass

    def setPassword(self, authSessionId, encryptedPassword):
        """
        Parameters:
         - authSessionId
         - encryptedPassword

        """
        pass

    def sendPinCodeForPhone(self, authSessionId, device, userPhoneNumber, verifMethod):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber
         - verifMethod

        """
        pass

    def getSecondAuthMethod(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        pass


class Client(Iface):
    def __init__(self, iprot, oprot=None):
        self._iprot = self._oprot = iprot
        if oprot is not None:
            self._oprot = oprot
        self._seqid = 0

    def openSession(self, request):
        """
        Parameters:
         - request

        """
        self.send_openSession(request)
        return self.recv_openSession()

    def send_openSession(self, request):
        self._oprot.writeMessageBegin('openSession', TMessageType.CALL, self._seqid)
        args = openSession_args()
        args.request = request
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_openSession(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = openSession_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "openSession failed: unknown result")

    def getAcctVerifMethod(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        self.send_getAcctVerifMethod(authSessionId, accountIdentifier)
        return self.recv_getAcctVerifMethod()

    def send_getAcctVerifMethod(self, authSessionId, accountIdentifier):
        self._oprot.writeMessageBegin('getAcctVerifMethod', TMessageType.CALL, self._seqid)
        args = getAcctVerifMethod_args()
        args.authSessionId = authSessionId
        args.accountIdentifier = accountIdentifier
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getAcctVerifMethod(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getAcctVerifMethod_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getAcctVerifMethod failed: unknown result")

    def registerPrimaryUsingPhone(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        self.send_registerPrimaryUsingPhone(authSessionId)
        return self.recv_registerPrimaryUsingPhone()

    def send_registerPrimaryUsingPhone(self, authSessionId):
        self._oprot.writeMessageBegin('registerPrimaryUsingPhone', TMessageType.CALL, self._seqid)
        args = registerPrimaryUsingPhone_args()
        args.authSessionId = authSessionId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_registerPrimaryUsingPhone(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = registerPrimaryUsingPhone_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "registerPrimaryUsingPhone failed: unknown result")

    def migratePrimaryUsingPhone(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        self.send_migratePrimaryUsingPhone(authSessionId)
        return self.recv_migratePrimaryUsingPhone()

    def send_migratePrimaryUsingPhone(self, authSessionId):
        self._oprot.writeMessageBegin('migratePrimaryUsingPhone', TMessageType.CALL, self._seqid)
        args = migratePrimaryUsingPhone_args()
        args.authSessionId = authSessionId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_migratePrimaryUsingPhone(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = migratePrimaryUsingPhone_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "migratePrimaryUsingPhone failed: unknown result")

    def getPhoneVerifMethod(self, authSessionId, device, userPhoneNumber):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber

        """
        self.send_getPhoneVerifMethod(authSessionId, device, userPhoneNumber)
        return self.recv_getPhoneVerifMethod()

    def send_getPhoneVerifMethod(self, authSessionId, device, userPhoneNumber):
        self._oprot.writeMessageBegin('getPhoneVerifMethod', TMessageType.CALL, self._seqid)
        args = getPhoneVerifMethod_args()
        args.authSessionId = authSessionId
        args.device = device
        args.userPhoneNumber = userPhoneNumber
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getPhoneVerifMethod(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getPhoneVerifMethod_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getPhoneVerifMethod failed: unknown result")

    def verifyPhone(self, authSessionId, device, userPhoneNumber, pinCode):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber
         - pinCode

        """
        self.send_verifyPhone(authSessionId, device, userPhoneNumber, pinCode)
        return self.recv_verifyPhone()

    def send_verifyPhone(self, authSessionId, device, userPhoneNumber, pinCode):
        self._oprot.writeMessageBegin('verifyPhone', TMessageType.CALL, self._seqid)
        args = verifyPhone_args()
        args.authSessionId = authSessionId
        args.device = device
        args.userPhoneNumber = userPhoneNumber
        args.pinCode = pinCode
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_verifyPhone(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = verifyPhone_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "verifyPhone failed: unknown result")

    def verifyAccountUsingPwd(self, authSessionId, accountIdentifier, encryptedPassword):
        """
        Parameters:
         - authSessionId
         - accountIdentifier
         - encryptedPassword

        """
        self.send_verifyAccountUsingPwd(authSessionId, accountIdentifier, encryptedPassword)
        return self.recv_verifyAccountUsingPwd()

    def send_verifyAccountUsingPwd(self, authSessionId, accountIdentifier, encryptedPassword):
        self._oprot.writeMessageBegin('verifyAccountUsingPwd', TMessageType.CALL, self._seqid)
        args = verifyAccountUsingPwd_args()
        args.authSessionId = authSessionId
        args.accountIdentifier = accountIdentifier
        args.encryptedPassword = encryptedPassword
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_verifyAccountUsingPwd(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = verifyAccountUsingPwd_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "verifyAccountUsingPwd failed: unknown result")

    def validateProfile(self, authSessionId, displayName):
        """
        Parameters:
         - authSessionId
         - displayName

        """
        self.send_validateProfile(authSessionId, displayName)
        return self.recv_validateProfile()

    def send_validateProfile(self, authSessionId, displayName):
        self._oprot.writeMessageBegin('validateProfile', TMessageType.CALL, self._seqid)
        args = validateProfile_args()
        args.authSessionId = authSessionId
        args.displayName = displayName
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_validateProfile(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = validateProfile_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "validateProfile failed: unknown result")

    def getUserProfile(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        self.send_getUserProfile(authSessionId, accountIdentifier)
        return self.recv_getUserProfile()

    def send_getUserProfile(self, authSessionId, accountIdentifier):
        self._oprot.writeMessageBegin('getUserProfile', TMessageType.CALL, self._seqid)
        args = getUserProfile_args()
        args.authSessionId = authSessionId
        args.accountIdentifier = accountIdentifier
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getUserProfile(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getUserProfile_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getUserProfile failed: unknown result")

    def issueWebAuthDetailsForAcctVerif(self, authSessionId, accountIdentifier):
        """
        Parameters:
         - authSessionId
         - accountIdentifier

        """
        self.send_issueWebAuthDetailsForAcctVerif(authSessionId, accountIdentifier)
        return self.recv_issueWebAuthDetailsForAcctVerif()

    def send_issueWebAuthDetailsForAcctVerif(self, authSessionId, accountIdentifier):
        self._oprot.writeMessageBegin('issueWebAuthDetailsForAcctVerif', TMessageType.CALL, self._seqid)
        args = issueWebAuthDetailsForAcctVerif_args()
        args.authSessionId = authSessionId
        args.accountIdentifier = accountIdentifier
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_issueWebAuthDetailsForAcctVerif(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = issueWebAuthDetailsForAcctVerif_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "issueWebAuthDetailsForAcctVerif failed: unknown result")

    def issueWebAuthDetailsForSecondAuth(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        self.send_issueWebAuthDetailsForSecondAuth(authSessionId)
        return self.recv_issueWebAuthDetailsForSecondAuth()

    def send_issueWebAuthDetailsForSecondAuth(self, authSessionId):
        self._oprot.writeMessageBegin('issueWebAuthDetailsForSecondAuth', TMessageType.CALL, self._seqid)
        args = issueWebAuthDetailsForSecondAuth_args()
        args.authSessionId = authSessionId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_issueWebAuthDetailsForSecondAuth(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = issueWebAuthDetailsForSecondAuth_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "issueWebAuthDetailsForSecondAuth failed: unknown result")

    def exchangeEncryptionKey(self, authSessionId, request):
        """
        Parameters:
         - authSessionId
         - request

        """
        self.send_exchangeEncryptionKey(authSessionId, request)
        return self.recv_exchangeEncryptionKey()

    def send_exchangeEncryptionKey(self, authSessionId, request):
        self._oprot.writeMessageBegin('exchangeEncryptionKey', TMessageType.CALL, self._seqid)
        args = exchangeEncryptionKey_args()
        args.authSessionId = authSessionId
        args.request = request
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_exchangeEncryptionKey(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = exchangeEncryptionKey_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "exchangeEncryptionKey failed: unknown result")

    def setPassword(self, authSessionId, encryptedPassword):
        """
        Parameters:
         - authSessionId
         - encryptedPassword

        """
        self.send_setPassword(authSessionId, encryptedPassword)
        return self.recv_setPassword()

    def send_setPassword(self, authSessionId, encryptedPassword):
        self._oprot.writeMessageBegin('setPassword', TMessageType.CALL, self._seqid)
        args = setPassword_args()
        args.authSessionId = authSessionId
        args.encryptedPassword = encryptedPassword
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_setPassword(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = setPassword_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "setPassword failed: unknown result")

    def sendPinCodeForPhone(self, authSessionId, device, userPhoneNumber, verifMethod):
        """
        Parameters:
         - authSessionId
         - device
         - userPhoneNumber
         - verifMethod

        """
        self.send_sendPinCodeForPhone(authSessionId, device, userPhoneNumber, verifMethod)
        return self.recv_sendPinCodeForPhone()

    def send_sendPinCodeForPhone(self, authSessionId, device, userPhoneNumber, verifMethod):
        self._oprot.writeMessageBegin('sendPinCodeForPhone', TMessageType.CALL, self._seqid)
        args = sendPinCodeForPhone_args()
        args.authSessionId = authSessionId
        args.device = device
        args.userPhoneNumber = userPhoneNumber
        args.verifMethod = verifMethod
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_sendPinCodeForPhone(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = sendPinCodeForPhone_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "sendPinCodeForPhone failed: unknown result")

    def getSecondAuthMethod(self, authSessionId):
        """
        Parameters:
         - authSessionId

        """
        self.send_getSecondAuthMethod(authSessionId)
        return self.recv_getSecondAuthMethod()

    def send_getSecondAuthMethod(self, authSessionId):
        self._oprot.writeMessageBegin('getSecondAuthMethod', TMessageType.CALL, self._seqid)
        args = getSecondAuthMethod_args()
        args.authSessionId = authSessionId
        args.write(self._oprot)
        self._oprot.writeMessageEnd()
        self._oprot.trans.flush()

    def recv_getSecondAuthMethod(self):
        iprot = self._iprot
        (fname, mtype, rseqid) = iprot.readMessageBegin()
        if mtype == TMessageType.EXCEPTION:
            x = TApplicationException()
            x.read(iprot)
            iprot.readMessageEnd()
            raise x
        result = getSecondAuthMethod_result()
        result.read(iprot)
        iprot.readMessageEnd()
        if result.success is not None:
            return result.success
        if result.e is not None:
            raise result.e
        raise TApplicationException(TApplicationException.MISSING_RESULT, "getSecondAuthMethod failed: unknown result")


class Processor(Iface, TProcessor):
    def __init__(self, handler):
        self._handler = handler
        self._processMap = {}
        self._processMap["openSession"] = Processor.process_openSession
        self._processMap["getAcctVerifMethod"] = Processor.process_getAcctVerifMethod
        self._processMap["registerPrimaryUsingPhone"] = Processor.process_registerPrimaryUsingPhone
        self._processMap["migratePrimaryUsingPhone"] = Processor.process_migratePrimaryUsingPhone
        self._processMap["getPhoneVerifMethod"] = Processor.process_getPhoneVerifMethod
        self._processMap["verifyPhone"] = Processor.process_verifyPhone
        self._processMap["verifyAccountUsingPwd"] = Processor.process_verifyAccountUsingPwd
        self._processMap["validateProfile"] = Processor.process_validateProfile
        self._processMap["getUserProfile"] = Processor.process_getUserProfile
        self._processMap["issueWebAuthDetailsForAcctVerif"] = Processor.process_issueWebAuthDetailsForAcctVerif
        self._processMap["issueWebAuthDetailsForSecondAuth"] = Processor.process_issueWebAuthDetailsForSecondAuth
        self._processMap["exchangeEncryptionKey"] = Processor.process_exchangeEncryptionKey
        self._processMap["setPassword"] = Processor.process_setPassword
        self._processMap["sendPinCodeForPhone"] = Processor.process_sendPinCodeForPhone
        self._processMap["getSecondAuthMethod"] = Processor.process_getSecondAuthMethod
        self._on_message_begin = None

    def on_message_begin(self, func):
        self._on_message_begin = func

    def process(self, iprot, oprot):
        (name, type, seqid) = iprot.readMessageBegin()
        if self._on_message_begin:
            self._on_message_begin(name, type, seqid)
        if name not in self._processMap:
            iprot.skip(TType.STRUCT)
            iprot.readMessageEnd()
            x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
            oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
            x.write(oprot)
            oprot.writeMessageEnd()
            oprot.trans.flush()
            return
        else:
            self._processMap[name](self, seqid, iprot, oprot)
        return True

    def process_openSession(self, seqid, iprot, oprot):
        args = openSession_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = openSession_result()
        try:
            result.success = self._handler.openSession(args.request)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("openSession", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getAcctVerifMethod(self, seqid, iprot, oprot):
        args = getAcctVerifMethod_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getAcctVerifMethod_result()
        try:
            result.success = self._handler.getAcctVerifMethod(args.authSessionId, args.accountIdentifier)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getAcctVerifMethod", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_registerPrimaryUsingPhone(self, seqid, iprot, oprot):
        args = registerPrimaryUsingPhone_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = registerPrimaryUsingPhone_result()
        try:
            result.success = self._handler.registerPrimaryUsingPhone(args.authSessionId)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("registerPrimaryUsingPhone", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_migratePrimaryUsingPhone(self, seqid, iprot, oprot):
        args = migratePrimaryUsingPhone_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = migratePrimaryUsingPhone_result()
        try:
            result.success = self._handler.migratePrimaryUsingPhone(args.authSessionId)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("migratePrimaryUsingPhone", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getPhoneVerifMethod(self, seqid, iprot, oprot):
        args = getPhoneVerifMethod_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getPhoneVerifMethod_result()
        try:
            result.success = self._handler.getPhoneVerifMethod(args.authSessionId, args.device, args.userPhoneNumber)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getPhoneVerifMethod", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_verifyPhone(self, seqid, iprot, oprot):
        args = verifyPhone_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = verifyPhone_result()
        try:
            result.success = self._handler.verifyPhone(args.authSessionId, args.device, args.userPhoneNumber, args.pinCode)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("verifyPhone", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_verifyAccountUsingPwd(self, seqid, iprot, oprot):
        args = verifyAccountUsingPwd_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = verifyAccountUsingPwd_result()
        try:
            result.success = self._handler.verifyAccountUsingPwd(args.authSessionId, args.accountIdentifier, args.encryptedPassword)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("verifyAccountUsingPwd", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_validateProfile(self, seqid, iprot, oprot):
        args = validateProfile_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = validateProfile_result()
        try:
            result.success = self._handler.validateProfile(args.authSessionId, args.displayName)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("validateProfile", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getUserProfile(self, seqid, iprot, oprot):
        args = getUserProfile_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getUserProfile_result()
        try:
            result.success = self._handler.getUserProfile(args.authSessionId, args.accountIdentifier)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getUserProfile", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_issueWebAuthDetailsForAcctVerif(self, seqid, iprot, oprot):
        args = issueWebAuthDetailsForAcctVerif_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = issueWebAuthDetailsForAcctVerif_result()
        try:
            result.success = self._handler.issueWebAuthDetailsForAcctVerif(args.authSessionId, args.accountIdentifier)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("issueWebAuthDetailsForAcctVerif", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_issueWebAuthDetailsForSecondAuth(self, seqid, iprot, oprot):
        args = issueWebAuthDetailsForSecondAuth_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = issueWebAuthDetailsForSecondAuth_result()
        try:
            result.success = self._handler.issueWebAuthDetailsForSecondAuth(args.authSessionId)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("issueWebAuthDetailsForSecondAuth", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_exchangeEncryptionKey(self, seqid, iprot, oprot):
        args = exchangeEncryptionKey_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = exchangeEncryptionKey_result()
        try:
            result.success = self._handler.exchangeEncryptionKey(args.authSessionId, args.request)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("exchangeEncryptionKey", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_setPassword(self, seqid, iprot, oprot):
        args = setPassword_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = setPassword_result()
        try:
            result.success = self._handler.setPassword(args.authSessionId, args.encryptedPassword)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("setPassword", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_sendPinCodeForPhone(self, seqid, iprot, oprot):
        args = sendPinCodeForPhone_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = sendPinCodeForPhone_result()
        try:
            result.success = self._handler.sendPinCodeForPhone(args.authSessionId, args.device, args.userPhoneNumber, args.verifMethod)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("sendPinCodeForPhone", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

    def process_getSecondAuthMethod(self, seqid, iprot, oprot):
        args = getSecondAuthMethod_args()
        args.read(iprot)
        iprot.readMessageEnd()
        result = getSecondAuthMethod_result()
        try:
            result.success = self._handler.getSecondAuthMethod(args.authSessionId)
            msg_type = TMessageType.REPLY
        except TTransport.TTransportException:
            raise
        except AuthException as e:
            msg_type = TMessageType.REPLY
            result.e = e
        except TApplicationException as ex:
            logging.exception('TApplication exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = ex
        except Exception:
            logging.exception('Unexpected exception in handler')
            msg_type = TMessageType.EXCEPTION
            result = TApplicationException(TApplicationException.INTERNAL_ERROR, 'Internal error')
        oprot.writeMessageBegin("getSecondAuthMethod", msg_type, seqid)
        result.write(oprot)
        oprot.writeMessageEnd()
        oprot.trans.flush()

# HELPER FUNCTIONS AND STRUCTURES


class openSession_args(object):
    """
    Attributes:
     - request

    """


    def __init__(self, request=None,):
        self.request = request

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRUCT:
                    self.request = OpenSessionRequest()
                    self.request.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('openSession_args')
        if self.request is not None:
            oprot.writeFieldBegin('request', TType.STRUCT, 1)
            self.request.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(openSession_args)
openSession_args.thrift_spec = (
    None,  # 0
    (1, TType.STRUCT, 'request', [OpenSessionRequest, None], None, ),  # 1
)


class openSession_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRING:
                    self.success = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('openSession_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRING, 0)
            oprot.writeString(self.success.encode('utf-8') if sys.version_info[0] == 2 else self.success)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(openSession_result)
openSession_result.thrift_spec = (
    (0, TType.STRING, 'success', 'UTF8', None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class getAcctVerifMethod_args(object):
    """
    Attributes:
     - authSessionId
     - accountIdentifier

    """


    def __init__(self, authSessionId=None, accountIdentifier=None,):
        self.authSessionId = authSessionId
        self.accountIdentifier = accountIdentifier

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.accountIdentifier = AccountIdentifier()
                    self.accountIdentifier.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getAcctVerifMethod_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.accountIdentifier is not None:
            oprot.writeFieldBegin('accountIdentifier', TType.STRUCT, 2)
            self.accountIdentifier.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getAcctVerifMethod_args)
getAcctVerifMethod_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'accountIdentifier', [AccountIdentifier, None], None, ),  # 2
)


class getAcctVerifMethod_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = GetAcctVerifMethodResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getAcctVerifMethod_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getAcctVerifMethod_result)
getAcctVerifMethod_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [GetAcctVerifMethodResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class registerPrimaryUsingPhone_args(object):
    """
    Attributes:
     - authSessionId

    """


    def __init__(self, authSessionId=None,):
        self.authSessionId = authSessionId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 2:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('registerPrimaryUsingPhone_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 2)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(registerPrimaryUsingPhone_args)
registerPrimaryUsingPhone_args.thrift_spec = (
    None,  # 0
    None,  # 1
    (2, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 2
)


class registerPrimaryUsingPhone_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = RegisterPrimaryResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('registerPrimaryUsingPhone_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(registerPrimaryUsingPhone_result)
registerPrimaryUsingPhone_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [RegisterPrimaryResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class migratePrimaryUsingPhone_args(object):
    """
    Attributes:
     - authSessionId

    """


    def __init__(self, authSessionId=None,):
        self.authSessionId = authSessionId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('migratePrimaryUsingPhone_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(migratePrimaryUsingPhone_args)
migratePrimaryUsingPhone_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
)


class migratePrimaryUsingPhone_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = MigratePrimaryResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('migratePrimaryUsingPhone_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(migratePrimaryUsingPhone_result)
migratePrimaryUsingPhone_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [MigratePrimaryResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class getPhoneVerifMethod_args(object):
    """
    Attributes:
     - authSessionId
     - device
     - userPhoneNumber

    """


    def __init__(self, authSessionId=None, device=None, userPhoneNumber=None,):
        self.authSessionId = authSessionId
        self.device = device
        self.userPhoneNumber = userPhoneNumber

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.device = Device()
                    self.device.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.userPhoneNumber = UserPhoneNumber()
                    self.userPhoneNumber.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getPhoneVerifMethod_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.device is not None:
            oprot.writeFieldBegin('device', TType.STRUCT, 2)
            self.device.write(oprot)
            oprot.writeFieldEnd()
        if self.userPhoneNumber is not None:
            oprot.writeFieldBegin('userPhoneNumber', TType.STRUCT, 3)
            self.userPhoneNumber.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getPhoneVerifMethod_args)
getPhoneVerifMethod_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'device', [Device, None], None, ),  # 2
    (3, TType.STRUCT, 'userPhoneNumber', [UserPhoneNumber, None], None, ),  # 3
)


class getPhoneVerifMethod_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = GetPhoneVerifMethodResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getPhoneVerifMethod_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getPhoneVerifMethod_result)
getPhoneVerifMethod_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [GetPhoneVerifMethodResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class verifyPhone_args(object):
    """
    Attributes:
     - authSessionId
     - device
     - userPhoneNumber
     - pinCode

    """


    def __init__(self, authSessionId=None, device=None, userPhoneNumber=None, pinCode=None,):
        self.authSessionId = authSessionId
        self.device = device
        self.userPhoneNumber = userPhoneNumber
        self.pinCode = pinCode

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.device = Device()
                    self.device.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.userPhoneNumber = UserPhoneNumber()
                    self.userPhoneNumber.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.STRING:
                    self.pinCode = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('verifyPhone_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.device is not None:
            oprot.writeFieldBegin('device', TType.STRUCT, 2)
            self.device.write(oprot)
            oprot.writeFieldEnd()
        if self.userPhoneNumber is not None:
            oprot.writeFieldBegin('userPhoneNumber', TType.STRUCT, 3)
            self.userPhoneNumber.write(oprot)
            oprot.writeFieldEnd()
        if self.pinCode is not None:
            oprot.writeFieldBegin('pinCode', TType.STRING, 4)
            oprot.writeString(self.pinCode.encode('utf-8') if sys.version_info[0] == 2 else self.pinCode)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(verifyPhone_args)
verifyPhone_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'device', [Device, None], None, ),  # 2
    (3, TType.STRUCT, 'userPhoneNumber', [UserPhoneNumber, None], None, ),  # 3
    (4, TType.STRING, 'pinCode', 'UTF8', None, ),  # 4
)


class verifyPhone_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = VerifyPhoneResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('verifyPhone_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(verifyPhone_result)
verifyPhone_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [VerifyPhoneResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class verifyAccountUsingPwd_args(object):
    """
    Attributes:
     - authSessionId
     - accountIdentifier
     - encryptedPassword

    """


    def __init__(self, authSessionId=None, accountIdentifier=None, encryptedPassword=None,):
        self.authSessionId = authSessionId
        self.accountIdentifier = accountIdentifier
        self.encryptedPassword = encryptedPassword

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.accountIdentifier = AccountIdentifier()
                    self.accountIdentifier.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.encryptedPassword = EncryptedPassword()
                    self.encryptedPassword.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('verifyAccountUsingPwd_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.accountIdentifier is not None:
            oprot.writeFieldBegin('accountIdentifier', TType.STRUCT, 2)
            self.accountIdentifier.write(oprot)
            oprot.writeFieldEnd()
        if self.encryptedPassword is not None:
            oprot.writeFieldBegin('encryptedPassword', TType.STRUCT, 3)
            self.encryptedPassword.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(verifyAccountUsingPwd_args)
verifyAccountUsingPwd_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'accountIdentifier', [AccountIdentifier, None], None, ),  # 2
    (3, TType.STRUCT, 'encryptedPassword', [EncryptedPassword, None], None, ),  # 3
)


class verifyAccountUsingPwd_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = VerifyAccountUsingPwdResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('verifyAccountUsingPwd_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(verifyAccountUsingPwd_result)
verifyAccountUsingPwd_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [VerifyAccountUsingPwdResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class validateProfile_args(object):
    """
    Attributes:
     - authSessionId
     - displayName

    """


    def __init__(self, authSessionId=None, displayName=None,):
        self.authSessionId = authSessionId
        self.displayName = displayName

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRING:
                    self.displayName = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('validateProfile_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.displayName is not None:
            oprot.writeFieldBegin('displayName', TType.STRING, 2)
            oprot.writeString(self.displayName.encode('utf-8') if sys.version_info[0] == 2 else self.displayName)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(validateProfile_args)
validateProfile_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRING, 'displayName', 'UTF8', None, ),  # 2
)


class validateProfile_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = ValidateProfileResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('validateProfile_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(validateProfile_result)
validateProfile_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [ValidateProfileResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class getUserProfile_args(object):
    """
    Attributes:
     - authSessionId
     - accountIdentifier

    """


    def __init__(self, authSessionId=None, accountIdentifier=None,):
        self.authSessionId = authSessionId
        self.accountIdentifier = accountIdentifier

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.accountIdentifier = AccountIdentifier()
                    self.accountIdentifier.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getUserProfile_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.accountIdentifier is not None:
            oprot.writeFieldBegin('accountIdentifier', TType.STRUCT, 2)
            self.accountIdentifier.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getUserProfile_args)
getUserProfile_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'accountIdentifier', [AccountIdentifier, None], None, ),  # 2
)


class getUserProfile_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = GetUserProfileResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getUserProfile_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getUserProfile_result)
getUserProfile_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [GetUserProfileResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class issueWebAuthDetailsForAcctVerif_args(object):
    """
    Attributes:
     - authSessionId
     - accountIdentifier

    """


    def __init__(self, authSessionId=None, accountIdentifier=None,):
        self.authSessionId = authSessionId
        self.accountIdentifier = accountIdentifier

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.accountIdentifier = AccountIdentifier()
                    self.accountIdentifier.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('issueWebAuthDetailsForAcctVerif_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.accountIdentifier is not None:
            oprot.writeFieldBegin('accountIdentifier', TType.STRUCT, 2)
            self.accountIdentifier.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(issueWebAuthDetailsForAcctVerif_args)
issueWebAuthDetailsForAcctVerif_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'accountIdentifier', [AccountIdentifier, None], None, ),  # 2
)


class issueWebAuthDetailsForAcctVerif_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = IssueWebAuthDetailsForAcctVerifResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('issueWebAuthDetailsForAcctVerif_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(issueWebAuthDetailsForAcctVerif_result)
issueWebAuthDetailsForAcctVerif_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [IssueWebAuthDetailsForAcctVerifResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class issueWebAuthDetailsForSecondAuth_args(object):
    """
    Attributes:
     - authSessionId

    """


    def __init__(self, authSessionId=None,):
        self.authSessionId = authSessionId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('issueWebAuthDetailsForSecondAuth_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(issueWebAuthDetailsForSecondAuth_args)
issueWebAuthDetailsForSecondAuth_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
)


class issueWebAuthDetailsForSecondAuth_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = IssueWebAuthDetailsForSecondAuthResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('issueWebAuthDetailsForSecondAuth_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(issueWebAuthDetailsForSecondAuth_result)
issueWebAuthDetailsForSecondAuth_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [IssueWebAuthDetailsForSecondAuthResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class exchangeEncryptionKey_args(object):
    """
    Attributes:
     - authSessionId
     - request

    """


    def __init__(self, authSessionId=None, request=None,):
        self.authSessionId = authSessionId
        self.request = request

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.request = ExchangeEncryptionKeyRequest()
                    self.request.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('exchangeEncryptionKey_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.request is not None:
            oprot.writeFieldBegin('request', TType.STRUCT, 2)
            self.request.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(exchangeEncryptionKey_args)
exchangeEncryptionKey_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'request', [ExchangeEncryptionKeyRequest, None], None, ),  # 2
)


class exchangeEncryptionKey_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = ExchangeEncryptionKeyResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('exchangeEncryptionKey_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(exchangeEncryptionKey_result)
exchangeEncryptionKey_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [ExchangeEncryptionKeyResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class setPassword_args(object):
    """
    Attributes:
     - authSessionId
     - encryptedPassword

    """


    def __init__(self, authSessionId=None, encryptedPassword=None,):
        self.authSessionId = authSessionId
        self.encryptedPassword = encryptedPassword

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.encryptedPassword = EncryptedPassword()
                    self.encryptedPassword.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('setPassword_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.encryptedPassword is not None:
            oprot.writeFieldBegin('encryptedPassword', TType.STRUCT, 2)
            self.encryptedPassword.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(setPassword_args)
setPassword_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'encryptedPassword', [EncryptedPassword, None], None, ),  # 2
)


class setPassword_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = SetPasswordResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('setPassword_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(setPassword_result)
setPassword_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [SetPasswordResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class sendPinCodeForPhone_args(object):
    """
    Attributes:
     - authSessionId
     - device
     - userPhoneNumber
     - verifMethod

    """


    def __init__(self, authSessionId=None, device=None, userPhoneNumber=None, verifMethod=None,):
        self.authSessionId = authSessionId
        self.device = device
        self.userPhoneNumber = userPhoneNumber
        self.verifMethod = verifMethod

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            elif fid == 2:
                if ftype == TType.STRUCT:
                    self.device = Device()
                    self.device.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 3:
                if ftype == TType.STRUCT:
                    self.userPhoneNumber = UserPhoneNumber()
                    self.userPhoneNumber.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 4:
                if ftype == TType.I32:
                    self.verifMethod = iprot.readI32()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('sendPinCodeForPhone_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        if self.device is not None:
            oprot.writeFieldBegin('device', TType.STRUCT, 2)
            self.device.write(oprot)
            oprot.writeFieldEnd()
        if self.userPhoneNumber is not None:
            oprot.writeFieldBegin('userPhoneNumber', TType.STRUCT, 3)
            self.userPhoneNumber.write(oprot)
            oprot.writeFieldEnd()
        if self.verifMethod is not None:
            oprot.writeFieldBegin('verifMethod', TType.I32, 4)
            oprot.writeI32(self.verifMethod)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(sendPinCodeForPhone_args)
sendPinCodeForPhone_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
    (2, TType.STRUCT, 'device', [Device, None], None, ),  # 2
    (3, TType.STRUCT, 'userPhoneNumber', [UserPhoneNumber, None], None, ),  # 3
    (4, TType.I32, 'verifMethod', None, None, ),  # 4
)


class sendPinCodeForPhone_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = SendPinCodeForPhoneResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('sendPinCodeForPhone_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(sendPinCodeForPhone_result)
sendPinCodeForPhone_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [SendPinCodeForPhoneResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)


class getSecondAuthMethod_args(object):
    """
    Attributes:
     - authSessionId

    """


    def __init__(self, authSessionId=None,):
        self.authSessionId = authSessionId

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 1:
                if ftype == TType.STRING:
                    self.authSessionId = iprot.readString().decode('utf-8') if sys.version_info[0] == 2 else iprot.readString()
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getSecondAuthMethod_args')
        if self.authSessionId is not None:
            oprot.writeFieldBegin('authSessionId', TType.STRING, 1)
            oprot.writeString(self.authSessionId.encode('utf-8') if sys.version_info[0] == 2 else self.authSessionId)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getSecondAuthMethod_args)
getSecondAuthMethod_args.thrift_spec = (
    None,  # 0
    (1, TType.STRING, 'authSessionId', 'UTF8', None, ),  # 1
)


class getSecondAuthMethod_result(object):
    """
    Attributes:
     - success
     - e

    """


    def __init__(self, success=None, e=None,):
        self.success = success
        self.e = e

    def read(self, iprot):
        if iprot._fast_decode is not None and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None:
            iprot._fast_decode(self, iprot, [self.__class__, self.thrift_spec])
            return
        iprot.readStructBegin()
        while True:
            (fname, ftype, fid) = iprot.readFieldBegin()
            if ftype == TType.STOP:
                break
            if fid == 0:
                if ftype == TType.STRUCT:
                    self.success = GetSecondAuthMethodResponse()
                    self.success.read(iprot)
                else:
                    iprot.skip(ftype)
            elif fid == 1:
                if ftype == TType.STRUCT:
                    self.e = AuthException()
                    self.e.read(iprot)
                else:
                    iprot.skip(ftype)
            else:
                iprot.skip(ftype)
            iprot.readFieldEnd()
        iprot.readStructEnd()

    def write(self, oprot):
        if oprot._fast_encode is not None and self.thrift_spec is not None:
            oprot.trans.write(oprot._fast_encode(self, [self.__class__, self.thrift_spec]))
            return
        oprot.writeStructBegin('getSecondAuthMethod_result')
        if self.success is not None:
            oprot.writeFieldBegin('success', TType.STRUCT, 0)
            self.success.write(oprot)
            oprot.writeFieldEnd()
        if self.e is not None:
            oprot.writeFieldBegin('e', TType.STRUCT, 1)
            self.e.write(oprot)
            oprot.writeFieldEnd()
        oprot.writeFieldStop()
        oprot.writeStructEnd()

    def validate(self):
        return

    def __repr__(self):
        L = ['%s=%r' % (key, value)
             for key, value in self.__dict__.items()]
        return '%s(%s)' % (self.__class__.__name__, ', '.join(L))

    def __eq__(self, other):
        return isinstance(other, self.__class__) and self.__dict__ == other.__dict__

    def __ne__(self, other):
        return not (self == other)
all_structs.append(getSecondAuthMethod_result)
getSecondAuthMethod_result.thrift_spec = (
    (0, TType.STRUCT, 'success', [GetSecondAuthMethodResponse, None], None, ),  # 0
    (1, TType.STRUCT, 'e', [AuthException, None], None, ),  # 1
)
fix_spec(all_structs)
del all_structs

