Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3893 chandransh 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 pushContentToProduction(self, entityId):
21
    """
3896 chandransh 22
    Push the content of the given entity to production
23
 
3893 chandransh 24
    Parameters:
25
     - entityId
26
    """
27
    pass
28
 
19686 kshitij.so 29
  def uploadContent(self, bulkUploadContentList):
30
    """
31
    Parameters:
32
     - bulkUploadContentList
33
    """
34
    pass
3893 chandransh 35
 
19686 kshitij.so 36
 
3893 chandransh 37
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
38
  def __init__(self, iprot, oprot=None):
39
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
40
 
41
  def pushContentToProduction(self, entityId):
42
    """
3896 chandransh 43
    Push the content of the given entity to production
44
 
3893 chandransh 45
    Parameters:
46
     - entityId
47
    """
48
    self.send_pushContentToProduction(entityId)
3896 chandransh 49
    return self.recv_pushContentToProduction()
3893 chandransh 50
 
51
  def send_pushContentToProduction(self, entityId):
52
    self._oprot.writeMessageBegin('pushContentToProduction', TMessageType.CALL, self._seqid)
53
    args = pushContentToProduction_args()
54
    args.entityId = entityId
55
    args.write(self._oprot)
56
    self._oprot.writeMessageEnd()
57
    self._oprot.trans.flush()
58
 
59
  def recv_pushContentToProduction(self, ):
60
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
61
    if mtype == TMessageType.EXCEPTION:
62
      x = TApplicationException()
63
      x.read(self._iprot)
64
      self._iprot.readMessageEnd()
65
      raise x
66
    result = pushContentToProduction_result()
67
    result.read(self._iprot)
68
    self._iprot.readMessageEnd()
3896 chandransh 69
    if result.success is not None:
70
      return result.success
71
    if result.cse is not None:
72
      raise result.cse
73
    raise TApplicationException(TApplicationException.MISSING_RESULT, "pushContentToProduction failed: unknown result");
3893 chandransh 74
 
19686 kshitij.so 75
  def uploadContent(self, bulkUploadContentList):
76
    """
77
    Parameters:
78
     - bulkUploadContentList
79
    """
80
    self.send_uploadContent(bulkUploadContentList)
81
    return self.recv_uploadContent()
3893 chandransh 82
 
19686 kshitij.so 83
  def send_uploadContent(self, bulkUploadContentList):
84
    self._oprot.writeMessageBegin('uploadContent', TMessageType.CALL, self._seqid)
85
    args = uploadContent_args()
86
    args.bulkUploadContentList = bulkUploadContentList
87
    args.write(self._oprot)
88
    self._oprot.writeMessageEnd()
89
    self._oprot.trans.flush()
90
 
91
  def recv_uploadContent(self, ):
92
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
93
    if mtype == TMessageType.EXCEPTION:
94
      x = TApplicationException()
95
      x.read(self._iprot)
96
      self._iprot.readMessageEnd()
97
      raise x
98
    result = uploadContent_result()
99
    result.read(self._iprot)
100
    self._iprot.readMessageEnd()
101
    if result.success is not None:
102
      return result.success
103
    raise TApplicationException(TApplicationException.MISSING_RESULT, "uploadContent failed: unknown result");
104
 
105
 
3893 chandransh 106
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
107
  def __init__(self, handler):
108
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
109
    self._processMap["pushContentToProduction"] = Processor.process_pushContentToProduction
19686 kshitij.so 110
    self._processMap["uploadContent"] = Processor.process_uploadContent
3893 chandransh 111
 
112
  def process(self, iprot, oprot):
113
    (name, type, seqid) = iprot.readMessageBegin()
114
    if name not in self._processMap:
115
      iprot.skip(TType.STRUCT)
116
      iprot.readMessageEnd()
117
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
118
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
119
      x.write(oprot)
120
      oprot.writeMessageEnd()
121
      oprot.trans.flush()
122
      return
123
    else:
124
      self._processMap[name](self, seqid, iprot, oprot)
125
    return True
126
 
127
  def process_pushContentToProduction(self, seqid, iprot, oprot):
128
    args = pushContentToProduction_args()
129
    args.read(iprot)
130
    iprot.readMessageEnd()
131
    result = pushContentToProduction_result()
3896 chandransh 132
    try:
133
      result.success = self._handler.pushContentToProduction(args.entityId)
134
    except ContentServiceException, cse:
135
      result.cse = cse
3893 chandransh 136
    oprot.writeMessageBegin("pushContentToProduction", TMessageType.REPLY, seqid)
137
    result.write(oprot)
138
    oprot.writeMessageEnd()
