Subversion Repositories SmartDukaan

Rev

Rev 15170 | Go to most recent revision | Details | 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
 
28
 
29
class Client(shop2020.thriftpy.generic.GenericService.Client, Iface):
30
  def __init__(self, iprot, oprot=None):
31
    shop2020.thriftpy.generic.GenericService.Client.__init__(self, iprot, oprot)
32
 
33
  def getLatestPricing(self, skuBundleId, source_id):
34
    """
35
    Parameters:
36
     - skuBundleId
37
     - source_id
38
    """
39
    self.send_getLatestPricing(skuBundleId, source_id)
40
    return self.recv_getLatestPricing()
41
 
42
  def send_getLatestPricing(self, skuBundleId, source_id):
43
    self._oprot.writeMessageBegin('getLatestPricing', TMessageType.CALL, self._seqid)
44
    args = getLatestPricing_args()
45
    args.skuBundleId = skuBundleId
46
    args.source_id = source_id
47
    args.write(self._oprot)
48
    self._oprot.writeMessageEnd()
49
    self._oprot.trans.flush()
50
 
51
  def recv_getLatestPricing(self, ):
52
    (fname, mtype, rseqid) = self._iprot.readMessageBegin()
53
    if mtype == TMessageType.EXCEPTION:
54
      x = TApplicationException()
55
      x.read(self._iprot)
56
      self._iprot.readMessageEnd()
57
      raise x
58
    result = getLatestPricing_result()
59
    result.read(self._iprot)
60
    self._iprot.readMessageEnd()
61
    if result.success is not None:
62
      return result.success
63
    raise TApplicationException(TApplicationException.MISSING_RESULT, "getLatestPricing failed: unknown result");
64
 
65
 
66
class Processor(shop2020.thriftpy.generic.GenericService.Processor, Iface, TProcessor):
67
  def __init__(self, handler):
68
    shop2020.thriftpy.generic.GenericService.Processor.__init__(self, handler)
69
    self._processMap["getLatestPricing"] = Processor.process_getLatestPricing
70
 
71
  def process(self, iprot, oprot):
72
    (name, type, seqid) = iprot.readMessageBegin()
73
    if name not in self._processMap:
74
      iprot.skip(TType.STRUCT)
75
      iprot.readMessageEnd()
76
      x = TApplicationException(TApplicationException.UNKNOWN_METHOD, 'Unknown function %s' % (name))
77
      oprot.writeMessageBegin(name, TMessageType.EXCEPTION, seqid)
78
      x.write(oprot)
79
      oprot.writeMessageEnd()
80
      oprot.trans.flush()
81
      return
82
    else:
83
      self._processMap[name](self, seqid, iprot, oprot)
84
    return True
85
 
86
  def process_getLatestPricing(self, seqid, iprot, oprot):
87
    args = getLatestPricing_args()
88
    args.read(iprot)
89
    iprot.readMessageEnd()
90
    result = getLatestPricing_result()
91
    result.success = self._handler.getLatestPricing(args.skuBundleId, args.source_id)
92
    oprot.writeMessageBegin("getLatestPricing", TMessageType.REPLY, seqid)
93
    result.write(oprot)
94
    oprot.writeMessageEnd()
95
    oprot.trans.flush()
96
 
97
 
98
# HELPER FUNCTIONS AND STRUCTURES
99
 
100
class getLatestPricing_args:
101
  """
102
  Attributes:
103
   - skuBundleId
104
   - source_id
105
  """
106
 
107
  thrift_spec = (
108
    None, # 0
109
    (1, TType.I64, 'skuBundleId', None, None, ), # 1
110
    (2, TType.I64, 'source_id', None, None, ), # 2
111
  )
112
 
113
  def __init__(self, skuBundleId=None, source_id=None,):
114
    self.skuBundleId = skuBundleId
115
    self.source_id = source_id
116
 
117
  def read(self, iprot):
118
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
119
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
120
      return
121
    iprot.readStructBegin()
122
    while True:
123
      (fname, ftype, fid) = iprot.readFieldBegin()
124
      if ftype == TType.STOP:
125
        break
126
      if fid == 1:
