Subversion Repositories SmartDukaan

Rev

Rev 3893 | Go to most recent revision | Blame | Compare with Previous | Last modification | View Log | RSS feed

#
# Autogenerated by Thrift Compiler (0.7.0)
#
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
#

from thrift.Thrift import *
import shop2020.thriftpy.generic.GenericService
from ttypes import *
from thrift.Thrift import TProcessor
from thrift.transport import TTransport
from thrift.protocol import TBinaryProtocol, TProtocol
try:
  from thrift.protocol import fastbinary
except:
  fastbinary = None


class Iface(shop2020.thriftpy.generic.GenericService.Iface):
  def pushContentToProduction(self, entityId):
    """
    Push the content of the given entity to production

    Parameters:
     - entityId
    """
    pass


class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
  def __init__(self, iprot, oprot=None):
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)

  def pushContentToProduction(self, entityId):
    """
    Push the content of the given entity to production

    Parameters:
     - entityId
    """
    self.send_pushContentToProduction(entityId)
    return self.recv_pushContentToProduction()

  def send_pushContentToProduction(self, entityId):
    self._oprot.writeMessageBegin('pushContentToProduction', TMessageType.CALL, self._seqid)
    args = pushContentToProduction_args()
    args.entityId = entityId
    args.write(self._oprot)
    self._oprot.writeMessageEnd()
    self._oprot.trans.flush()

  def recv_pushContentToProduction(self, ):
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
    if mtype == TMessageType.EXCEPTION:
      x = TApplicationException()
      x.read(self._iprot)
      self._iprot.readMessageEnd()
      raise x
    result = pushContentToProduction_result()
    result.read(self._iprot)
    self._iprot.readMessageEnd()
    if result.success is not None:
      return result.success
    if result.cse is not None:
      raise result.cse
    raise TApplicationException(TApplicationException.MISSING_RESULT, "pushContentToProduction failed: unknown result");


class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
  def __init__(self, handler):
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
    self._processMap["pushContentToProduction"] = Processor.process_pushContentToProduction

  def 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()
      return
    else:
      self._processMap[name](self, seqid, iprot, oprot)
    return True

  def process_pushContentToProduction(self, seqid, iprot, oprot):
    args = pushContentToProduction_args()
    args.read(iprot)
    iprot.readMessageEnd()
    result = pushContentToProduction_result()
    try:
      result.success = self._handler.pushContentToProduction(args.entityId)
    except ContentServiceException, cse:
      result.cse = cse
    oprot.writeMessageBegin("pushContentToProduction", TMessageType.REPLY, seqid)
    result.write(oprot)
    oprot.writeMessageEnd()
    oprot.trans.flush()


# HELPER FUNCTIONS AND STRUCTURES

class pushContentToProduction_args:
  """
  Attributes:
   - entityId
  """

  thrift_spec = (
    None, # 0
    (1, TType.I64, 'entityId', None, None, ), # 1
  )

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

  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))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 1:
        if ftype == TType.I64:
          self.entityId = 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)))
      return
    oprot.writeStructBegin('pushContentToProduction_args')
    if self.entityId is not None:
      oprot.writeFieldBegin('entityId', TType.I64, 1)
      oprot.writeI64(self.entityId)
      oprot.writeFieldEnd()
    oprot.writeFieldStop()
    oprot.writeStructEnd()

  def validate(self):
    return


  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 pushContentToProduction_result:
  """
  Attributes:
   - success
   - cse
  """

  thrift_spec = (
    (0, TType.BOOL, 'success', None, None, ), # 0
    (1, TType.STRUCT, 'cse', (ContentServiceException, ContentServiceException.thrift_spec), None, ), # 1
  )

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

  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))
      return
    iprot.readStructBegin()
    while True:
      (fname, ftype, fid) = iprot.readFieldBegin()
      if ftype == TType.STOP:
        break
      if fid == 0:
        if ftype == TType.BOOL:
          self.success = iprot.readBool();
        else:
          iprot.skip(ftype)
      elif fid == 1:
        if ftype == TType.STRUCT:
          self.cse = ContentServiceException()
          self.cse.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)))
      return
    oprot.writeStructBegin('pushContentToProduction_result')
    if self.success is not None:
      oprot.writeFieldBegin('success', TType.BOOL, 0)
      oprot.writeBool(self.success)
      oprot.writeFieldEnd()
    if self.cse is not None:
      oprot.writeFieldBegin('cse', TType.STRUCT, 1)
      self.cse.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__.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)