Subversion Repositories SmartDukaan

Rev

Rev 2981 | Rev 3385 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
1976 varun.gupt 1
#
2
# Autogenerated by Thrift
3
#
4
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
#
6
 
7
from thrift.Thrift import *
3376 rajveer 8
import shop2020.thriftpy.generic.GenericService
1976 varun.gupt 9
from ttypes import *
10
from thrift.Thrift import TProcessor
11
from thrift.transport import TTransport
12
from thrift.protocol import TBinaryProtocol
13
try:
14
  from thrift.protocol import fastbinary
15
except:
16
  fastbinary = None
17
 
18
 
3376 rajveer 19
class Iface(shop2020.thriftpy.generic.GenericService.Iface):
1976 varun.gupt 20
  """
21
  Promotion Service
22
  """
23
  def closeSession(self, ):
24
    """
25
    For closing the open session in sqlalchemy
26
    """
27
    pass
28
 
29
  def createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
30
    """
31
    Parameters:
32
     - name
33
     - ruleExecutionSrc
34
     - startOn
35
     - endOn
36
    """
37
    pass
38
 
39
  def getAllPromotions(self, ):
40
    pass
41
 
42
  def getPromotionById(self, promotionId):
43
    """
44
    Parameters:
45
     - promotionId
46
    """
47
    pass
48
 
49
  def generateCouponsForPromotion(self, promotionId, couponCode):
50
    """
51
    Parameters:
52
     - promotionId
53
     - couponCode
54
    """
55
    pass
56
 
57
  def applyCoupon(self, couponCode, cartId):
58
    """
59
    Parameters:
60
     - couponCode
61
     - cartId
62
    """
63
    pass
64
 
65
  def trackCouponUsage(self, couponCode, transactionId, userId):
66
    """
67
    Parameters:
68
     - couponCode
69
     - transactionId
70
     - userId
71
    """
72
    pass
73
 
74
  def getCouponUsageCountByUser(self, couponCode, userId):
75
    """
76
    Parameters:
77
     - couponCode
78
     - userId
79
    """
80
    pass
81
 
82
 
3376 rajveer 83
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
1976 varun.gupt 84
  """
85
  Promotion Service
86
  """
87
  def __init__(self, iprot, oprot=None):
3376 rajveer 88
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
1976 varun.gupt 89
 
90
  def closeSession(self, ):
91
    """
92
    For closing the open session in sqlalchemy
93
    """
94
    self.send_closeSession()
95
    self.recv_closeSession()
96
 
97
  def send_closeSession(self, ):
98
    self._oprot.writeMessageBegin('closeSession', TMessageType.CALL, self._seqid)
99
    args = closeSession_args()
100
    args.write(self._oprot)
101
    self._oprot.writeMessageEnd()
102
    self._oprot.trans.flush()
103
 
104
  def recv_closeSession(self, ):
105
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
106
    if mtype == TMessageType.EXCEPTION:
107
      x = TApplicationException()
108
      x.read(self._iprot)
109
      self._iprot.readMessageEnd()
110
      raise x
111
    result = closeSession_result()
112
    result.read(self._iprot)
113
    self._iprot.readMessageEnd()
114
    return
115
 
116
  def createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
117
    """
118
    Parameters:
119
     - name
120
     - ruleExecutionSrc
121
     - startOn
122
     - endOn
123
    """
124
    self.send_createPromotion(name, ruleExecutionSrc, startOn, endOn)
125
    self.recv_createPromotion()
126
 
127
  def send_createPromotion(self, name, ruleExecutionSrc, startOn, endOn):
128
    self._oprot.writeMessageBegin('createPromotion', TMessageType.CALL, self._seqid)
129
    args = createPromotion_args()
130
    args.name = name
131
    args.ruleExecutionSrc = ruleExecutionSrc
132
    args.startOn = startOn
133
    args.endOn = endOn
134
    args.write(self._oprot)
135
    self._oprot.writeMessageEnd()
136
    self._oprot.trans.flush()
137
 
138
  def recv_createPromotion(self, ):
139
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
140
    if mtype == TMessageType.EXCEPTION:
141
      x = TApplicationException()
142
      x.read(self._iprot)
143
      self._iprot.readMessageEnd()
144
      raise x
145
    result = createPromotion_result()
146
    result.read(self._iprot)
147
    self._iprot.readMessageEnd()
148
    if result.pex != None:
149
      raise result.pex
150
    return
151
 
152
  def getAllPromotions(self, ):
153
    self.send_getAllPromotions()
154
    return self.recv_getAllPromotions()
155
 
156
  def send_getAllPromotions(self, ):
157
    self._oprot.writeMessageBegin('getAllPromotions', TMessageType.CALL, self._seqid)
158
    args = getAllPromotions_args()
159
    args.write(self._oprot)
160
    self._oprot.writeMessageEnd()
161
    self._oprot.trans.flush()
162
 
163
  def recv_getAllPromotions(self, ):
164
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
165
    if mtype == TMessageType.EXCEPTION:
166
      x = TApplicationException()
167
      x.read(self._iprot)
168
      self._iprot.readMessageEnd()
169
      raise x
170
    result = getAllPromotions_result()
171
    result.read(self._iprot)
172
    self._iprot.readMessageEnd()
173
    if result.success != None:
174
      return result.success
175
    if result.pex != None:
176
      raise result.pex
177
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getAllPromotions failed: unknown result");
178
 
179
  def getPromotionById(self, promotionId):
180
    """
181
    Parameters:
182
     - promotionId
183
    """
184
    self.send_getPromotionById(promotionId)
185
    return self.recv_getPromotionById()
186
 
187
  def send_getPromotionById(self, promotionId):
188
    self._oprot.writeMessageBegin('getPromotionById', TMessageType.CALL, self._seqid)
189
    args = getPromotionById_args()
190
    args.promotionId = promotionId
191
    args.write(self._oprot)
192
    self._oprot.writeMessageEnd()
193
    self._oprot.trans.flush()
194
 
195
  def recv_getPromotionById(self, ):