127
        if ftype == TType.I64:
128
          self.skuBundleId = iprot.readI64();
129
        else:
130
          iprot.skip(ftype)
131
      elif fid == 2:
132
        if ftype == TType.I64:
133
          self.source_id = iprot.readI64();
134
        else:
135
          iprot.skip(ftype)
136
      else:
137
        iprot.skip(ftype)
138
      iprot.readFieldEnd()
139
    iprot.readStructEnd()
140
 
141
  def write(self, oprot):
142
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
143
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
144
      return
145
    oprot.writeStructBegin('getLatestPricing_args')
146
    if self.skuBundleId is not None:
147
      oprot.writeFieldBegin('skuBundleId', TType.I64, 1)
148
      oprot.writeI64(self.skuBundleId)
149
      oprot.writeFieldEnd()
150
    if self.source_id is not None:
151
      oprot.writeFieldBegin('source_id', TType.I64, 2)
152
      oprot.writeI64(self.source_id)
153
      oprot.writeFieldEnd()
154
    oprot.writeFieldStop()
155
    oprot.writeStructEnd()
156
 
157
  def validate(self):
158
    return
159
 
160
 
161
  def __repr__(self):
162
    L = ['%s=%r' % (key, value)
163
      for key, value in self.__dict__.iteritems()]
164
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
165
 
166
  def __eq__(self, other):
167
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
168
 
169
  def __ne__(self, other):
170
    return not (self == other)
171
 
172
class getLatestPricing_result:
173
  """
174
  Attributes:
175
   - success
176
  """
177
 
178
  thrift_spec = (
179
    (0, TType.LIST, 'success', (TType.STRUCT,(LivePricing, LivePricing.thrift_spec)), None, ), # 0
180
  )
181
 
182
  def __init__(self, success=None,):
183
    self.success = success
184
 
185
  def read(self, iprot):
186
    if iprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and isinstance(iprot.trans, TTransport.CReadableTransport) and self.thrift_spec is not None and fastbinary is not None:
187
      fastbinary.decode_binary(self, iprot.trans, (self.__class__, self.thrift_spec))
188
      return
189
    iprot.readStructBegin()
190
    while True:
191
      (fname, ftype, fid) = iprot.readFieldBegin()
192
      if ftype == TType.STOP:
193
        break
194
      if fid == 0:
195
        if ftype == TType.LIST:
196
          self.success = []
197
          (_etype3, _size0) = iprot.readListBegin()
198
          for _i4 in xrange(_size0):
199
            _elem5 = LivePricing()
200
            _elem5.read(iprot)
201
            self.success.append(_elem5)
202
          iprot.readListEnd()
203
        else:
204
          iprot.skip(ftype)
205
      else:
206
        iprot.skip(ftype)
207
      iprot.readFieldEnd()
208
    iprot.readStructEnd()
209
 
210
  def write(self, oprot):
211
    if oprot.__class__ == TBinaryProtocol.TBinaryProtocolAccelerated and self.thrift_spec is not None and fastbinary is not None:
212
      oprot.trans.write(fastbinary.encode_binary(self, (self.__class__, self.thrift_spec)))
213
      return
214
    oprot.writeStructBegin('getLatestPricing_result')
215
    if self.success is not None:
216
      oprot.writeFieldBegin('success', TType.LIST, 0)
217
      oprot.writeListBegin(TType.STRUCT, len(self.success))
218
      for iter6 in self.success:
219
        iter6.write(oprot)
220
      oprot.writeListEnd()
221
      oprot.writeFieldEnd()
222
    oprot.writeFieldStop()
223
    oprot.writeStructEnd()
224
 
225
  def validate(self):
226
    return
227
 
228
 
229
  def __repr__(self):
230
    L = ['%s=%r' % (key, value)
231
      for key, value in self.__dict__.iteritems()]
232
    return '%s(%s)' % (self.__class__.__name__, ', '.join(L))
233
 
234
  def __eq__(self, other):
235
    return isinstance(other, self.__class__) and self.__dict__ == other.__dict__
236
 
237
  def __ne__(self, other):
238
    return not (self == other)