Subversion Repositories SmartDukaan

Rev

Rev 4189 | Rev 5326 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4189 Rev 4494
Line 102... Line 102...
102
    Parameters:
102
    Parameters:
103
     - itemIds
103
     - itemIds
104
    """
104
    """
105
    pass
105
    pass
106
 
106
 
-
 
107
  def getDiscountsForEntity(self, entityId):
-
 
108
    """
-
 
109
    Parameters:
-
 
110
     - entityId
-
 
111
    """
-
 
112
    pass
-
 
113
 
107
 
114
 
108
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
115
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
109
  """
116
  """
110
  Promotion Service
117
  Promotion Service
111
  """
118
  """
Line 467... Line 474...
467
      return result.success
474
      return result.success
468
    if result.pex is not None:
475
    if result.pex is not None:
469
      raise result.pex
476
      raise result.pex
470
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getItemDiscountMap failed: unknown result");
477
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getItemDiscountMap failed: unknown result");
471
 
478
 
-
 
479
  def getDiscountsForEntity(self, entityId):
-
 
480
    """
-
 
481
    Parameters:
-
 
482
     - entityId
-
 
483
    """
-
 
484
    self.send_getDiscountsForEntity(entityId)
-
 
485
    return self.recv_getDiscountsForEntity()
-
 
486
 
-
 
487
  def send_getDiscountsForEntity(self, entityId):
-
 
488
    self._oprot.writeMessageBegin('getDiscountsForEntity', TMessageType.CALL, self._seqid)
-
 
489
    args = getDiscountsForEntity_args()
-
 
490
    args.entityId = entityId
-
 
491
    args.write(self._oprot)
-
 
492
    self._oprot.writeMessageEnd()
-
 
493
    self._oprot.trans.flush()
-
 
494
 
-
 
495
  def recv_getDiscountsForEntity(self, ):
-
 
496
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
-
 
497
    if mtype == TMessageType.EXCEPTION:
-
 
498
      x = TApplicationException()
-
 
499
      x.read(self._iprot)
-
 
500
      self._iprot.readMessageEnd()
-
 
501
      raise x
-
 
502
    result = getDiscountsForEntity_result()
-
 
503
    result.read(self._iprot)
-
 
504
    self._iprot.readMessageEnd()
-
 
505
    if result.success is not None:
-
 
506
      return result.success
-
 
507
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getDiscountsForEntity failed: unknown result");
-
 
508
 
472
 
509
 
473
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
510
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
474
  def __init__(self, handler):
511
  def __init__(self, handler):
475
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
512
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
476
    self._processMap["createPromotion"] = Processor.process_createPromotion
513
    self._processMap["createPromotion"] = Processor.process_createPromotion
Line 482... Line 519...
482
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
519
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
483
    self._processMap["getActiveCoupons"] = Processor.process_getActiveCoupons
520
    self._processMap["getActiveCoupons"] = Processor.process_getActiveCoupons
484
    self._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCoupon
521
    self._processMap["getSuccessfulPaymentCountForCoupon"] = Processor.process_getSuccessfulPaymentCountForCoupon
485
    self._processMap["getRuleDocString"] = Processor.process_getRuleDocString
522
    self._processMap["getRuleDocString"] = Processor.process_getRuleDocString
486
    self._processMap["getItemDiscountMap"] = Processor.process_getItemDiscountMap
523
    self._processMap["getItemDiscountMap"] = Processor.process_getItemDiscountMap
-
 
524
    self._processMap["getDiscountsForEntity"] = Processor.process_getDiscountsForEntity
487
 
525
 
488
  def process(self, iprot, oprot):
526
  def process(self, iprot, oprot):
489
    (name, type, seqid) = iprot.readMessageBegin()
527
    (name, type, seqid) = iprot.readMessageBegin()
490
    if name not in self._processMap:
528
    if name not in self._processMap:
491
      iprot.skip(TType.STRUCT)
529
      iprot.skip(TType.STRUCT)
Line 649... Line 687...
649
    oprot.writeMessageBegin("getItemDiscountMap", TMessageType.REPLY, seqid)
687
    oprot.writeMessageBegin("getItemDiscountMap", TMessageType.REPLY, seqid)
650
    result.write(oprot)
688
    result.write(oprot)
651
    oprot.writeMessageEnd()
689
    oprot.writeMessageEnd()
652
    oprot.trans.flush()
690
    oprot.trans.flush()
653
 
691
 
-
 
692
  def process_getDiscountsForEntity(self, seqid, iprot, oprot):
-
 
693
    args = getDiscountsForEntity_args()
-
 
694
    args.read(iprot)
-
 
695
    iprot.readMessageEnd()
-
 
696
    result = getDiscountsForEntity_result()
-
 
697
    result.success = self._handler.getDiscountsForEntity(args.entityId)
-
 
698
    oprot.writeMessageBegin("getDiscountsForEntity", TMessageType.REPLY, seqid)
-
 
699
    result.write(oprot)
-
 
700
    oprot.writeMessageEnd()
-
 
701
    oprot.trans.flush()
-
 
702
 
654
 
703
 
655
# HELPER FUNCTIONS AND STRUCTURES
704
# HELPER FUNCTIONS AND STRUCTURES
656
 
705
 
657
class createPromotion_args:
706
class createPromotion_args:
658
  """
707
  """
Line 2141... Line 2190...
2141
      oprot.writeFieldEnd()
2190
      oprot.writeFieldEnd()
2142
    oprot.writeFieldStop()
2191
    oprot.writeFieldStop()
2143
    oprot.writeStructEnd()
2192
    oprot.writeStructEnd()
2144
 