196
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
197
    if mtype == TMessageType.EXCEPTION:
198
      x = TApplicationException()
199
      x.read(self._iprot)
200
      self._iprot.readMessageEnd()
201
      raise x
202
    result = getPromotionById_result()
203
    result.read(self._iprot)
204
    self._iprot.readMessageEnd()
205
    if result.success != None:
206
      return result.success
207
    if result.pex != None:
208
      raise result.pex
209
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getPromotionById failed: unknown result");
210
 
211
  def generateCouponsForPromotion(self, promotionId, couponCode):
212
    """
213
    Parameters:
214
     - promotionId
215
     - couponCode
216
    """
217
    self.send_generateCouponsForPromotion(promotionId, couponCode)
218
    self.recv_generateCouponsForPromotion()
219
 
220
  def send_generateCouponsForPromotion(self, promotionId, couponCode):
221
    self._oprot.writeMessageBegin('generateCouponsForPromotion', TMessageType.CALL, self._seqid)
222
    args = generateCouponsForPromotion_args()
223
    args.promotionId = promotionId
224
    args.couponCode = couponCode
225
    args.write(self._oprot)
226
    self._oprot.writeMessageEnd()
227
    self._oprot.trans.flush()
228
 
229
  def recv_generateCouponsForPromotion(self, ):
230
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
231
    if mtype == TMessageType.EXCEPTION:
232
      x = TApplicationException()
233
      x.read(self._iprot)
234
      self._iprot.readMessageEnd()
235
      raise x
236
    result = generateCouponsForPromotion_result()
237
    result.read(self._iprot)
238
    self._iprot.readMessageEnd()
239
    if result.pex != None:
240
      raise result.pex
241
    return
242
 
243
  def applyCoupon(self, couponCode, cartId):
244
    """
245
    Parameters:
246
     - couponCode
247
     - cartId
248
    """
249
    self.send_applyCoupon(couponCode, cartId)
250
    return self.recv_applyCoupon()
251
 
252
  def send_applyCoupon(self, couponCode, cartId):
253
    self._oprot.writeMessageBegin('applyCoupon', TMessageType.CALL, self._seqid)
254
    args = applyCoupon_args()
255
    args.couponCode = couponCode
256
    args.cartId = cartId
257
    args.write(self._oprot)
258
    self._oprot.writeMessageEnd()
259
    self._oprot.trans.flush()
260
 
261
  def recv_applyCoupon(self, ):
262
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
263
    if mtype == TMessageType.EXCEPTION:
264
      x = TApplicationException()
265
      x.read(self._iprot)
266
      self._iprot.readMessageEnd()
267
      raise x
268
    result = applyCoupon_result()
269
    result.read(self._iprot)
270
    self._iprot.readMessageEnd()
271
    if result.success != None:
272
      return result.success
273
    if result.pex != None:
274
      raise result.pex
275
    raise TApplicationException(TApplicationException.MISSING_RESULT, "applyCoupon failed: unknown result");
276
 
277
  def trackCouponUsage(self, couponCode, transactionId, userId):
278
    """
279
    Parameters:
280
     - couponCode
281
     - transactionId
282
     - userId
283
    """
284
    self.send_trackCouponUsage(couponCode, transactionId, userId)
285
    self.recv_trackCouponUsage()
286
 
287
  def send_trackCouponUsage(self, couponCode, transactionId, userId):
288
    self._oprot.writeMessageBegin('trackCouponUsage', TMessageType.CALL, self._seqid)
289
    args = trackCouponUsage_args()
290
    args.couponCode = couponCode
291
    args.transactionId = transactionId
292
    args.userId = userId
293
    args.write(self._oprot)
294
    self._oprot.writeMessageEnd()
295
    self._oprot.trans.flush()
296
 
297
  def recv_trackCouponUsage(self, ):
298
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
299
    if mtype == TMessageType.EXCEPTION:
300
      x = TApplicationException()
301
      x.read(self._iprot)
302
      self._iprot.readMessageEnd()
303
      raise x
304
    result = trackCouponUsage_result()
305
    result.read(self._iprot)
306
    self._iprot.readMessageEnd()
307
    if result.pex != None:
308
      raise result.pex
309
    return
310
 
311
  def getCouponUsageCountByUser(self, couponCode, userId):
312
    """
313
    Parameters:
314
     - couponCode
315
     - userId
316
    """
317
    self.send_getCouponUsageCountByUser(couponCode, userId)
318
    return self.recv_getCouponUsageCountByUser()
319
 
320
  def send_getCouponUsageCountByUser(self, couponCode, userId):
321
    self._oprot.writeMessageBegin('getCouponUsageCountByUser', TMessageType.CALL, self._seqid)
322
    args = getCouponUsageCountByUser_args()
323
    args.couponCode = couponCode
324
    args.userId = userId
325
    args.write(self._oprot)
326
    self._oprot.writeMessageEnd()
327
    self._oprot.trans.flush()
328
 
329
  def recv_getCouponUsageCountByUser(self, ):
330
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
331
    if mtype == TMessageType.EXCEPTION:
332
      x = TApplicationException()
333
      x.read(self._iprot)
334
      self._iprot.readMessageEnd()
335
      raise x
336
    result = getCouponUsageCountByUser_result()
337
    result.read(self._iprot)
338
    self._iprot.readMessageEnd()
339
    if result.success != None:
340
      return result.success
341
    if result.pex != None:
342
      raise result.pex
343
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getCouponUsageCountByUser failed: unknown result");
344
 
345
 
3376 rajveer 346
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
1976 varun.gupt 347
  def __init__(self, handler):
3376 rajveer 348
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
1976 varun.gupt 349
    self._processMap["closeSession"] = Processor.process_closeSession
350
    self._processMap["createPromotion"] = Processor.process_createPromotion
351
    self._processMap["getAllPromotions"] = Processor.process_getAllPromotions
352
    self._processMap["getPromotionById"] = Processor.process_getPromotionById
353
    self._processMap["generateCouponsForPromotion"] = Processor.process_generateCouponsForPromotion