139
    oprot.trans.flush()
140
 
19686 kshitij.so 141
  def process_uploadContent(self, seqid, iprot, oprot):
142
    args = uploadContent_args()
143
    args.read(iprot)
144
    iprot.readMessageEnd()
145
    result = uploadContent_result()
146
    result.success = self._handler.uploadContent(args.bulkUploadContentList)
147
    oprot.writeMessageBegin("uploadContent", TMessageType.REPLY, seqid)
148
    result.write(oprot)
149
    oprot.writeMessageEnd()
150
    oprot.trans.flush()
3893 chandransh 151
 
19686 kshitij.so 152
 
3893 chandransh 153
# HELPER FUNCTIONS AND STRUCTURES
154
 
155
class pushContentToProduction_args:
156
  """
157
  Attributes:
158
   - entityId
159
  """
160
 
161
  thrift_spec = (
162
    None, # 0
163
    (1, TType.I64, 'entityId', None, None, ), # 1
164
  )
165
 
166
  def __init__(self, entityId=None,):
167
    self.entityId = entityId
168
 
169
  def read(self, iprot):
170
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
171
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
172
      return
173
    iprot.readStructBegin()
174
    while True:
175
      (fname, ftype, fid) = iprot.readFieldBegin()
176
      if ftype == TType.STOP:
177
        break
178
      if fid == 1:
179
        if ftype == TType.I64:
180
          self.entityId = iprot.readI64();
181
        else:
182
          iprot.skip(ftype)
183
      else:
184
        iprot.skip(ftype)
185
      iprot.readFieldEnd()
186
    iprot.readStructEnd()
187
 
188
  def write(self, oprot):
189
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
190
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
191
      return
192
    oprot.writeStructBegin('pushContentToProduction_args')
193
    if self.entityId is not None:
194
      oprot.writeFieldBegin('entityId', TType.I64, 1)
195
      oprot.writeI64(self.entityId)
196
      oprot.writeFieldEnd()
197
    oprot.writeFieldStop()
198
    oprot.writeStructEnd()
199
 
200
  def validate(self):
201
    return
202
 
203
 
204
  def __repr__(self):
205
    L = ['%s=%r' % (key, value)
206
      for key, value in self.__dict__.iteritems()]
207
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
208
 
209
  def __eq__(self, other):
210
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
211
 
212
  def __ne__(self, other):
213
    return not (self == other)
214
 
215
class pushContentToProduction_result:
3896 chandransh 216
  """
217
  Attributes:
218
   - success
219
   - cse
220
  """
3893 chandransh 221
 
222
  thrift_spec = (
3896 chandransh 223
    (0, TType.BOOL, 'success', None, None, ), # 0
224
    (1, TType.STRUCT, 'cse', (ContentServiceException, ContentServiceException.thrift_spec), None, ), # 1
3893 chandransh 225
  )
226
 
3896 chandransh 227
  def __init__(self, success=None, cse=None,):
228
    self.success = success
229
    self.cse = cse
230
 
3893 chandransh 231
  def read(self, iprot):
232
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
233
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
234
      return
235
    iprot.readStructBegin()
236
    while True:
237
      (fname, ftype, fid) = iprot.readFieldBegin()
238
      if ftype == TType.STOP:
239
        break
3896 chandransh 240
      if fid == 0:
241
        if ftype == TType.BOOL:
242
          self.success = iprot.readBool();
243
        else:
244
          iprot.skip(ftype)
245
      elif fid == 1:
246
        if ftype == TType.STRUCT:
247
          self.cse = ContentServiceException()
248
          self.cse.read(iprot)
249
        else:
250
          iprot.skip(ftype)
3893 chandransh 251
      else:
252
        iprot.skip(ftype)
253
      iprot.readFieldEnd()
254
    iprot.readStructEnd()
255
 
256
  def write(self, oprot):
257
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
258
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
259
      return
260
    oprot.writeStructBegin('pushContentToProduction_result')
3896 chandransh 261
    if self.success is not None:
262
      oprot.writeFieldBegin('success', TType.BOOL, 0)
263
      oprot.writeBool(self.success)
264
      oprot.writeFieldEnd()
265
    if self.cse is not None:
266
      oprot.writeFieldBegin('cse', TType.STRUCT, 1)
267
      self.cse.write(oprot)
268
      oprot.writeFieldEnd()
3893 chandransh 269
    oprot.writeFieldStop()
270
    oprot.writeStructEnd()
271
 
272
  def validate(self):
273
    return
274
 
275
 
276
  def __repr__(self):
277
    L = ['%s=%r' % (key, value)
278
      for key, value in self.__dict__.iteritems()]
