Subversion Repositories SmartDukaan

Rev

Rev 15170 | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
14371 kshitij.so 1
#
2
# Autogenerated by Thrift Compiler (0.7.0)
3
#
4
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
5
#
6
 
7
from thrift.Thrift import *
8
import shop2020.thriftpy.generic.GenericService
9
from ttypes import *
10
from thrift.Thrift import TProcessor
11
from thrift.transport import TTransport
12
from thrift.protocol import TBinaryProtocol, TProtocol
13
try:
14
  from thrift.protocol import fastbinary
15
except:
16
  fastbinary = None
17
 
18
 
19
class Iface(shop2020.thriftpy.generic.GenericService.Iface):
20
  def getLatestPricing(self, skuBundleId, source_id):
21
    """
22
    Parameters:
23
     - skuBundleId
24
     - source_id
25
    """
26
    pass
27
 
15170 kshitij.so 28
  def updateLatestPriceForItem(self, id):
29
    """
30
    Parameters:
31
     - id
32
    """
33
    pass
14371 kshitij.so 34
 
19247 kshitij.so 35
  def addItemsInBulk(self, bulkItemsList):
36
    """
37
    Parameters:
38
     - bulkItemsList
39
    """
40
    pass
15170 kshitij.so 41
 
19247 kshitij.so 42
 
14371 kshitij.so 43
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
44
  def __init__(self, iprot, oprot=None):
45
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
46
 
47
  def getLatestPricing(self, skuBundleId, source_id):
48
    """
49
    Parameters:
50
     - skuBundleId
51
     - source_id
52
    """
53
    self.send_getLatestPricing(skuBundleId, source_id)
54
    return self.recv_getLatestPricing()
55
 
56
  def send_getLatestPricing(self, skuBundleId, source_id):
57
    self._oprot.writeMessageBegin('getLatestPricing', TMessageType.CALL, self._seqid)
58
    args = getLatestPricing_args()
59
    args.skuBundleId = skuBundleId
60
    args.source_id = source_id
61
    args.write(self._oprot)
62
    self._oprot.writeMessageEnd()
63
    self._oprot.trans.flush()
64
 
65
  def recv_getLatestPricing(self, ):
66
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
67
    if mtype == TMessageType.EXCEPTION:
68
      x = TApplicationException()
69
      x.read(self._iprot)
70
      self._iprot.readMessageEnd()
71
      raise x
72
    result = getLatestPricing_result()
73
    result.read(self._iprot)
74
    self._iprot.readMessageEnd()
75
    if result.success is not None:
76
      return result.success
77
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLatestPricing failed: unknown result");
78
 
15170 kshitij.so 79
  def updateLatestPriceForItem(self, id):
80
    """
81
    Parameters:
82
     - id
83
    """
84
    self.send_updateLatestPriceForItem(id)
14371 kshitij.so 85
 
15170 kshitij.so 86
  def send_updateLatestPriceForItem(self, id):
87
    self._oprot.writeMessageBegin('updateLatestPriceForItem', TMessageType.CALL, self._seqid)
88
    args = updateLatestPriceForItem_args()
89
    args.id = id
90
    args.write(self._oprot)
91
    self._oprot.writeMessageEnd()
92
    self._oprot.trans.flush()
19247 kshitij.so 93
  def addItemsInBulk(self, bulkItemsList):
94
    """
95
    Parameters:
96
     - bulkItemsList
97
    """
98
    self.send_addItemsInBulk(bulkItemsList)
99
    return self.recv_addItemsInBulk()
15170 kshitij.so 100
 
19247 kshitij.so 101
  def send_addItemsInBulk(self, bulkItemsList):
102
    self._oprot.writeMessageBegin('addItemsInBulk', TMessageType.CALL, self._seqid)
103
    args = addItemsInBulk_args()
104
    args.bulkItemsList = bulkItemsList
105
    args.write(self._oprot)
106
    self._oprot.writeMessageEnd()
107
    self._oprot.trans.flush()
108
 
109
  def recv_addItemsInBulk(self, ):
110
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
111
    if mtype == TMessageType.EXCEPTION:
112
      x = TApplicationException()
113
      x.read(self._iprot)
114
      self._iprot.readMessageEnd()
115
      raise x
116
    result = addItemsInBulk_result()
117
    result.read(self._iprot)