354
    self._processMap["applyCoupon"] = Processor.process_applyCoupon
355
    self._processMap["trackCouponUsage"] = Processor.process_trackCouponUsage
356
    self._processMap["getCouponUsageCountByUser"] = Processor.process_getCouponUsageCountByUser
357
 
358
  def process(self, iprot, oprot):
359
    (name, type, seqid) = iprot.readMessageBegin()
360
    if name not in self._processMap:
361
      iprot.skip(TType.STRUCT)
362
      iprot.readMessageEnd()
363
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
364
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
365
      x.write(oprot)
366
      oprot.writeMessageEnd()
367
      oprot.trans.flush()
368
      return
369
    else:
370
      self._processMap[name](self, seqid, iprot, oprot)
371
    return True
372
 
373
  def process_closeSession(self, seqid, iprot, oprot):
374
    args = closeSession_args()
375
    args.read(iprot)
376
    iprot.readMessageEnd()
377
    result = closeSession_result()
378
    self._handler.closeSession()
379
    oprot.writeMessageBegin("closeSession", TMessageType.REPLY, seqid)
380
    result.write(oprot)
381
    oprot.writeMessageEnd()
382
    oprot.trans.flush()
383
 
384
  def process_createPromotion(self, seqid, iprot, oprot):
385
    args = createPromotion_args()
386
    args.read(iprot)
387
    iprot.readMessageEnd()
388
    result = createPromotion_result()
389
    try:
390
      self._handler.createPromotion(args.name, args.ruleExecutionSrc, args.startOn, args.endOn)
391
    except PromotionException, pex:
392
      result.pex = pex
393
    oprot.writeMessageBegin("createPromotion", TMessageType.REPLY, seqid)
394
    result.write(oprot)
395
    oprot.writeMessageEnd()
396
    oprot.trans.flush()
397
 
398
  def process_getAllPromotions(self, seqid, iprot, oprot):
399
    args = getAllPromotions_args()
400
    args.read(iprot)
401
    iprot.readMessageEnd()
402
    result = getAllPromotions_result()
403
    try:
404
      result.success = self._handler.getAllPromotions()
405
    except PromotionException, pex:
406
      result.pex = pex
407
    oprot.writeMessageBegin("getAllPromotions", TMessageType.REPLY, seqid)
408
    result.write(oprot)
409
    oprot.writeMessageEnd()
410
    oprot.trans.flush()
411
 
412
  def process_getPromotionById(self, seqid, iprot, oprot):
413
    args = getPromotionById_args()
414
    args.read(iprot)
415
    iprot.readMessageEnd()
416
    result = getPromotionById_result()
417
    try:
418
      result.success = self._handler.getPromotionById(args.promotionId)
419
    except PromotionException, pex:
420
      result.pex = pex
421
    oprot.writeMessageBegin("getPromotionById", TMessageType.REPLY, seqid)
422
    result.write(oprot)
423
    oprot.writeMessageEnd()
424
    oprot.trans.flush()
425
 
426
  def process_generateCouponsForPromotion(self, seqid, iprot, oprot):
427
    args = generateCouponsForPromotion_args()
428
    args.read(iprot)
429
    iprot.readMessageEnd()
430
    result = generateCouponsForPromotion_result()
431
    try:
432
      self._handler.generateCouponsForPromotion(args.promotionId, args.couponCode)
433
    except PromotionException, pex:
434
      result.pex = pex
435
    oprot.writeMessageBegin("generateCouponsForPromotion", TMessageType.REPLY, seqid)
436
    result.write(oprot)
437
    oprot.writeMessageEnd()
438
    oprot.trans.flush()
439
 
440
  def process_applyCoupon(self, seqid, iprot, oprot):
441
    args = applyCoupon_args()
442
    args.read(iprot)
443
    iprot.readMessageEnd()
444
    result = applyCoupon_result()
445
    try:
446
      result.success = self._handler.applyCoupon(args.couponCode, args.cartId)
447
    except PromotionException, pex:
448
      result.pex = pex
449
    oprot.writeMessageBegin("applyCoupon", TMessageType.REPLY, seqid)
450
    result.write(oprot)
451
    oprot.writeMessageEnd()
452
    oprot.trans.flush()
453
 
454
  def process_trackCouponUsage(self, seqid, iprot, oprot):
455
    args = trackCouponUsage_args()
456
    args.read(iprot)
457
    iprot.readMessageEnd()
458
    result = trackCouponUsage_result()
459
    try:
460
      self._handler.trackCouponUsage(args.couponCode, args.transactionId, args.userId)
461
    except PromotionException, pex:
462
      result.pex = pex
463
    oprot.writeMessageBegin("trackCouponUsage", TMessageType.REPLY, seqid)
464
    result.write(oprot)
465
    oprot.writeMessageEnd()
466
    oprot.trans.flush()
467
 
468
  def process_getCouponUsageCountByUser(self, seqid, iprot, oprot):
469
    args = getCouponUsageCountByUser_args()
470
    args.read(iprot)
471
    iprot.readMessageEnd()
472
    result = getCouponUsageCountByUser_result()
473
    try:
474
      result.success = self._handler.getCouponUsageCountByUser(args.couponCode, args.userId)
475
    except PromotionException, pex:
476
      result.pex = pex
477
    oprot.writeMessageBegin("getCouponUsageCountByUser", TMessageType.REPLY, seqid)
478
    result.write(oprot)
479
    oprot.writeMessageEnd()
480
    oprot.trans.flush()
481
 
482
 
483
# HELPER FUNCTIONS AND STRUCTURES
484
 
485
class closeSession_args:
486
 
487
  thrift_spec = (
488
  )
489
 
490
  def read(self, iprot):
491
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
492
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
493
      return
494
    iprot.readStructBegin()
495
    while True:
496
      (fname, ftype, fid) = iprot.readFieldBegin()
497
      if ftype == TType.STOP:
498
        break
499
      else:
500
        iprot.skip(ftype)
501
      iprot.readFieldEnd()
502
    iprot.readStructEnd()
