Subversion Repositories SmartDukaan

Rev

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