118
    self._iprot.readMessageEnd()
119
    if result.success is not None:
120
      return result.success
121
    raise TApplicationException(TApplicationException.MISSING_RESULT, "addItemsInBulk failed: unknown result");
122
 
123
 
14371 kshitij.so 124
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
125
  def __init__(self, handler):
126
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
127
    self._processMap["getLatestPricing"] = Processor.process_getLatestPricing
15170 kshitij.so 128
    self._processMap["updateLatestPriceForItem"] = Processor.process_updateLatestPriceForItem
19247 kshitij.so 129
    self._processMap["addItemsInBulk"] = Processor.process_addItemsInBulk
14371 kshitij.so 130
 
131
  def process(self, iprot, oprot):
132
    (name, type, seqid) = iprot.readMessageBegin()
133
    if name not in self._processMap:
134
      iprot.skip(TType.STRUCT)
135
      iprot.readMessageEnd()
136
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
137
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
138
      x.write(oprot)
139
      oprot.writeMessageEnd()
140
      oprot.trans.flush()
141
      return
142
    else:
143
      self._processMap[name](self, seqid, iprot, oprot)
144
    return True
145
 
146
  def process_getLatestPricing(self, seqid, iprot, oprot):
147
    args = getLatestPricing_args()
148
    args.read(iprot)
149
    iprot.readMessageEnd()
150
    result = getLatestPricing_result()
151
    result.success = self._handler.getLatestPricing(args.skuBundleId, args.source_id)
152
    oprot.writeMessageBegin("getLatestPricing", TMessageType.REPLY, seqid)
153
    result.write(oprot)
154
    oprot.writeMessageEnd()
155
    oprot.trans.flush()
156
 
15170 kshitij.so 157
  def process_updateLatestPriceForItem(self, seqid, iprot, oprot):
158
    args = updateLatestPriceForItem_args()
159
    args.read(iprot)
160
    iprot.readMessageEnd()
161
    self._handler.updateLatestPriceForItem(args.id)
162
    return
14371 kshitij.so 163
 
19247 kshitij.so 164
  def process_addItemsInBulk(self, seqid, iprot, oprot):
165
    args = addItemsInBulk_args()
166
    args.read(iprot)
167
    iprot.readMessageEnd()
168
    result = addItemsInBulk_result()
169
    result.success = self._handler.addItemsInBulk(args.bulkItemsList)
170
    oprot.writeMessageBegin("addItemsInBulk", TMessageType.REPLY, seqid)
171
    result.write(oprot)
172
    oprot.writeMessageEnd()
173
    oprot.trans.flush()
15170 kshitij.so 174
 
19247 kshitij.so 175
 
14371 kshitij.so 176
# HELPER FUNCTIONS AND STRUCTURES
177
 
178
class getLatestPricing_args:
179
  """
180
  Attributes:
181
   - skuBundleId
182
   - source_id
183
  """
184
 
185
  thrift_spec = (
186
    None, # 0
187
    (1, TType.I64, 'skuBundleId', None, None, ), # 1
188
    (2, TType.I64, 'source_id', None, None, ), # 2
189
  )
190
 
191
  def __init__(self, skuBundleId=None, source_id=None,):
192
    self.skuBundleId = skuBundleId
193
    self.source_id = source_id
194
 
195
  def read(self, iprot):
196
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
197
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
198
      return
199
    iprot.readStructBegin()
200
    while True:
201
      (fname, ftype, fid) = iprot.readFieldBegin()
202
      if ftype == TType.STOP:
203
        break
204
      if fid == 1:
205
        if ftype == TType.I64:
206
          self.skuBundleId = iprot.readI64();
207
        else:
208
          iprot.skip(ftype)
209
      elif fid == 2:
210
        if ftype == TType.I64:
211
          self.source_id = iprot.readI64();
212
        else:
213
          iprot.skip(ftype)
214
      else:
215
        iprot.skip(ftype)
216
      iprot.readFieldEnd()
217
    iprot.readStructEnd()
218
 
219
  def write(self, oprot):
220
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
221
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
222
      return
223
    oprot.writeStructBegin('getLatestPricing_args')
224
    if self.skuBundleId is not None:
225
      oprot.writeFieldBegin('skuBundleId', TType.I64, 1)
226
      oprot.writeI64(self.skuBundleId)