503
 
504
  def write(self, oprot):
505
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
506
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
507
      return
508
    oprot.writeStructBegin('closeSession_args')
509
    oprot.writeFieldStop()
510
    oprot.writeStructEnd()
511
 
512
  def __repr__(self):
513
    L = ['%s=%r' % (key, value)
514
      for key, value in self.__dict__.iteritems()]
515
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
516
 
517
  def __eq__(self, other):
518
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
519
 
520
  def __ne__(self, other):
521
    return not (self == other)
522
 
523
class closeSession_result:
524
 
525
  thrift_spec = (
526
  )
527
 
528
  def read(self, iprot):
529
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
530
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
531
      return
532
    iprot.readStructBegin()
533
    while True:
534
      (fname, ftype, fid) = iprot.readFieldBegin()
535
      if ftype == TType.STOP:
536
        break
537
      else:
538
        iprot.skip(ftype)
539
      iprot.readFieldEnd()
540
    iprot.readStructEnd()
541
 
542
  def write(self, oprot):
543
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
544
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
545
      return
546
    oprot.writeStructBegin('closeSession_result')
547
    oprot.writeFieldStop()
548
    oprot.writeStructEnd()
549
 
550
  def __repr__(self):
551
    L = ['%s=%r' % (key, value)
552
      for key, value in self.__dict__.iteritems()]
553
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
554
 
555
  def __eq__(self, other):
556
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
557
 
558
  def __ne__(self, other):
559
    return not (self == other)
560
 
561
class createPromotion_args:
562
  """
563
  Attributes:
564
   - name
565
   - ruleExecutionSrc
566
   - startOn
567
   - endOn
568
  """
569
 
570
  thrift_spec = (
571
    None, # 0
572
    (1, TType.STRING, 'name', None, None, ), # 1
573
    (2, TType.STRING, 'ruleExecutionSrc', None, None, ), # 2
574
    (3, TType.I64, 'startOn', None, None, ), # 3
575
    (4, TType.I64, 'endOn', None, None, ), # 4
576
  )
577
 
578
  def __init__(self, name=None, ruleExecutionSrc=None, startOn=None, endOn=None,):
579
    self.name = name
580
    self.ruleExecutionSrc = ruleExecutionSrc
581
    self.startOn = startOn
582
    self.endOn = endOn
583
 
584
  def read(self, iprot):
585
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
586
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
587
      return
588
    iprot.readStructBegin()
589
    while True:
590
      (fname, ftype, fid) = iprot.readFieldBegin()
591
      if ftype == TType.STOP:
592
        break
593
      if fid == 1:
594
        if ftype == TType.STRING:
595
          self.name = iprot.readString();
596
        else:
597
          iprot.skip(ftype)
598
      elif fid == 2:
599
        if ftype == TType.STRING:
600
          self.ruleExecutionSrc = iprot.readString();
601
        else:
602
          iprot.skip(ftype)
603
      elif fid == 3:
604
        if ftype == TType.I64:
605
          self.startOn = iprot.readI64();
606
        else:
607
          iprot.skip(ftype)
608
      elif fid == 4:
609
        if ftype == TType.I64:
610
          self.endOn = iprot.readI64();
611
        else:
612
          iprot.skip(ftype)
613
      else:
614
        iprot.skip(ftype)
615
      iprot.readFieldEnd()
616
    iprot.readStructEnd()
617
 
618
  def write(self, oprot):
619
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
620
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
621
      return
622
    oprot.writeStructBegin('createPromotion_args')
623
    if self.name != None:
624
      oprot.writeFieldBegin('name', TType.STRING, 1)
625
      oprot.writeString(self.name)
626
      oprot.writeFieldEnd()
627
    if self.ruleExecutionSrc != None:
628
      oprot.writeFieldBegin('ruleExecutionSrc', TType.STRING, 2)
629
      oprot.writeString(self.ruleExecutionSrc)
630
      oprot.writeFieldEnd()
631
    if self.startOn != None:
632
      oprot.writeFieldBegin('startOn', TType.I64, 3)
633
      oprot.writeI64(self.startOn)
634
      oprot.writeFieldEnd()
635
    if self.endOn != None:
636
      oprot.writeFieldBegin('endOn', TType.I64, 4)
637
      oprot.writeI64(self.endOn)
638
      oprot.writeFieldEnd()
639
    oprot.writeFieldStop()
640
    oprot.writeStructEnd()
641
 
642
  def __repr__(self):
643
    L = ['%s=%r' % (key, value)
644
      for key, value in self.__dict__.iteritems()]
645
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
646
 
647
  def __eq__(self, other):
648
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
649
 
650
  def __ne__(self, other):
651
    return not (self == other)
652
 
653
class createPromotion_result:
654
  """
655
  Attributes:
656
   - pex
657
  """
658
 
659
  thrift_spec = (
660
    None, # 0
661
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
662
  )
663
 
664
  def __init__(self, pex=None,):
665
    self.pex = pex
666
 
667
  def read(self, iprot):
668
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
669
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
670
      return
671
    iprot.readStructBegin()
672
    while True:
673
      (fname, ftype, fid) = iprot.readFieldBegin()
674
      if ftype == TType.STOP:
675
        break
676
      if fid == 1:
677
        if ftype == TType.STRUCT:
678
          self.pex = PromotionException()
679
          self.pex.read(iprot)
680
        else:
681
          iprot.skip(ftype)
682
      else:
683
        iprot.skip(ftype)
684
      iprot.readFieldEnd()
685
    iprot.readStructEnd()
686
 
687
  def write(self, oprot):
688
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
689
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
690
      return
691
    oprot.writeStructBegin('createPromotion_result')
692
    if self.pex != None:
693
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
694
      self.pex.write(oprot)
695
      oprot.writeFieldEnd()
696
    oprot.writeFieldStop()
697
    oprot.writeStructEnd()
698
 
699
  def __repr__(self):
700
    L = ['%s=%r' % (key, value)
701
      for key, value in self.__dict__.iteritems()]
702
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
703
 