2193
 
2145
  def validate(self):
2194
  def validate(self):
-
 
2195
    return
-
 
2196
 
-
 
2197
 
-
 
2198
  def __repr__(self):
-
 
2199
    L = ['%s=%r' % (key, value)
-
 
2200
      for key, value in self.__dict__.iteritems()]
-
 
2201
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2202
 
-
 
2203
  def __eq__(self, other):
-
 
2204
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2205
 
-
 
2206
  def __ne__(self, other):
-
 
2207
    return not (self == other)
-
 
2208
 
-
 
2209
class getDiscountsForEntity_args:
-
 
2210
  """
-
 
2211
  Attributes:
-
 
2212
   - entityId
-
 
2213
  """
-
 
2214
 
-
 
2215
  thrift_spec = (
-
 
2216
    None, # 0
-
 
2217
    (1, TType.I64, 'entityId', None, None, ), # 1
-
 
2218
  )
-
 
2219
 
-
 
2220
  def __init__(self, entityId=None,):
-
 
2221
    self.entityId = entityId
-
 
2222
 
-
 
2223
  def read(self, iprot):
-
 
2224
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2225
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2226
      return
-
 
2227
    iprot.readStructBegin()
-
 
2228
    while True:
-
 
2229
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2230
      if ftype == TType.STOP:
-
 
2231
        break
-
 
2232
      if fid == 1:
-
 
2233
        if ftype == TType.I64:
-
 
2234
          self.entityId = iprot.readI64();
-
 
2235
        else:
-
 
2236
          iprot.skip(ftype)
-
 
2237
      else:
-
 
2238
        iprot.skip(ftype)
-
 
2239
      iprot.readFieldEnd()
-
 
2240
    iprot.readStructEnd()
-
 
2241
 
-
 
2242
  def write(self, oprot):
-
 
2243
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2244
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2245
      return
-
 
2246
    oprot.writeStructBegin('getDiscountsForEntity_args')
-
 
2247
    if self.entityId is not None:
-
 
2248
      oprot.writeFieldBegin('entityId', TType.I64, 1)
-
 
2249
      oprot.writeI64(self.entityId)
-
 
2250
      oprot.writeFieldEnd()
-
 
2251
    oprot.writeFieldStop()
-
 
2252
    oprot.writeStructEnd()
-
 
2253
 
-
 
2254
  def validate(self):
-
 
2255
    return
-
 
2256
 
-
 
2257
 
-
 
2258
  def __repr__(self):
-
 
2259
    L = ['%s=%r' % (key, value)
-
 
2260
      for key, value in self.__dict__.iteritems()]
-
 
2261
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
-
 
2262
 
-
 
2263
  def __eq__(self, other):
-
 
2264
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
-
 
2265
 
-
 
2266
  def __ne__(self, other):
-
 
2267
    return not (self == other)
-
 
2268
 
-
 
2269
class getDiscountsForEntity_result:
-
 
2270
  """
-
 
2271
  Attributes:
-
 
2272
   - success
-
 
2273
  """
-
 
2274
 
-
 
2275
  thrift_spec = (
-
 
2276
    (0, TType.MAP, 'success', (TType.STRING,None,TType.DOUBLE,None), None, ), # 0
-
 
2277
  )
-
 
2278
 
-
 
2279
  def __init__(self, success=None,):
-
 
2280
    self.success = success
-
 
2281
 
-
 
2282
  def read(self, iprot):
-
 
2283
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
-
 
2284
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
-
 
2285
      return
-
 
2286
    iprot.readStructBegin()
-
 
2287
    while True:
-
 
2288
      (fname, ftype, fid) = iprot.readFieldBegin()
-
 
2289
      if ftype == TType.STOP:
-
 
2290
        break
-
 
2291
      if fid == 0:
-
 
2292
        if ftype == TType.MAP:
-
 
2293
          self.success = {}
-
 
2294
          (_ktype57, _vtype58, _size56 ) = iprot.readMapBegin() 
-
 
2295
          for _i60 in xrange(_size56):
-
 
2296
            _key61 = iprot.readString();
-
 
2297
            _val62 = iprot.readDouble();
-
 
2298
            self.success[_key61] = _val62
-
 
2299
          iprot.readMapEnd()
-
 
2300
        else:
-
 
2301
          iprot.skip(ftype)
-
 
2302
      else:
-
 
2303
        iprot.skip(ftype)
-
 
2304
      iprot.readFieldEnd()
-
 
2305
    iprot.readStructEnd()
-
 
2306
 
-
 
2307
  def write(self, oprot):
-
 
2308
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
-
 
2309
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
-
 
2310
      return
-
 
2311
    oprot.writeStructBegin('getDiscountsForEntity_result')
-
 
2312
    if self.success is not None:
-
 
2313
      oprot.writeFieldBegin('success', TType.MAP, 0)
-
 
2314
      oprot.writeMapBegin(TType.STRING, TType.DOUBLE, len(self.success))
-
 
2315
      for kiter63,viter64 in self.success.items():
-
 
2316
        oprot.writeString(kiter63)
-
 
2317
        oprot.writeDouble(viter64)
-
 
2318
      oprot.writeMapEnd()
-
 
2319
      oprot.writeFieldEnd()
-
 
2320
    oprot.writeFieldStop()
-
 
2321
    oprot.writeStructEnd()
-
 
2322
 
-
 
2323
  def validate(self):
2146
    return
2324
    return
2147
 
2325
 
2148
 
2326
 
2149
  def __repr__(self):
2327
  def __repr__(self):
2150
    L = ['%s=%r' % (key, value)
2328
    L = ['%s=%r' % (key, value)