279
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
280
 
281
  def __eq__(self, other):
282
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
283
 
284
  def __ne__(self, other):
285
    return not (self == other)
19686 kshitij.so 286
 
287
class uploadContent_args:
288
  """
289
  Attributes:
290
   - bulkUploadContentList
291
  """
292
 
293
  thrift_spec = (
294
    None, # 0
295
    (1, TType.LIST, 'bulkUploadContentList', (TType.STRUCT,(BulkContentUpload, BulkContentUpload.thrift_spec)), None, ), # 1
296
  )
297
 
298
  def __init__(self, bulkUploadContentList=None,):
299
    self.bulkUploadContentList = bulkUploadContentList
300
 
301
  def read(self, iprot):
302
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
303
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
304
      return
305
    iprot.readStructBegin()
306
    while True:
307
      (fname, ftype, fid) = iprot.readFieldBegin()
308
      if ftype == TType.STOP:
309
        break
310
      if fid == 1:
311
        if ftype == TType.LIST:
312
          self.bulkUploadContentList = []
313
          (_etype3, _size0) = iprot.readListBegin()
314
          for _i4 in xrange(_size0):
315
            _elem5 = BulkContentUpload()
316
            _elem5.read(iprot)
317
            self.bulkUploadContentList.append(_elem5)
318
          iprot.readListEnd()
319
        else:
320
          iprot.skip(ftype)
321
      else:
322
        iprot.skip(ftype)
323
      iprot.readFieldEnd()
324
    iprot.readStructEnd()
325
 
326
  def write(self, oprot):
327
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
328
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
329
      return
330
    oprot.writeStructBegin('uploadContent_args')
331
    if self.bulkUploadContentList is not None:
332
      oprot.writeFieldBegin('bulkUploadContentList', TType.LIST, 1)
333
      oprot.writeListBegin(TType.STRUCT, len(self.bulkUploadContentList))
334
      for iter6 in self.bulkUploadContentList:
335
        iter6.write(oprot)
336
      oprot.writeListEnd()
337
      oprot.writeFieldEnd()
338
    oprot.writeFieldStop()
339
    oprot.writeStructEnd()
340
 
341
  def validate(self):
342
    return
343
 
344
 
345
  def __repr__(self):
346
    L = ['%s=%r' % (key, value)
347
      for key, value in self.__dict__.iteritems()]
348
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
349
 
350
  def __eq__(self, other):
351
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
352
 
353
  def __ne__(self, other):
354
    return not (self == other)
355
 
356
class uploadContent_result:
357
  """
358
  Attributes:
359
   - success
360
  """
361
 
362
  thrift_spec = (
363
    (0, TType.LIST, 'success', (TType.STRUCT,(BulkContentUploadResult, BulkContentUploadResult.thrift_spec)), None, ), # 0
364
  )
365
 
366
  def __init__(self, success=None,):
367
    self.success = success
368
 
369
  def read(self, iprot):
370
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
371
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
372
      return
373
    iprot.readStructBegin()
374
    while True:
375
      (fname, ftype, fid) = iprot.readFieldBegin()
376
      if ftype == TType.STOP:
377
        break
378
      if fid == 0:
379
        if ftype == TType.LIST:
380
          self.success = []
381
          (_etype10, _size7) = iprot.readListBegin()
382
          for _i11 in xrange(_size7):
383
            _elem12 = BulkContentUploadResult()
384
            _elem12.read(iprot)
385
            self.success.append(_elem12)
386
          iprot.readListEnd()
387
        else:
388
          iprot.skip(ftype)
389
      else:
390
        iprot.skip(ftype)
391
      iprot.readFieldEnd()
392
    iprot.readStructEnd()
393
 
394
  def write(self, oprot):
395
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
396
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
397
      return
398
    oprot.writeStructBegin('uploadContent_result')
399
    if self.success is not None:
400
      oprot.writeFieldBegin('success', TType.LIST, 0)
401
      oprot.writeListBegin(TType.STRUCT, len(self.success))
402
      for iter13 in self.success:
403
        iter13.write(oprot)
404
      oprot.writeListEnd()
405
      oprot.writeFieldEnd()
406
    oprot.writeFieldStop()
407
    oprot.writeStructEnd()
408
 
409
  def validate(self):
410
    return
411
 
412
 
413
  def __repr__(self):
414
    L = ['%s=%r' % (key, value)
415
      for key, value in self.__dict__.iteritems()]
416
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
417
 
418
  def __eq__(self, other):
419
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
420
 
421
  def __ne__(self, other):
422
    return not (self == other)