704
  def __eq__(self, other):
705
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
706
 
707
  def __ne__(self, other):
708
    return not (self == other)
709
 
710
class getAllPromotions_args:
711
 
712
  thrift_spec = (
713
  )
714
 
715
  def read(self, iprot):
716
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
717
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
718
      return
719
    iprot.readStructBegin()
720
    while True:
721
      (fname, ftype, fid) = iprot.readFieldBegin()
722
      if ftype == TType.STOP:
723
        break
724
      else:
725
        iprot.skip(ftype)
726
      iprot.readFieldEnd()
727
    iprot.readStructEnd()
728
 
729
  def write(self, oprot):
730
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
731
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
732
      return
733
    oprot.writeStructBegin('getAllPromotions_args')
734
    oprot.writeFieldStop()
735
    oprot.writeStructEnd()
736
 
737
  def __repr__(self):
738
    L = ['%s=%r' % (key, value)
739
      for key, value in self.__dict__.iteritems()]
740
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
741
 
742
  def __eq__(self, other):
743
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
744
 
745
  def __ne__(self, other):
746
    return not (self == other)
747
 
748
class getAllPromotions_result:
749
  """
750
  Attributes:
751
   - success
752
   - pex
753
  """
754
 
755
  thrift_spec = (
756
    (0, TType.LIST, 'success', (TType.STRUCT,(Promotion, Promotion.thrift_spec)), None, ), # 0
757
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
758
  )
759
 
760
  def __init__(self, success=None, pex=None,):
761
    self.success = success
762
    self.pex = pex
763
 
764
  def read(self, iprot):
765
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
766
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
767
      return
768
    iprot.readStructBegin()
769
    while True:
770
      (fname, ftype, fid) = iprot.readFieldBegin()
771
      if ftype == TType.STOP:
772
        break
773
      if fid == 0:
774
        if ftype == TType.LIST:
775
          self.success = []
2981 rajveer 776
          (_etype24, _size21) = iprot.readListBegin()
777
          for _i25 in xrange(_size21):
778
            _elem26 = Promotion()
779
            _elem26.read(iprot)
780
            self.success.append(_elem26)
1976 varun.gupt 781
          iprot.readListEnd()
782
        else:
783
          iprot.skip(ftype)
784
      elif fid == 1:
785
        if ftype == TType.STRUCT:
786
          self.pex = PromotionException()
787
          self.pex.read(iprot)
788
        else:
789
          iprot.skip(ftype)
790
      else:
791
        iprot.skip(ftype)
792
      iprot.readFieldEnd()
793
    iprot.readStructEnd()
794
 
795
  def write(self, oprot):
796
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
797
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
798
      return
799
    oprot.writeStructBegin('getAllPromotions_result')
800
    if self.success != None:
801
      oprot.writeFieldBegin('success', TType.LIST, 0)
802
      oprot.writeListBegin(TType.STRUCT, len(self.success))
2981 rajveer 803
      for iter27 in self.success:
804
        iter27.write(oprot)
1976 varun.gupt 805
      oprot.writeListEnd()
806
      oprot.writeFieldEnd()
807
    if self.pex != None:
808
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
809
      self.pex.write(oprot)
810
      oprot.writeFieldEnd()
811
    oprot.writeFieldStop()
812
    oprot.writeStructEnd()
813
 
814
  def __repr__(self):
815
    L = ['%s=%r' % (key, value)
816
      for key, value in self.__dict__.iteritems()]
817
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
818
 
819
  def __eq__(self, other):
820
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
821
 
822
  def __ne__(self, other):
823
    return not (self == other)
824
 
825
class getPromotionById_args:
826
  """
827
  Attributes:
828
   - promotionId
829
  """
830
 
831
  thrift_spec = (
832
    None, # 0
833
    (1, TType.I64, 'promotionId', None, None, ), # 1
834
  )
835
 
836
  def __init__(self, promotionId=None,):
837
    self.promotionId = promotionId
838
 
839
  def read(self, iprot):
840
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
841
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
842
      return
843
    iprot.readStructBegin()
844
    while True:
845
      (fname, ftype, fid) = iprot.readFieldBegin()
846
      if ftype == TType.STOP:
847
        break
848
      if fid == 1:
849
        if ftype == TType.I64:
850
          self.promotionId = iprot.readI64();
851
        else:
852
          iprot.skip(ftype)
853
      else:
854
        iprot.skip(ftype)
855
      iprot.readFieldEnd()
856
    iprot.readStructEnd()
857
 
858
  def write(self, oprot):
859
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
860
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
861
      return
862
    oprot.writeStructBegin('getPromotionById_args')
863
    if self.promotionId != None:
864
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
865
      oprot.writeI64(self.promotionId)
866
      oprot.writeFieldEnd()
867
    oprot.writeFieldStop()
868
    oprot.writeStructEnd()
869
 
870
  def __repr__(self):
871
    L = ['%s=%r' % (key, value)
872
      for key, value in self.__dict__.iteritems()]
873
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
874
 
875
  def __eq__(self, other):
876
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
877
 
878
  def __ne__(self, other):
879
    return not (self == other)
880
 
881
class getPromotionById_result:
882
  """
883
  Attributes:
884
   - success
885
   - pex
886
  """
887
 
888
  thrift_spec = (
889
    (0, TType.STRUCT, 'success', (Promotion, Promotion.thrift_spec), None, ), # 0
890
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
891
  )
892
 
893
  def __init__(self, success=None, pex=None,):
894
    self.success = success
895
    self.pex = pex
896
 
897
  def read(self, iprot):
898
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
899
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
900
      return
901
    iprot.readStructBegin()
902
    while True:
903
      (fname, ftype, fid) = iprot.readFieldBegin()
904
      if ftype == TType.STOP:
905
        break
906
      if fid == 0:
907
        if ftype == TType.STRUCT:
908
          self.success = Promotion()
909
          self.success.read(iprot)
910
        else:
911
          iprot.skip(ftype)
912
      elif fid == 1:
913
        if ftype == TType.STRUCT:
