Rev 1976 | Rev 3376 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed
## Autogenerated by Thrift## DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING#from thrift.Thrift import *from ttypes import *from thrift.Thrift import TProcessorfrom thrift.transport import TTransportfrom thrift.protocol import TBinaryProtocoltry:from thrift.protocol import fastbinaryexcept:fastbinary = Noneclass Iface:"""Promotion Service"""def closeSession(self, ):"""For closing the open session in sqlalchemy"""passdef createPromotion(self, name, ruleExecutionSrc, startOn, endOn):"""Parameters:- name- ruleExecutionSrc- startOn- endOn"""passdef getAllPromotions(self, ):passdef getPromotionById(self, promotionId):"""Parameters:- promotionId"""passdef generateCouponsForPromotion(self, promotionId, couponCode):"""Parameters:- promotionId- couponCode"""passdef applyCoupon(self, couponCode, cartId):"""Parameters:- couponCode- cartId"""passdef trackCouponUsage(self, couponCode, transactionId, userId):"""Parameters:- couponCode- transactionId- userId"""passdef getCouponUsageCountByUser(self, couponCode, userId):"""Parameters:- couponCode- userId"""passclass Client(Iface):"""Promotion Service"""def __init__(self, iprot, oprot=None):self._iprot = self._oprot = iprotif oprot != None:self._oprot = oprotself._seqid = 0def closeSession(self, ):"""For closing the open session in sqlalchemy"""self.send_closeSession()self.recv_closeSession()def send_closeSession(self, ):self._oprot.writeMessageBegin('closeSession', TMessageType.CALL, self._seqid)args = closeSession_args()args.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_closeSession(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = closeSession_result()result.read(self._iprot)self._iprot.readMessageEnd()returndef createPromotion(self, name, ruleExecutionSrc, startOn, endOn):"""Parameters:- name- ruleExecutionSrc- startOn- endOn"""self.send_createPromotion(name, ruleExecutionSrc, startOn, endOn)self.recv_createPromotion()def send_createPromotion(self, name, ruleExecutionSrc, startOn, endOn):self._oprot.writeMessageBegin('createPromotion', TMessageType.CALL, self._seqid)args = createPromotion_args()args.name = nameargs.ruleExecutionSrc = ruleExecutionSrcargs.startOn = startOnargs.endOn = endOnargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_createPromotion(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = createPromotion_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex != None:raise result.pexreturndef getAllPromotions(self, ):self.send_getAllPromotions()return self.recv_getAllPromotions()def send_getAllPromotions(self, ):self._oprot.writeMessageBegin('getAllPromotions', TMessageType.CALL, self._seqid)args = getAllPromotions_args()args.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_getAllPromotions(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = getAllPromotions_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success != None:return result.successif result.pex != None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "getAllPromotions failed: unknown result");def getPromotionById(self, promotionId):"""Parameters:- promotionId"""self.send_getPromotionById(promotionId)return self.recv_getPromotionById()def send_getPromotionById(self, promotionId):self._oprot.writeMessageBegin('getPromotionById', TMessageType.CALL, self._seqid)args = getPromotionById_args()args.promotionId = promotionIdargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_getPromotionById(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = getPromotionById_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success != None:return result.successif result.pex != None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "getPromotionById failed: unknown result");def generateCouponsForPromotion(self, promotionId, couponCode):"""Parameters:- promotionId- couponCode"""self.send_generateCouponsForPromotion(promotionId, couponCode)self.recv_generateCouponsForPromotion()def send_generateCouponsForPromotion(self, promotionId, couponCode):self._oprot.writeMessageBegin('generateCouponsForPromotion', TMessageType.CALL, self._seqid)args = generateCouponsForPromotion_args()args.promotionId = promotionIdargs.couponCode = couponCodeargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_generateCouponsForPromotion(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = generateCouponsForPromotion_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex != None:raise result.pexreturndef applyCoupon(self, couponCode, cartId):"""Parameters:- couponCode- cartId"""self.send_applyCoupon(couponCode, cartId)return self.recv_applyCoupon()def send_applyCoupon(self, couponCode, cartId):self._oprot.writeMessageBegin('applyCoupon', TMessageType.CALL, self._seqid)args = applyCoupon_args()args.couponCode = couponCodeargs.cartId = cartIdargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_applyCoupon(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = applyCoupon_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success != None:return result.successif result.pex != None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "applyCoupon failed: unknown result");def trackCouponUsage(self, couponCode, transactionId, userId):"""Parameters:- couponCode- transactionId- userId"""self.send_trackCouponUsage(couponCode, transactionId, userId)self.recv_trackCouponUsage()def send_trackCouponUsage(self, couponCode, transactionId, userId):self._oprot.writeMessageBegin('trackCouponUsage', TMessageType.CALL, self._seqid)args = trackCouponUsage_args()args.couponCode = couponCodeargs.transactionId = transactionIdargs.userId = userIdargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_trackCouponUsage(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = trackCouponUsage_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.pex != None:raise result.pexreturndef getCouponUsageCountByUser(self, couponCode, userId):"""Parameters:- couponCode- userId"""self.send_getCouponUsageCountByUser(couponCode, userId)return self.recv_getCouponUsageCountByUser()def send_getCouponUsageCountByUser(self, couponCode, userId):self._oprot.writeMessageBegin('getCouponUsageCountByUser', TMessageType.CALL, self._seqid)args = getCouponUsageCountByUser_args()args.couponCode = couponCodeargs.userId = userIdargs.write(self._oprot)self._oprot.writeMessageEnd()self._oprot.trans.flush()def recv_getCouponUsageCountByUser(self, ):(fname, mtype, rseqid) = self._iprot.readMessageBegin()if mtype == TMessageType.EXCEPTION:x = TApplicationException()x.read(self._iprot)self._iprot.readMessageEnd()raise xresult = getCouponUsageCountByUser_result()result.read(self._iprot)self._iprot.readMessageEnd()if result.success != None:return result.successif result.pex != None:raise result.pexraise TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");class Processor(Iface, TProcessor):def __init__(self, handler):self._handler = handlerself._processMap = {}self._processMap["closeSession"] = Processor.process_closeSessionself._processMap["createPromotion"] = Processor.process_createPromotionself._processMap["getAllPromotions"] = Processor.process_getAllPromotionsself._processMap["getPromotionById"] = Processor.process_getPromotionByIdself._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotionself._processMap["applyCoupon"] = Processor.process_applyCouponself._processMap["trackCouponUsage"] = Processor.process_trackCouponUsageself._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUserdef process(self, iprot, oprot):(name, type, seqid) = iprot.readMessageBegin()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()returnelse:self._processMap[name](self, seqid, iprot, oprot)return Truedef process_closeSession(self, seqid, iprot, oprot):args = closeSession_args()args.read(iprot)iprot.readMessageEnd()result = closeSession_result()self._handler.closeSession()oprot.writeMessageBegin("closeSession", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_createPromotion(self, seqid, iprot, oprot):args = createPromotion_args()args.read(iprot)iprot.readMessageEnd()result = createPromotion_result()try:self._handler.createPromotion(args.name, args.ruleExecutionSrc, args.startOn, args.endOn)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("createPromotion", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_getAllPromotions(self, seqid, iprot, oprot):args = getAllPromotions_args()args.read(iprot)iprot.readMessageEnd()result = getAllPromotions_result()try:result.success = self._handler.getAllPromotions()except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("getAllPromotions", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_getPromotionById(self, seqid, iprot, oprot):args = getPromotionById_args()args.read(iprot)iprot.readMessageEnd()result = getPromotionById_result()try:result.success = self._handler.getPromotionById(args.promotionId)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("getPromotionById", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_generateCouponsForPromotion(self, seqid, iprot, oprot):args = generateCouponsForPromotion_args()args.read(iprot)iprot.readMessageEnd()result = generateCouponsForPromotion_result()try:self._handler.generateCouponsForPromotion(args.promotionId, args.couponCode)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("generateCouponsForPromotion", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_applyCoupon(self, seqid, iprot, oprot):args = applyCoupon_args()args.read(iprot)iprot.readMessageEnd()result = applyCoupon_result()try:result.success = self._handler.applyCoupon(args.couponCode, args.cartId)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("applyCoupon", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_trackCouponUsage(self, seqid, iprot, oprot):args = trackCouponUsage_args()args.read(iprot)iprot.readMessageEnd()result = trackCouponUsage_result()try:self._handler.trackCouponUsage(args.couponCode, args.transactionId, args.userId)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("trackCouponUsage", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()def process_getCouponUsageCountByUser(self, seqid, iprot, oprot):args = getCouponUsageCountByUser_args()args.read(iprot)iprot.readMessageEnd()result = getCouponUsageCountByUser_result()try:result.success = self._handler.getCouponUsageCountByUser(args.couponCode, args.userId)except PromotionException, pex:result.pex = pexoprot.writeMessageBegin("getCouponUsageCountByUser", TMessageType.REPLY, seqid)result.write(oprot)oprot.writeMessageEnd()oprot.trans.flush()# HELPER FUNCTIONS AND STRUCTURESclass closeSession_args:thrift_spec = ()def read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('closeSession_args')oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class closeSession_result:thrift_spec = ()def read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('closeSession_result')oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class createPromotion_args:"""Attributes:- name- ruleExecutionSrc- startOn- endOn"""thrift_spec = (None, # 0(1, TType.STRING, 'name', None, None, ), # 1(2, TType.STRING, 'ruleExecutionSrc', None, None, ), # 2(3, TType.I64, 'startOn', None, None, ), # 3(4, TType.I64, 'endOn', None, None, ), # 4)def __init__(self, name=None, ruleExecutionSrc=None, startOn=None, endOn=None,):self.name = nameself.ruleExecutionSrc = ruleExecutionSrcself.startOn = startOnself.endOn = endOndef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRING:self.name = iprot.readString();else:iprot.skip(ftype)elif fid == 2:if ftype == TType.STRING:self.ruleExecutionSrc = iprot.readString();else:iprot.skip(ftype)elif fid == 3:if ftype == TType.I64:self.startOn = iprot.readI64();else:iprot.skip(ftype)elif fid == 4:if ftype == TType.I64:self.endOn = iprot.readI64();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('createPromotion_args')if self.name != None:oprot.writeFieldBegin('name', TType.STRING, 1)oprot.writeString(self.name)oprot.writeFieldEnd()if self.ruleExecutionSrc != None:oprot.writeFieldBegin('ruleExecutionSrc', TType.STRING, 2)oprot.writeString(self.ruleExecutionSrc)oprot.writeFieldEnd()if self.startOn != None:oprot.writeFieldBegin('startOn', TType.I64, 3)oprot.writeI64(self.startOn)oprot.writeFieldEnd()if self.endOn != None:oprot.writeFieldBegin('endOn', TType.I64, 4)oprot.writeI64(self.endOn)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class createPromotion_result:"""Attributes:- pex"""thrift_spec = (None, # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, pex=None,):self.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('createPromotion_result')if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getAllPromotions_args:thrift_spec = ()def read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakelse:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getAllPromotions_args')oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getAllPromotions_result:"""Attributes:- success- pex"""thrift_spec = ((0, TType.LIST, 'success', (TType.STRUCT,(Promotion, Promotion.thrift_spec)), None, ), # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, success=None, pex=None,):self.success = successself.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 0:if ftype == TType.LIST:self.success = [](_etype24, _size21) = iprot.readListBegin()for _i25 in xrange(_size21):_elem26 = Promotion()_elem26.read(iprot)self.success.append(_elem26)iprot.readListEnd()else:iprot.skip(ftype)elif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getAllPromotions_result')if self.success != None:oprot.writeFieldBegin('success', TType.LIST, 0)oprot.writeListBegin(TType.STRUCT, len(self.success))for iter27 in self.success:iter27.write(oprot)oprot.writeListEnd()oprot.writeFieldEnd()if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getPromotionById_args:"""Attributes:- promotionId"""thrift_spec = (None, # 0(1, TType.I64, 'promotionId', None, None, ), # 1)def __init__(self, promotionId=None,):self.promotionId = promotionIddef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.I64:self.promotionId = iprot.readI64();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getPromotionById_args')if self.promotionId != None:oprot.writeFieldBegin('promotionId', TType.I64, 1)oprot.writeI64(self.promotionId)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getPromotionById_result:"""Attributes:- success- pex"""thrift_spec = ((0, TType.STRUCT, 'success', (Promotion, Promotion.thrift_spec), None, ), # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, success=None, pex=None,):self.success = successself.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 0:if ftype == TType.STRUCT:self.success = Promotion()self.success.read(iprot)else:iprot.skip(ftype)elif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getPromotionById_result')if self.success != None:oprot.writeFieldBegin('success', TType.STRUCT, 0)self.success.write(oprot)oprot.writeFieldEnd()if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class generateCouponsForPromotion_args:"""Attributes:- promotionId- couponCode"""thrift_spec = (None, # 0(1, TType.I64, 'promotionId', None, None, ), # 1(2, TType.STRING, 'couponCode', None, None, ), # 2)def __init__(self, promotionId=None, couponCode=None,):self.promotionId = promotionIdself.couponCode = couponCodedef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.I64:self.promotionId = iprot.readI64();else:iprot.skip(ftype)elif fid == 2:if ftype == TType.STRING:self.couponCode = iprot.readString();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('generateCouponsForPromotion_args')if self.promotionId != None:oprot.writeFieldBegin('promotionId', TType.I64, 1)oprot.writeI64(self.promotionId)oprot.writeFieldEnd()if self.couponCode != None:oprot.writeFieldBegin('couponCode', TType.STRING, 2)oprot.writeString(self.couponCode)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class generateCouponsForPromotion_result:"""Attributes:- pex"""thrift_spec = (None, # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, pex=None,):self.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('generateCouponsForPromotion_result')if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class applyCoupon_args:"""Attributes:- couponCode- cartId"""thrift_spec = (None, # 0(1, TType.STRING, 'couponCode', None, None, ), # 1(2, TType.I64, 'cartId', None, None, ), # 2)def __init__(self, couponCode=None, cartId=None,):self.couponCode = couponCodeself.cartId = cartIddef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRING:self.couponCode = iprot.readString();else:iprot.skip(ftype)elif fid == 2:if ftype == TType.I64:self.cartId = iprot.readI64();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('applyCoupon_args')if self.couponCode != None:oprot.writeFieldBegin('couponCode', TType.STRING, 1)oprot.writeString(self.couponCode)oprot.writeFieldEnd()if self.cartId != None:oprot.writeFieldBegin('cartId', TType.I64, 2)oprot.writeI64(self.cartId)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class applyCoupon_result:"""Attributes:- success- pex"""thrift_spec = ((0, TType.STRUCT, 'success', (Cart, Cart.thrift_spec), None, ), # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, success=None, pex=None,):self.success = successself.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 0:if ftype == TType.STRUCT:self.success = Cart()self.success.read(iprot)else:iprot.skip(ftype)elif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('applyCoupon_result')if self.success != None:oprot.writeFieldBegin('success', TType.STRUCT, 0)self.success.write(oprot)oprot.writeFieldEnd()if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class trackCouponUsage_args:"""Attributes:- couponCode- transactionId- userId"""thrift_spec = (None, # 0(1, TType.STRING, 'couponCode', None, None, ), # 1(2, TType.I64, 'transactionId', None, None, ), # 2(3, TType.I64, 'userId', None, None, ), # 3)def __init__(self, couponCode=None, transactionId=None, userId=None,):self.couponCode = couponCodeself.transactionId = transactionIdself.userId = userIddef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRING:self.couponCode = iprot.readString();else:iprot.skip(ftype)elif fid == 2:if ftype == TType.I64:self.transactionId = iprot.readI64();else:iprot.skip(ftype)elif fid == 3:if ftype == TType.I64:self.userId = iprot.readI64();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('trackCouponUsage_args')if self.couponCode != None:oprot.writeFieldBegin('couponCode', TType.STRING, 1)oprot.writeString(self.couponCode)oprot.writeFieldEnd()if self.transactionId != None:oprot.writeFieldBegin('transactionId', TType.I64, 2)oprot.writeI64(self.transactionId)oprot.writeFieldEnd()if self.userId != None:oprot.writeFieldBegin('userId', TType.I64, 3)oprot.writeI64(self.userId)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class trackCouponUsage_result:"""Attributes:- pex"""thrift_spec = (None, # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, pex=None,):self.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('trackCouponUsage_result')if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getCouponUsageCountByUser_args:"""Attributes:- couponCode- userId"""thrift_spec = (None, # 0(1, TType.STRING, 'couponCode', None, None, ), # 1(2, TType.I64, 'userId', None, None, ), # 2)def __init__(self, couponCode=None, userId=None,):self.couponCode = couponCodeself.userId = userIddef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 1:if ftype == TType.STRING:self.couponCode = iprot.readString();else:iprot.skip(ftype)elif fid == 2:if ftype == TType.I64:self.userId = iprot.readI64();else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getCouponUsageCountByUser_args')if self.couponCode != None:oprot.writeFieldBegin('couponCode', TType.STRING, 1)oprot.writeString(self.couponCode)oprot.writeFieldEnd()if self.userId != None:oprot.writeFieldBegin('userId', TType.I64, 2)oprot.writeI64(self.userId)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)class getCouponUsageCountByUser_result:"""Attributes:- success- pex"""thrift_spec = ((0, TType.I64, 'success', None, None, ), # 0(1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1)def __init__(self, success=None, pex=None,):self.success = successself.pex = pexdef read(self, iprot):if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))returniprot.readStructBegin()while True:(fname, ftype, fid) = iprot.readFieldBegin()if ftype == TType.STOP:breakif fid == 0:if ftype == TType.I64:self.success = iprot.readI64();else:iprot.skip(ftype)elif fid == 1:if ftype == TType.STRUCT:self.pex = PromotionException()self.pex.read(iprot)else:iprot.skip(ftype)else:iprot.skip(ftype)iprot.readFieldEnd()iprot.readStructEnd()def write(self, oprot):if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))returnoprot.writeStructBegin('getCouponUsageCountByUser_result')if self.success != None:oprot.writeFieldBegin('success', TType.I64, 0)oprot.writeI64(self.success)oprot.writeFieldEnd()if self.pex != None:oprot.writeFieldBegin('pex', TType.STRUCT, 1)self.pex.write(oprot)oprot.writeFieldEnd()oprot.writeFieldStop()oprot.writeStructEnd()def __repr__(self):L = ['%s=%r' % (key, value)for key, value in self.__dict__.iteritems()]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)