227
      oprot.writeFieldEnd()
228
    if self.source_id is not None:
229
      oprot.writeFieldBegin('source_id', TType.I64, 2)
230
      oprot.writeI64(self.source_id)
231
      oprot.writeFieldEnd()
232
    oprot.writeFieldStop()
233
    oprot.writeStructEnd()
234
 
235
  def validate(self):
236
    return
237
 
238
 
239
  def __repr__(self):
240
    L = ['%s=%r' % (key, value)
241
      for key, value in self.__dict__.iteritems()]
242
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
243
 
244
  def __eq__(self, other):
245
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
246
 
247
  def __ne__(self, other):
248
    return not (self == other)
249
 
250
class getLatestPricing_result:
251
  """
252
  Attributes:
253
   - success
254
  """
255
 
256
  thrift_spec = (
257
    (0, TType.LIST, 'success', (TType.STRUCT,(LivePricing, LivePricing.thrift_spec)), None, ), # 0
258
  )
259
 
260
  def __init__(self, success=None,):
261
    self.success = success
262
 
263
  def read(self, iprot):
264
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
265
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
266
      return
267
    iprot.readStructBegin()
268
    while True:
269
      (fname, ftype, fid) = iprot.readFieldBegin()
270
      if ftype == TType.STOP:
271
        break
272
      if fid == 0:
273
        if ftype == TType.LIST:
274
          self.success = []
275
          (_etype3, _size0) = iprot.readListBegin()
276
          for _i4 in xrange(_size0):
277
            _elem5 = LivePricing()
278
            _elem5.read(iprot)
279
            self.success.append(_elem5)
280
          iprot.readListEnd()
281
        else:
282
          iprot.skip(ftype)
283
      else:
284
        iprot.skip(ftype)
285
      iprot.readFieldEnd()
286
    iprot.readStructEnd()
287
 
288
  def write(self, oprot):
289
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
290
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
291
      return
292
    oprot.writeStructBegin('getLatestPricing_result')
293
    if self.success is not None:
294
      oprot.writeFieldBegin('success', TType.LIST, 0)
295
      oprot.writeListBegin(TType.STRUCT, len(self.success))
296
      for iter6 in self.success:
297
        iter6.write(oprot)
298
      oprot.writeListEnd()
299
      oprot.writeFieldEnd()
300
    oprot.writeFieldStop()
301
    oprot.writeStructEnd()
302
 
303
  def validate(self):
304
    return
305
 
306
 
307
  def __repr__(self):
308
    L = ['%s=%r' % (key, value)
309
      for key, value in self.__dict__.iteritems()]
310
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
311
 
312
  def __eq__(self, other):
313
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
314
 
315
  def __ne__(self, other):
316
    return not (self == other)
15170 kshitij.so 317
 
318
class updateLatestPriceForItem_args:
319
  """
320
  Attributes:
321
   - id
322
  """
323
 
324
  thrift_spec = (
325
    None, # 0
326
    (1, TType.I64, 'id', None, None, ), # 1
327
  )
328
 
329
  def __init__(self, id=None,):
330
    self.id = id
331
 
332
  def read(self, iprot):
333
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
334
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
335
      return
336
    iprot.readStructBegin()
337
    while True:
338
      (fname, ftype, fid) = iprot.readFieldBegin()
339
      if ftype == TType.STOP:
340
        break
341
      if fid == 1:
342
        if ftype == TType.I64:
343
          self.id = iprot.readI64();
344
        else:
345
          iprot.skip(ftype)
346
      else:
347
        iprot.skip(ftype)
348
      iprot.readFieldEnd()
349
    iprot.readStructEnd()
350
 
351
  def write(self, oprot):
352
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
353
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
354
      return
355
    oprot.writeStructBegin('updateLatestPriceForItem_args')
356
    if self.id is not None:
357
      oprot.writeFieldBegin('id', TType.I64, 1)
358
      oprot.writeI64(self.id)
359
      oprot.writeFieldEnd()
360
    oprot.writeFieldStop()
361
    oprot.writeStructEnd()
362
 
363
  def validate(self):
364
    return
365
 
366
 
367
  def __repr__(self):
368
    L = ['%s=%r' % (key, value)
369
      for key, value in self.__dict__.iteritems()]
370
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
371
 
372
  def __eq__(self, other):
373
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
374
 