914
          self.pex = PromotionException()
915
          self.pex.read(iprot)
916
        else:
917
          iprot.skip(ftype)
918
      else:
919
        iprot.skip(ftype)
920
      iprot.readFieldEnd()
921
    iprot.readStructEnd()
922
 
923
  def write(self, oprot):
924
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
925
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
926
      return
927
    oprot.writeStructBegin('getPromotionById_result')
928
    if self.success != None:
929
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
930
      self.success.write(oprot)
931
      oprot.writeFieldEnd()
932
    if self.pex != None:
933
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
934
      self.pex.write(oprot)
935
      oprot.writeFieldEnd()
936
    oprot.writeFieldStop()
937
    oprot.writeStructEnd()
938
 
939
  def __repr__(self):
940
    L = ['%s=%r' % (key, value)
941
      for key, value in self.__dict__.iteritems()]
942
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
943
 
944
  def __eq__(self, other):
945
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
946
 
947
  def __ne__(self, other):
948
    return not (self == other)
949
 
950
class generateCouponsForPromotion_args:
951
  """
952
  Attributes:
953
   - promotionId
954
   - couponCode
955
  """
956
 
957
  thrift_spec = (
958
    None, # 0
959
    (1, TType.I64, 'promotionId', None, None, ), # 1
960
    (2, TType.STRING, 'couponCode', None, None, ), # 2
961
  )
962
 
963
  def __init__(self, promotionId=None, couponCode=None,):
964
    self.promotionId = promotionId
965
    self.couponCode = couponCode
966
 
967
  def read(self, iprot):
968
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
969
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
970
      return
971
    iprot.readStructBegin()
972
    while True:
973
      (fname, ftype, fid) = iprot.readFieldBegin()
974
      if ftype == TType.STOP:
975
        break
976
      if fid == 1:
977
        if ftype == TType.I64:
978
          self.promotionId = iprot.readI64();
979
        else:
980
          iprot.skip(ftype)
981
      elif fid == 2:
982
        if ftype == TType.STRING:
983
          self.couponCode = iprot.readString();
984
        else:
985
          iprot.skip(ftype)
986
      else:
987
        iprot.skip(ftype)
988
      iprot.readFieldEnd()
989
    iprot.readStructEnd()
990
 
991
  def write(self, oprot):
992
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
993
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
994
      return
995
    oprot.writeStructBegin('generateCouponsForPromotion_args')
996
    if self.promotionId != None:
997
      oprot.writeFieldBegin('promotionId', TType.I64, 1)
998
      oprot.writeI64(self.promotionId)
999
      oprot.writeFieldEnd()
1000
    if self.couponCode != None:
1001
      oprot.writeFieldBegin('couponCode', TType.STRING, 2)
1002
      oprot.writeString(self.couponCode)
1003
      oprot.writeFieldEnd()
1004
    oprot.writeFieldStop()
1005
    oprot.writeStructEnd()
1006
 
1007
  def __repr__(self):
1008
    L = ['%s=%r' % (key, value)
1009
      for key, value in self.__dict__.iteritems()]
1010
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1011
 
1012
  def __eq__(self, other):
1013
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1014
 
1015
  def __ne__(self, other):
1016
    return not (self == other)
1017
 
1018
class generateCouponsForPromotion_result:
1019
  """
1020
  Attributes:
1021
   - pex
1022
  """
1023
 
1024
  thrift_spec = (
1025
    None, # 0
1026
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
1027
  )
1028
 
1029
  def __init__(self, pex=None,):
1030
    self.pex = pex
1031
 
1032
  def read(self, iprot):
1033
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1034
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1035
      return
1036
    iprot.readStructBegin()
1037
    while True:
1038
      (fname, ftype, fid) = iprot.readFieldBegin()
1039
      if ftype == TType.STOP:
1040
        break
1041
      if fid == 1:
1042
        if ftype == TType.STRUCT:
1043
          self.pex = PromotionException()
1044
          self.pex.read(iprot)
1045
        else:
1046
          iprot.skip(ftype)
1047
      else:
1048
        iprot.skip(ftype)
1049
      iprot.readFieldEnd()
1050
    iprot.readStructEnd()
1051
 
1052
  def write(self, oprot):
1053
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1054
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1055
      return
1056
    oprot.writeStructBegin('generateCouponsForPromotion_result')
1057
    if self.pex != None:
1058
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1059
      self.pex.write(oprot)
1060
      oprot.writeFieldEnd()
1061
    oprot.writeFieldStop()
1062
    oprot.writeStructEnd()
1063
 
1064
  def __repr__(self):
1065
    L = ['%s=%r' % (key, value)
1066
      for key, value in self.__dict__.iteritems()]
1067
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1068
 
1069
  def __eq__(self, other):
1070
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1071
 
1072
  def __ne__(self, other):
1073
    return not (self == other)
1074
 
1075
class applyCoupon_args:
1076
  """
1077
  Attributes:
1078
   - couponCode
1079
   - cartId
1080
  """
1081
 
1082
  thrift_spec = (
1083
    None, # 0
1084
    (1, TType.STRING, 'couponCode', None, None, ), # 1
1085
    (2, TType.I64, 'cartId', None, None, ), # 2
1086
  )
1087
 
1088
  def __init__(self, couponCode=None, cartId=None,):
1089
    self.couponCode = couponCode
1090
    self.cartId = cartId
1091
 
1092
  def read(self, iprot):
1093
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1094
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1095
      return
1096
    iprot.readStructBegin()
1097
    while True:
1098
      (fname, ftype, fid) = iprot.readFieldBegin()
1099
      if ftype == TType.STOP:
1100
        break
1101
      if fid == 1:
1102
        if ftype == TType.STRING:
1103
          self.couponCode = iprot.readString();
1104
        else:
1105
          iprot.skip(ftype)
1106
      elif fid == 2:
1107
        if ftype == TType.I64:
1108
          self.cartId = iprot.readI64();
1109
        else:
1110
          iprot.skip(ftype)
1111
      else:
1112
        iprot.skip(ftype)
