| 94 |
ashish |
1 |
#!/usr/bin/env python
|
|
|
2 |
#
|
|
|
3 |
# Autogenerated by Thrift
|
|
|
4 |
#
|
|
|
5 |
# DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
|
|
|
6 |
#
|
|
|
7 |
|
|
|
8 |
import sys
|
|
|
9 |
import pprint
|
|
|
10 |
from urlparse import urlparse
|
|
|
11 |
from thrift.transport import TTransport
|
|
|
12 |
from thrift.transport import TSocket
|
|
|
13 |
from thrift.transport import THttpClient
|
|
|
14 |
from thrift.protocol import TBinaryProtocol
|
|
|
15 |
|
|
|
16 |
import UserContextService
|
|
|
17 |
from ttypes import *
|
|
|
18 |
|
|
|
19 |
if len(sys.argv) <= 1 or sys.argv[1] == '--help':
|
|
|
20 |
print ''
|
|
|
21 |
print 'Usage: ' + sys.argv[0] + ' [-h host:port] [-u url] [-f[ramed]] function [arg1 [arg2...]]'
|
|
|
22 |
print ''
|
|
|
23 |
print 'Functions:'
|
| 765 |
rajveer |
24 |
print ' void closeSession()'
|
| 559 |
chandransh |
25 |
print ' User createAnonymousUser(string jsessionId)'
|
|
|
26 |
print ' User getUserById(i64 userId)'
|
|
|
27 |
print ' User createUser(User user)'
|
|
|
28 |
print ' User updateUser(User user)'
|
|
|
29 |
print ' bool deleteUser(i64 userId)'
|
|
|
30 |
print ' UserState getUserState(i64 userId)'
|
|
|
31 |
print ' User authenticateUser(string email, string password)'
|
| 94 |
ashish |
32 |
print ' bool userExists(string email)'
|
| 567 |
rajveer |
33 |
print ' i64 addAddressForUser(i64 userId, Address address, bool setDefault)'
|
| 94 |
ashish |
34 |
print ' bool removeAddressForUser(i64 userid, i64 addressId)'
|
|
|
35 |
print ' bool setUserAsLoggedIn(i64 userId, i64 timestamp)'
|
|
|
36 |
print ' bool setUserAsLoggedOut(i64 userid, i64 timestamp)'
|
| 504 |
rajveer |
37 |
print ' bool setDefaultAddress(i64 userid, i64 addressId)'
|
| 594 |
rajveer |
38 |
print ' bool updatePassword(i64 userid, string oldPassword, string newPassword)'
|
| 884 |
rajveer |
39 |
print ' bool forgotPassword(string email, string newPassword)'
|
| 594 |
rajveer |
40 |
print ' getAllAddressesForUser(i64 userId)'
|
|
|
41 |
print ' i64 getDefaultAddressId(i64 userId)'
|
| 785 |
rajveer |
42 |
print ' string getDefaultPincode(i64 userId)'
|
| 1274 |
varun.gupt |
43 |
print ' bool saveUserCommunication(i64 userId, string replyTo, i64 communicationType, i64 orderId, string airwaybillNo, string productName, string subject, string message)'
|
| 559 |
chandransh |
44 |
print ' i64 createCart(i64 userId)'
|
|
|
45 |
print ' Cart getCurrentCart(i64 userId)'
|
|
|
46 |
print ' Cart getCart(i64 cartId)'
|
|
|
47 |
print ' getCartsForUser(i64 userId, CartStatus status)'
|
|
|
48 |
print ' getCartsByStatus(CartStatus status)'
|
|
|
49 |
print ' getCartsByTime(i64 from_time, i64 to_time, CartStatus status)'
|
|
|
50 |
print ' void changeCartStatus(i64 cartId, CartStatus status)'
|
|
|
51 |
print ' void addItemToCart(i64 cartId, i64 itemId, i64 quantity)'
|
|
|
52 |
print ' void deleteItemFromCart(i64 cartId, i64 itemId)'
|
|
|
53 |
print ' void changeQuantity(i64 cartId, i64 itemId, i64 quantity)'
|
|
|
54 |
print ' void changeItemStatus(i64 cartId, i64 itemId, LineStatus status)'
|
|
|
55 |
print ' void addAddressToCart(i64 cartId, i64 addressId)'
|
| 690 |
chandransh |
56 |
print ' i64 createOrders(i64 cartId)'
|
| 559 |
chandransh |
57 |
print ' bool validateCart(i64 cartId)'
|
|
|
58 |
print ' void mergeCart(i64 fromCartId, i64 toCartId)'
|
| 690 |
chandransh |
59 |
print ' bool checkOut(i64 cartId)'
|
|
|
60 |
print ' bool resetCart(i64 cartId, items)'
|
| 772 |
rajveer |
61 |
print ' Widget getMyResearch(i64 userId)'
|
|
|
62 |
print ' bool updateMyResearch(i64 userId, i64 itemId)'
|
|
|
63 |
print ' void deleteItemFromMyResearch(i64 userId, i64 itemId)'
|
|
|
64 |
print ' void updateBrowseHistory(i64 userId, i64 itemId)'
|
|
|
65 |
print ' Widget getBrowseHistory(i64 userId)'
|
|
|
66 |
print ' void mergeBrowseHistory(i64 fromUserId, i64 toUserId)'
|
| 94 |
ashish |
67 |
print ''
|
|
|
68 |
sys.exit(0)
|
|
|
69 |
|
|
|
70 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
71 |
host = 'localhost'
|
|
|
72 |
port = 9090
|
|
|
73 |
uri = ''
|
|
|
74 |
framed = False
|
|
|
75 |
http = False
|
|
|
76 |
argi = 1
|
|
|
77 |
|
|
|
78 |
if sys.argv[argi] == '-h':
|
|
|
79 |
parts = sys.argv[argi+1].split(':')
|
|
|
80 |
host = parts[0]
|
|
|
81 |
port = int(parts[1])
|
|
|
82 |
argi += 2
|
|
|
83 |
|
|
|
84 |
if sys.argv[argi] == '-u':
|
|
|
85 |
url = urlparse(sys.argv[argi+1])
|
|
|
86 |
parts = url[1].split(':')
|
|
|
87 |
host = parts[0]
|
|
|
88 |
if len(parts) > 1:
|
|
|
89 |
port = int(parts[1])
|
|
|
90 |
else:
|
|
|
91 |
port = 80
|
|
|
92 |
uri = url[2]
|
|
|
93 |
http = True
|
|
|
94 |
argi += 2
|
|
|
95 |
|
|
|
96 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
97 |
framed = True
|
|
|
98 |
argi += 1
|
|
|
99 |
|
|
|
100 |
cmd = sys.argv[argi]
|
|
|
101 |
args = sys.argv[argi+1:]
|
|
|
102 |
|
|
|
103 |
if http:
|
|
|
104 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
105 |
else:
|
|
|
106 |
socket = TSocket.TSocket(host, port)
|
|
|
107 |
if framed:
|
|
|
108 |
transport = TTransport.TFramedTransport(socket)
|
|
|
109 |
else:
|
|
|
110 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
111 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
112 |
client = UserContextService.Client(protocol)
|
|
|
113 |
transport.open()
|
|
|
114 |
|
| 765 |
rajveer |
115 |
if cmd == 'closeSession':
|
|
|
116 |
if len(args) != 0:
|
|
|
117 |
print 'closeSession requires 0 args'
|
|
|
118 |
sys.exit(1)
|
|
|
119 |
pp.pprint(client.closeSession())
|
|
|
120 |
|
|
|
121 |
elif cmd == 'createAnonymousUser':
|
| 559 |
chandransh |
122 |
if len(args) != 1:
|
|
|
123 |
print 'createAnonymousUser requires 1 args'
|
| 94 |
ashish |
124 |
sys.exit(1)
|
| 559 |
chandransh |
125 |
pp.pprint(client.createAnonymousUser(args[0],))
|
| 94 |
ashish |
126 |
|
| 559 |
chandransh |
127 |
elif cmd == 'getUserById':
|
|
|
128 |
if len(args) != 1:
|
|
|
129 |
print 'getUserById requires 1 args'
|
| 94 |
ashish |
130 |
sys.exit(1)
|
| 559 |
chandransh |
131 |
pp.pprint(client.getUserById(eval(args[0]),))
|
| 94 |
ashish |
132 |
|
| 559 |
chandransh |
133 |
elif cmd == 'createUser':
|
|
|
134 |
if len(args) != 1:
|
|
|
135 |
print 'createUser requires 1 args'
|
| 94 |
ashish |
136 |
sys.exit(1)
|
| 559 |
chandransh |
137 |
pp.pprint(client.createUser(eval(args[0]),))
|
| 94 |
ashish |
138 |
|
| 559 |
chandransh |
139 |
elif cmd == 'updateUser':
|
|
|
140 |
if len(args) != 1:
|
|
|
141 |
print 'updateUser requires 1 args'
|
| 94 |
ashish |
142 |
sys.exit(1)
|
| 559 |
chandransh |
143 |
pp.pprint(client.updateUser(eval(args[0]),))
|
| 94 |
ashish |
144 |
|
| 559 |
chandransh |
145 |
elif cmd == 'deleteUser':
|
|
|
146 |
if len(args) != 1:
|
|
|
147 |
print 'deleteUser requires 1 args'
|
| 94 |
ashish |
148 |
sys.exit(1)
|
| 559 |
chandransh |
149 |
pp.pprint(client.deleteUser(eval(args[0]),))
|
| 94 |
ashish |
150 |
|
| 559 |
chandransh |
151 |
elif cmd == 'getUserState':
|
|
|
152 |
if len(args) != 1:
|
|
|
153 |
print 'getUserState requires 1 args'
|
| 94 |
ashish |
154 |
sys.exit(1)
|
| 559 |
chandransh |
155 |
pp.pprint(client.getUserState(eval(args[0]),))
|
| 94 |
ashish |
156 |
|
| 559 |
chandransh |
157 |
elif cmd == 'authenticateUser':
|
| 94 |
ashish |
158 |
if len(args) != 2:
|
| 559 |
chandransh |
159 |
print 'authenticateUser requires 2 args'
|
| 94 |
ashish |
160 |
sys.exit(1)
|
| 559 |
chandransh |
161 |
pp.pprint(client.authenticateUser(args[0],args[1],))
|
| 94 |
ashish |
162 |
|
|
|
163 |
elif cmd == 'userExists':
|
|
|
164 |
if len(args) != 1:
|
|
|
165 |
print 'userExists requires 1 args'
|
|
|
166 |
sys.exit(1)
|
|
|
167 |
pp.pprint(client.userExists(args[0],))
|
|
|
168 |
|
|
|
169 |
elif cmd == 'addAddressForUser':
|
| 567 |
rajveer |
170 |
if len(args) != 3:
|
|
|
171 |
print 'addAddressForUser requires 3 args'
|
| 94 |
ashish |
172 |
sys.exit(1)
|
| 567 |
rajveer |
173 |
pp.pprint(client.addAddressForUser(eval(args[0]),eval(args[1]),eval(args[2]),))
|
| 94 |
ashish |
174 |
|
|
|
175 |
elif cmd == 'removeAddressForUser':
|
|
|
176 |
if len(args) != 2:
|
|
|
177 |
print 'removeAddressForUser requires 2 args'
|
|
|
178 |
sys.exit(1)
|
|
|
179 |
pp.pprint(client.removeAddressForUser(eval(args[0]),eval(args[1]),))
|
|
|
180 |
|
|
|
181 |
elif cmd == 'setUserAsLoggedIn':
|
|
|
182 |
if len(args) != 2:
|
|
|
183 |
print 'setUserAsLoggedIn requires 2 args'
|
|
|
184 |
sys.exit(1)
|
|
|
185 |
pp.pprint(client.setUserAsLoggedIn(eval(args[0]),eval(args[1]),))
|
|
|
186 |
|
|
|
187 |
elif cmd == 'setUserAsLoggedOut':
|
|
|
188 |
if len(args) != 2:
|
|
|
189 |
print 'setUserAsLoggedOut requires 2 args'
|
|
|
190 |
sys.exit(1)
|
|
|
191 |
pp.pprint(client.setUserAsLoggedOut(eval(args[0]),eval(args[1]),))
|
|
|
192 |
|
| 504 |
rajveer |
193 |
elif cmd == 'setDefaultAddress':
|
|
|
194 |
if len(args) != 2:
|
|
|
195 |
print 'setDefaultAddress requires 2 args'
|
|
|
196 |
sys.exit(1)
|
|
|
197 |
pp.pprint(client.setDefaultAddress(eval(args[0]),eval(args[1]),))
|
|
|
198 |
|
| 94 |
ashish |
199 |
elif cmd == 'updatePassword':
|
| 594 |
rajveer |
200 |
if len(args) != 3:
|
|
|
201 |
print 'updatePassword requires 3 args'
|
| 94 |
ashish |
202 |
sys.exit(1)
|
| 594 |
rajveer |
203 |
pp.pprint(client.updatePassword(eval(args[0]),args[1],args[2],))
|
| 94 |
ashish |
204 |
|
| 581 |
rajveer |
205 |
elif cmd == 'forgotPassword':
|
| 884 |
rajveer |
206 |
if len(args) != 2:
|
|
|
207 |
print 'forgotPassword requires 2 args'
|
| 581 |
rajveer |
208 |
sys.exit(1)
|
| 884 |
rajveer |
209 |
pp.pprint(client.forgotPassword(args[0],args[1],))
|
| 581 |
rajveer |
210 |
|
| 594 |
rajveer |
211 |
elif cmd == 'getAllAddressesForUser':
|
|
|
212 |
if len(args) != 1:
|
|
|
213 |
print 'getAllAddressesForUser requires 1 args'
|
|
|
214 |
sys.exit(1)
|
|
|
215 |
pp.pprint(client.getAllAddressesForUser(eval(args[0]),))
|
|
|
216 |
|
|
|
217 |
elif cmd == 'getDefaultAddressId':
|
|
|
218 |
if len(args) != 1:
|
|
|
219 |
print 'getDefaultAddressId requires 1 args'
|
|
|
220 |
sys.exit(1)
|
|
|
221 |
pp.pprint(client.getDefaultAddressId(eval(args[0]),))
|
|
|
222 |
|
| 785 |
rajveer |
223 |
elif cmd == 'getDefaultPincode':
|
|
|
224 |
if len(args) != 1:
|
|
|
225 |
print 'getDefaultPincode requires 1 args'
|
|
|
226 |
sys.exit(1)
|
|
|
227 |
pp.pprint(client.getDefaultPincode(eval(args[0]),))
|
|
|
228 |
|
| 1274 |
varun.gupt |
229 |
elif cmd == 'saveUserCommunication':
|
|
|
230 |
if len(args) != 8:
|
|
|
231 |
print 'saveUserCommunication requires 8 args'
|
|
|
232 |
sys.exit(1)
|
|
|
233 |
pp.pprint(client.saveUserCommunication(eval(args[0]),args[1],eval(args[2]),eval(args[3]),args[4],args[5],args[6],args[7],))
|
|
|
234 |
|
| 559 |
chandransh |
235 |
elif cmd == 'createCart':
|
|
|
236 |
if len(args) != 1:
|
|
|
237 |
print 'createCart requires 1 args'
|
|
|
238 |
sys.exit(1)
|
|
|
239 |
pp.pprint(client.createCart(eval(args[0]),))
|
|
|
240 |
|
|
|
241 |
elif cmd == 'getCurrentCart':
|
|
|
242 |
if len(args) != 1:
|
|
|
243 |
print 'getCurrentCart requires 1 args'
|
|
|
244 |
sys.exit(1)
|
|
|
245 |
pp.pprint(client.getCurrentCart(eval(args[0]),))
|
|
|
246 |
|
|
|
247 |
elif cmd == 'getCart':
|
|
|
248 |
if len(args) != 1:
|
|
|
249 |
print 'getCart requires 1 args'
|
|
|
250 |
sys.exit(1)
|
|
|
251 |
pp.pprint(client.getCart(eval(args[0]),))
|
|
|
252 |
|
|
|
253 |
elif cmd == 'getCartsForUser':
|
| 122 |
ashish |
254 |
if len(args) != 2:
|
| 559 |
chandransh |
255 |
print 'getCartsForUser requires 2 args'
|
| 94 |
ashish |
256 |
sys.exit(1)
|
| 559 |
chandransh |
257 |
pp.pprint(client.getCartsForUser(eval(args[0]),eval(args[1]),))
|
| 94 |
ashish |
258 |
|
| 559 |
chandransh |
259 |
elif cmd == 'getCartsByStatus':
|
| 94 |
ashish |
260 |
if len(args) != 1:
|
| 559 |
chandransh |
261 |
print 'getCartsByStatus requires 1 args'
|
| 94 |
ashish |
262 |
sys.exit(1)
|
| 559 |
chandransh |
263 |
pp.pprint(client.getCartsByStatus(eval(args[0]),))
|
| 94 |
ashish |
264 |
|
| 559 |
chandransh |
265 |
elif cmd == 'getCartsByTime':
|
|
|
266 |
if len(args) != 3:
|
|
|
267 |
print 'getCartsByTime requires 3 args'
|
|
|
268 |
sys.exit(1)
|
|
|
269 |
pp.pprint(client.getCartsByTime(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
270 |
|
|
|
271 |
elif cmd == 'changeCartStatus':
|
|
|
272 |
if len(args) != 2:
|
|
|
273 |
print 'changeCartStatus requires 2 args'
|
|
|
274 |
sys.exit(1)
|
|
|
275 |
pp.pprint(client.changeCartStatus(eval(args[0]),eval(args[1]),))
|
|
|
276 |
|
|
|
277 |
elif cmd == 'addItemToCart':
|
|
|
278 |
if len(args) != 3:
|
|
|
279 |
print 'addItemToCart requires 3 args'
|
|
|
280 |
sys.exit(1)
|
|
|
281 |
pp.pprint(client.addItemToCart(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
282 |
|
|
|
283 |
elif cmd == 'deleteItemFromCart':
|
|
|
284 |
if len(args) != 2:
|
|
|
285 |
print 'deleteItemFromCart requires 2 args'
|
|
|
286 |
sys.exit(1)
|
|
|
287 |
pp.pprint(client.deleteItemFromCart(eval(args[0]),eval(args[1]),))
|
|
|
288 |
|
|
|
289 |
elif cmd == 'changeQuantity':
|
|
|
290 |
if len(args) != 3:
|
|
|
291 |
print 'changeQuantity requires 3 args'
|
|
|
292 |
sys.exit(1)
|
|
|
293 |
pp.pprint(client.changeQuantity(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
294 |
|
|
|
295 |
elif cmd == 'changeItemStatus':
|
|
|
296 |
if len(args) != 3:
|
|
|
297 |
print 'changeItemStatus requires 3 args'
|
|
|
298 |
sys.exit(1)
|
|
|
299 |
pp.pprint(client.changeItemStatus(eval(args[0]),eval(args[1]),eval(args[2]),))
|
|
|
300 |
|
|
|
301 |
elif cmd == 'addAddressToCart':
|
|
|
302 |
if len(args) != 2:
|
|
|
303 |
print 'addAddressToCart requires 2 args'
|
|
|
304 |
sys.exit(1)
|
|
|
305 |
pp.pprint(client.addAddressToCart(eval(args[0]),eval(args[1]),))
|
|
|
306 |
|
| 690 |
chandransh |
307 |
elif cmd == 'createOrders':
|
| 94 |
ashish |
308 |
if len(args) != 1:
|
| 690 |
chandransh |
309 |
print 'createOrders requires 1 args'
|
| 94 |
ashish |
310 |
sys.exit(1)
|
| 690 |
chandransh |
311 |
pp.pprint(client.createOrders(eval(args[0]),))
|
| 94 |
ashish |
312 |
|
| 559 |
chandransh |
313 |
elif cmd == 'validateCart':
|
| 94 |
ashish |
314 |
if len(args) != 1:
|
| 559 |
chandransh |
315 |
print 'validateCart requires 1 args'
|
| 94 |
ashish |
316 |
sys.exit(1)
|
| 559 |
chandransh |
317 |
pp.pprint(client.validateCart(eval(args[0]),))
|
| 94 |
ashish |
318 |
|
| 559 |
chandransh |
319 |
elif cmd == 'mergeCart':
|
|
|
320 |
if len(args) != 2:
|
|
|
321 |
print 'mergeCart requires 2 args'
|
|
|
322 |
sys.exit(1)
|
|
|
323 |
pp.pprint(client.mergeCart(eval(args[0]),eval(args[1]),))
|
|
|
324 |
|
| 690 |
chandransh |
325 |
elif cmd == 'checkOut':
|
|
|
326 |
if len(args) != 1:
|
|
|
327 |
print 'checkOut requires 1 args'
|
|
|
328 |
sys.exit(1)
|
|
|
329 |
pp.pprint(client.checkOut(eval(args[0]),))
|
|
|
330 |
|
|
|
331 |
elif cmd == 'resetCart':
|
|
|
332 |
if len(args) != 2:
|
|
|
333 |
print 'resetCart requires 2 args'
|
|
|
334 |
sys.exit(1)
|
|
|
335 |
pp.pprint(client.resetCart(eval(args[0]),eval(args[1]),))
|
|
|
336 |
|
| 559 |
chandransh |
337 |
elif cmd == 'getMyResearch':
|
| 130 |
ashish |
338 |
if len(args) != 1:
|
| 559 |
chandransh |
339 |
print 'getMyResearch requires 1 args'
|
| 130 |
ashish |
340 |
sys.exit(1)
|
| 559 |
chandransh |
341 |
pp.pprint(client.getMyResearch(eval(args[0]),))
|
| 130 |
ashish |
342 |
|
| 559 |
chandransh |
343 |
elif cmd == 'updateMyResearch':
|
| 130 |
ashish |
344 |
if len(args) != 2:
|
| 559 |
chandransh |
345 |
print 'updateMyResearch requires 2 args'
|
| 130 |
ashish |
346 |
sys.exit(1)
|
| 559 |
chandransh |
347 |
pp.pprint(client.updateMyResearch(eval(args[0]),eval(args[1]),))
|
| 130 |
ashish |
348 |
|
| 559 |
chandransh |
349 |
elif cmd == 'deleteItemFromMyResearch':
|
|
|
350 |
if len(args) != 2:
|
|
|
351 |
print 'deleteItemFromMyResearch requires 2 args'
|
|
|
352 |
sys.exit(1)
|
|
|
353 |
pp.pprint(client.deleteItemFromMyResearch(eval(args[0]),eval(args[1]),))
|
|
|
354 |
|
| 772 |
rajveer |
355 |
elif cmd == 'updateBrowseHistory':
|
| 559 |
chandransh |
356 |
if len(args) != 2:
|
| 772 |
rajveer |
357 |
print 'updateBrowseHistory requires 2 args'
|
| 559 |
chandransh |
358 |
sys.exit(1)
|
| 772 |
rajveer |
359 |
pp.pprint(client.updateBrowseHistory(eval(args[0]),eval(args[1]),))
|
| 559 |
chandransh |
360 |
|
| 772 |
rajveer |
361 |
elif cmd == 'getBrowseHistory':
|
|
|
362 |
if len(args) != 1:
|
|
|
363 |
print 'getBrowseHistory requires 1 args'
|
| 559 |
chandransh |
364 |
sys.exit(1)
|
| 772 |
rajveer |
365 |
pp.pprint(client.getBrowseHistory(eval(args[0]),))
|
| 559 |
chandransh |
366 |
|
| 772 |
rajveer |
367 |
elif cmd == 'mergeBrowseHistory':
|
| 559 |
chandransh |
368 |
if len(args) != 2:
|
| 772 |
rajveer |
369 |
print 'mergeBrowseHistory requires 2 args'
|
| 559 |
chandransh |
370 |
sys.exit(1)
|
| 772 |
rajveer |
371 |
pp.pprint(client.mergeBrowseHistory(eval(args[0]),eval(args[1]),))
|
| 559 |
chandransh |
372 |
|
| 94 |
ashish |
373 |
transport.close()
|