375
  def __ne__(self, other):
376
    return not (self == other)
19247 kshitij.so 377
 
378
class addItemsInBulk_args:
379
  """
380
  Attributes:
381
   - bulkItemsList
382
  """
383
 
384
  thrift_spec = (
385
    None, # 0
386
    (1, TType.LIST, 'bulkItemsList', (TType.STRUCT,(BulkItems, BulkItems.thrift_spec)), None, ), # 1
387
  )
388
 
389
  def __init__(self, bulkItemsList=None,):
390
    self.bulkItemsList = bulkItemsList
391
 
392
  def read(self, iprot):
393
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
394
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
395
      return
396
    iprot.readStructBegin()
397
    while True:
398
      (fname, ftype, fid) = iprot.readFieldBegin()
399
      if ftype == TType.STOP:
400
        break
401
      if fid == 1:
402
        if ftype == TType.LIST:
403
          self.bulkItemsList = []
404
          (_etype10, _size7) = iprot.readListBegin()
405
          for _i11 in xrange(_size7):
406
            _elem12 = BulkItems()
407
            _elem12.read(iprot)
408
            self.bulkItemsList.append(_elem12)
409
          iprot.readListEnd()
410
        else:
411
          iprot.skip(ftype)
412
      else:
413
        iprot.skip(ftype)
414
      iprot.readFieldEnd()
415
    iprot.readStructEnd()
416
 
417
  def write(self, oprot):
418
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
419
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
420
      return
421
    oprot.writeStructBegin('addItemsInBulk_args')
422
    if self.bulkItemsList is not None:
423
      oprot.writeFieldBegin('bulkItemsList', TType.LIST, 1)
424
      oprot.writeListBegin(TType.STRUCT, len(self.bulkItemsList))
425
      for iter13 in self.bulkItemsList:
426
        iter13.write(oprot)
427
      oprot.writeListEnd()
428
      oprot.writeFieldEnd()
429
    oprot.writeFieldStop()
430
    oprot.writeStructEnd()
431
 
432
  def validate(self):
433
    return
434
 
435
 
436
  def __repr__(self):
437
    L = ['%s=%r' % (key, value)
438
      for key, value in self.__dict__.iteritems()]
439
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
440
 
441
  def __eq__(self, other):
442
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
443
 
444
  def __ne__(self, other):
445
    return not (self == other)
446
 
447
class addItemsInBulk_result:
448
  """
449
  Attributes:
450
   - success
451
  """
452
 
453
  thrift_spec = (
454
    (0, TType.LIST, 'success', (TType.STRING,None), None, ), # 0
455
  )
456
 
457
  def __init__(self, success=None,):
458
    self.success = success
459
 
460
  def read(self, iprot):
461
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
462
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
463
      return
464
    iprot.readStructBegin()
465
    while True:
466
      (fname, ftype, fid) = iprot.readFieldBegin()
467
      if ftype == TType.STOP:
468
        break
469
      if fid == 0:
470
        if ftype == TType.LIST:
471
          self.success = []
472
          (_etype17, _size14) = iprot.readListBegin()
473
          for _i18 in xrange(_size14):
474
            _elem19 = iprot.readString();
475
            self.success.append(_elem19)
476
          iprot.readListEnd()
477
        else:
478
          iprot.skip(ftype)
479
      else:
480
        iprot.skip(ftype)
481
      iprot.readFieldEnd()
482
    iprot.readStructEnd()
483
 
484
  def write(self, oprot):
485
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
486
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
487
      return
488
    oprot.writeStructBegin('addItemsInBulk_result')
489
    if self.success is not None:
490
      oprot.writeFieldBegin('success', TType.LIST, 0)
491
      oprot.writeListBegin(TType.STRING, len(self.success))
492
      for iter20 in self.success:
493
        oprot.writeString(iter20)
494
      oprot.writeListEnd()
495
      oprot.writeFieldEnd()
496
    oprot.writeFieldStop()
497
    oprot.writeStructEnd()
498
 
499
  def validate(self):
500
    return
501
 
502
 
503
  def __repr__(self):
504
    L = ['%s=%r' % (key, value)
505
      for key, value in self.__dict__.iteritems()]
506
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
507
 
508
  def __eq__(self, other):
509
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
510
 
511
  def __ne__(self, other):
512
    return not (self == other)