1113
      iprot.readFieldEnd()
1114
    iprot.readStructEnd()
1115
 
1116
  def write(self, oprot):
1117
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1118
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1119
      return
1120
    oprot.writeStructBegin('applyCoupon_args')
1121
    if self.couponCode != None:
1122
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
1123
      oprot.writeString(self.couponCode)
1124
      oprot.writeFieldEnd()
1125
    if self.cartId != None:
1126
      oprot.writeFieldBegin('cartId', TType.I64, 2)
1127
      oprot.writeI64(self.cartId)
1128
      oprot.writeFieldEnd()
1129
    oprot.writeFieldStop()
1130
    oprot.writeStructEnd()
1131
 
1132
  def __repr__(self):
1133
    L = ['%s=%r' % (key, value)
1134
      for key, value in self.__dict__.iteritems()]
1135
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1136
 
1137
  def __eq__(self, other):
1138
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1139
 
1140
  def __ne__(self, other):
1141
    return not (self == other)
1142
 
1143
class applyCoupon_result:
1144
  """
1145
  Attributes:
1146
   - success
1147
   - pex
1148
  """
1149
 
1150
  thrift_spec = (
1151
    (0, TType.STRUCT, 'success', (Cart, Cart.thrift_spec), None, ), # 0
1152
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
1153
  )
1154
 
1155
  def __init__(self, success=None, pex=None,):
1156
    self.success = success
1157
    self.pex = pex
1158
 
1159
  def read(self, iprot):
1160
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1161
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1162
      return
1163
    iprot.readStructBegin()
1164
    while True:
1165
      (fname, ftype, fid) = iprot.readFieldBegin()
1166
      if ftype == TType.STOP:
1167
        break
1168
      if fid == 0:
1169
        if ftype == TType.STRUCT:
1170
          self.success = Cart()
1171
          self.success.read(iprot)
1172
        else:
1173
          iprot.skip(ftype)
1174
      elif fid == 1:
1175
        if ftype == TType.STRUCT:
1176
          self.pex = PromotionException()
1177
          self.pex.read(iprot)
1178
        else:
1179
          iprot.skip(ftype)
1180
      else:
1181
        iprot.skip(ftype)
1182
      iprot.readFieldEnd()
1183
    iprot.readStructEnd()
1184
 
1185
  def write(self, oprot):
1186
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1187
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1188
      return
1189
    oprot.writeStructBegin('applyCoupon_result')
1190
    if self.success != None:
1191
      oprot.writeFieldBegin('success', TType.STRUCT, 0)
1192
      self.success.write(oprot)
1193
      oprot.writeFieldEnd()
1194
    if self.pex != None:
1195
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1196
      self.pex.write(oprot)
1197
      oprot.writeFieldEnd()
1198
    oprot.writeFieldStop()
1199
    oprot.writeStructEnd()
1200
 
1201
  def __repr__(self):
1202
    L = ['%s=%r' % (key, value)
1203
      for key, value in self.__dict__.iteritems()]
1204
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1205
 
1206
  def __eq__(self, other):
1207
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1208
 
1209
  def __ne__(self, other):
1210
    return not (self == other)
1211
 
1212
class trackCouponUsage_args:
1213
  """
1214
  Attributes:
1215
   - couponCode
1216
   - transactionId
1217
   - userId
1218
  """
1219
 
1220
  thrift_spec = (
1221
    None, # 0
1222
    (1, TType.STRING, 'couponCode', None, None, ), # 1
1223
    (2, TType.I64, 'transactionId', None, None, ), # 2
1224
    (3, TType.I64, 'userId', None, None, ), # 3
1225
  )
1226
 
1227
  def __init__(self, couponCode=None, transactionId=None, userId=None,):
1228
    self.couponCode = couponCode
1229
    self.transactionId = transactionId
1230
    self.userId = userId
1231
 
1232
  def read(self, iprot):
1233
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1234
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1235
      return
1236
    iprot.readStructBegin()
1237
    while True:
1238
      (fname, ftype, fid) = iprot.readFieldBegin()
1239
      if ftype == TType.STOP:
1240
        break
1241
      if fid == 1:
1242
        if ftype == TType.STRING:
1243
          self.couponCode = iprot.readString();
1244
        else:
1245
          iprot.skip(ftype)
1246
      elif fid == 2:
1247
        if ftype == TType.I64:
1248
          self.transactionId = iprot.readI64();
1249
        else:
1250
          iprot.skip(ftype)
1251
      elif fid == 3:
1252
        if ftype == TType.I64:
1253
          self.userId = iprot.readI64();
1254
        else:
1255
          iprot.skip(ftype)
1256
      else:
1257
        iprot.skip(ftype)
1258
      iprot.readFieldEnd()
1259
    iprot.readStructEnd()
1260
 
1261
  def write(self, oprot):
1262
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1263
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1264
      return
1265
    oprot.writeStructBegin('trackCouponUsage_args')
1266
    if self.couponCode != None:
1267
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
1268
      oprot.writeString(self.couponCode)
1269
      oprot.writeFieldEnd()
1270
    if self.transactionId != None:
1271
      oprot.writeFieldBegin('transactionId', TType.I64, 2)
1272
      oprot.writeI64(self.transactionId)
1273
      oprot.writeFieldEnd()
1274
    if self.userId != None:
1275
      oprot.writeFieldBegin('userId', TType.I64, 3)
1276
      oprot.writeI64(self.userId)
1277
      oprot.writeFieldEnd()
1278
    oprot.writeFieldStop()
1279
    oprot.writeStructEnd()
1280
 
1281
  def __repr__(self):
1282
    L = ['%s=%r' % (key, value)
1283
      for key, value in self.__dict__.iteritems()]
1284
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1285
 
1286
  def __eq__(self, other):
1287
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1288
 
1289
  def __ne__(self, other):
1290
    return not (self == other)
1291
 
1292
class trackCouponUsage_result:
1293
  """
1294
  Attributes:
1295
   - pex
1296
  """
1297
 
1298
  thrift_spec = (
1299
    None, # 0
1300
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
1301
  )
1302
 
1303
  def __init__(self, pex=None,):
1304
    self.pex = pex
1305
 
1306
  def read(self, iprot):
1307
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1308
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1309
      return
1310
    iprot.readStructBegin()
1311
    while True:
1312
      (fname, ftype, fid) = iprot.readFieldBegin()
1313
      if ftype == TType.STOP:
1314
        break
1315
      if fid == 1:
1316
        if ftype == TType.STRUCT:
1317
          self.pex = PromotionException()
1318
          self.pex.read(iprot)
1319
        else:
1320
          iprot.skip(ftype)
1321
      else:
1322
        iprot.skip(ftype)
1323
      iprot.readFieldEnd()
1324
    iprot.readStructEnd()
1325
 
1326
  def write(self, oprot):
1327
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1328
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1329
      return
1330
    oprot.writeStructBegin('trackCouponUsage_result')
1331
    if self.pex != None:
1332
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1333
      self.pex.write(oprot)
1334
      oprot.writeFieldEnd()
1335
    oprot.writeFieldStop()
1336
    oprot.writeStructEnd()
1337
 
1338
  def __repr__(self):
1339
    L = ['%s=%r' % (key, value)
1340
      for key, value in self.__dict__.iteritems()]
1341
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1342
 
1343
  def __eq__(self, other):
1344
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1345
 
1346
  def __ne__(self, other):
1347
    return not (self == other)
1348
 
1349
class getCouponUsageCountByUser_args:
1350
  """
1351
  Attributes:
1352
   - couponCode
1353
   - userId
1354
  """
1355
 
1356
  thrift_spec = (
1357
    None, # 0
1358
    (1, TType.STRING, 'couponCode', None, None, ), # 1
1359
    (2, TType.I64, 'userId', None, None, ), # 2
1360
  )
1361
 
1362
  def __init__(self, couponCode=None, userId=None,):
1363
    self.couponCode = couponCode
1364
    self.userId = userId
1365
 
1366
  def read(self, iprot):
1367
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1368
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1369
      return
1370
    iprot.readStructBegin()
1371
    while True:
1372
      (fname, ftype, fid) = iprot.readFieldBegin()
1373
      if ftype == TType.STOP:
1374
        break
1375
      if fid == 1:
1376
        if ftype == TType.STRING:
1377
          self.couponCode = iprot.readString();
1378
        else:
1379
          iprot.skip(ftype)
1380
      elif fid == 2:
1381
        if ftype == TType.I64:
1382
          self.userId = iprot.readI64();
1383
        else:
1384
          iprot.skip(ftype)
1385
      else:
1386
        iprot.skip(ftype)
1387
      iprot.readFieldEnd()
1388
    iprot.readStructEnd()
1389
 
1390
  def write(self, oprot):
1391
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1392
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1393
      return
1394
    oprot.writeStructBegin('getCouponUsageCountByUser_args')
1395
    if self.couponCode != None:
1396
      oprot.writeFieldBegin('couponCode', TType.STRING, 1)
1397
      oprot.writeString(self.couponCode)
1398
      oprot.writeFieldEnd()
1399
    if self.userId != None:
1400
      oprot.writeFieldBegin('userId', TType.I64, 2)
1401
      oprot.writeI64(self.userId)
1402
      oprot.writeFieldEnd()
1403
    oprot.writeFieldStop()
1404
    oprot.writeStructEnd()
1405
 
1406
  def __repr__(self):
1407
    L = ['%s=%r' % (key, value)
1408
      for key, value in self.__dict__.iteritems()]
1409
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1410
 
1411
  def __eq__(self, other):
1412
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1413
 
1414
  def __ne__(self, other):
1415
    return not (self == other)
1416
 
1417
class getCouponUsageCountByUser_result:
1418
  """
1419
  Attributes:
1420
   - success
1421
   - pex
1422
  """
1423
 
1424
  thrift_spec = (
1425
    (0, TType.I64, 'success', None, None, ), # 0
1426
    (1, TType.STRUCT, 'pex', (PromotionException, PromotionException.thrift_spec), None, ), # 1
1427
  )
1428
 
1429
  def __init__(self, success=None, pex=None,):
1430
    self.success = success
1431
    self.pex = pex
1432
 
1433
  def read(self, iprot):
1434
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
1435
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
1436
      return
1437
    iprot.readStructBegin()
1438
    while True:
1439
      (fname, ftype, fid) = iprot.readFieldBegin()
1440
      if ftype == TType.STOP:
1441
        break
1442
      if fid == 0:
1443
        if ftype == TType.I64:
1444
          self.success = iprot.readI64();
1445
        else:
1446
          iprot.skip(ftype)
1447
      elif fid == 1:
1448
        if ftype == TType.STRUCT:
1449
          self.pex = PromotionException()
1450
          self.pex.read(iprot)
1451
        else:
1452
          iprot.skip(ftype)
1453
      else:
1454
        iprot.skip(ftype)
1455
      iprot.readFieldEnd()
1456
    iprot.readStructEnd()
1457
 
1458
  def write(self, oprot):
1459
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
1460
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
1461
      return
1462
    oprot.writeStructBegin('getCouponUsageCountByUser_result')
1463
    if self.success != None:
1464
      oprot.writeFieldBegin('success', TType.I64, 0)
1465
      oprot.writeI64(self.success)
1466
      oprot.writeFieldEnd()
1467
    if self.pex != None:
1468
      oprot.writeFieldBegin('pex', TType.STRUCT, 1)
1469
      self.pex.write(oprot)
1470
      oprot.writeFieldEnd()
1471
    oprot.writeFieldStop()
1472
    oprot.writeStructEnd()
1473
 
1474
  def __repr__(self):
1475
    L = ['%s=%r' % (key, value)
1476
      for key, value in self.__dict__.iteritems()]
1477
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
1478
 
1479
  def __eq__(self, other):
1480
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
1481
 
1482
  def __ne__(self, other):
1483
    return not (self == other)
1484
 
1485