| 349 |
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 HelperService
|
|
|
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:'
|
| 3206 |
mandeep.dh |
24 |
print ' i64 saveUserEmailForSending(string emailTo, string emailFrom, string subject, string body, string source, string emailType)'
|
| 3086 |
rajveer |
25 |
print ' getEmailsToBeSent()'
|
| 1422 |
varun.gupt |
26 |
print ' void markEmailAsSent(i64 emailId)'
|
| 349 |
ashish |
27 |
print ' void sendMail(Mail mail)'
|
|
|
28 |
print ' void sendText(TextMessage message)'
|
|
|
29 |
print ' void addMessage(Message message)'
|
|
|
30 |
print ' void updateMessage(i64 id, string message)'
|
| 353 |
ashish |
31 |
print ' Message getMessage(i64 id)'
|
|
|
32 |
print ' Message getSubstitutedMessage(i64 id, params)'
|
| 494 |
rajveer |
33 |
print ' bool addUser(string username, string password, i64 warehouseId)'
|
|
|
34 |
print ' bool deleteUser(string username)'
|
| 2447 |
chandransh |
35 |
print ' DashboardUser authenticateDashboardUser(string username, string password)'
|
| 494 |
rajveer |
36 |
print ' bool updatePassword(string username, string oldPassword, string newPassword)'
|
| 759 |
chandransh |
37 |
print ' LogisticsUser authenticateLogisticsUser(string username, string password)'
|
| 1610 |
ankur.sing |
38 |
print ' StatisticsUser authenticateStatisticsUser(string username, string password)'
|
| 1891 |
ankur.sing |
39 |
print ' ReportUser authenticateReportUser(string username, string password)'
|
|
|
40 |
print ' getReports(i64 role)'
|
| 2358 |
ankur.sing |
41 |
print ' CatalogDashboardUser authenticateCatalogUser(string username, string password, i64 role)'
|
| 349 |
ashish |
42 |
print ''
|
|
|
43 |
sys.exit(0)
|
|
|
44 |
|
|
|
45 |
pp = pprint.PrettyPrinter(indent = 2)
|
|
|
46 |
host = 'localhost'
|
|
|
47 |
port = 9090
|
|
|
48 |
uri = ''
|
|
|
49 |
framed = False
|
|
|
50 |
http = False
|
|
|
51 |
argi = 1
|
|
|
52 |
|
|
|
53 |
if sys.argv[argi] == '-h':
|
|
|
54 |
parts = sys.argv[argi+1].split(':')
|
|
|
55 |
host = parts[0]
|
|
|
56 |
port = int(parts[1])
|
|
|
57 |
argi += 2
|
|
|
58 |
|
|
|
59 |
if sys.argv[argi] == '-u':
|
|
|
60 |
url = urlparse(sys.argv[argi+1])
|
|
|
61 |
parts = url[1].split(':')
|
|
|
62 |
host = parts[0]
|
|
|
63 |
if len(parts) > 1:
|
|
|
64 |
port = int(parts[1])
|
|
|
65 |
else:
|
|
|
66 |
port = 80
|
|
|
67 |
uri = url[2]
|
|
|
68 |
http = True
|
|
|
69 |
argi += 2
|
|
|
70 |
|
|
|
71 |
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
|
|
|
72 |
framed = True
|
|
|
73 |
argi += 1
|
|
|
74 |
|
|
|
75 |
cmd = sys.argv[argi]
|
|
|
76 |
args = sys.argv[argi+1:]
|
|
|
77 |
|
|
|
78 |
if http:
|
|
|
79 |
transport = THttpClient.THttpClient(host, port, uri)
|
|
|
80 |
else:
|
|
|
81 |
socket = TSocket.TSocket(host, port)
|
|
|
82 |
if framed:
|
|
|
83 |
transport = TTransport.TFramedTransport(socket)
|
|
|
84 |
else:
|
|
|
85 |
transport = TTransport.TBufferedTransport(socket)
|
|
|
86 |
protocol = TBinaryProtocol.TBinaryProtocol(transport)
|
|
|
87 |
client = HelperService.Client(protocol)
|
|
|
88 |
transport.open()
|
|
|
89 |
|
| 3376 |
rajveer |
90 |
if cmd == 'saveUserEmailForSending':
|
| 1395 |
varun.gupt |
91 |
if len(args) != 6:
|
|
|
92 |
print 'saveUserEmailForSending requires 6 args'
|
|
|
93 |
sys.exit(1)
|
|
|
94 |
pp.pprint(client.saveUserEmailForSending(args[0],args[1],args[2],args[3],args[4],args[5],))
|
|
|
95 |
|
| 1422 |
varun.gupt |
96 |
elif cmd == 'getEmailsToBeSent':
|
| 3086 |
rajveer |
97 |
if len(args) != 0:
|
|
|
98 |
print 'getEmailsToBeSent requires 0 args'
|
| 1422 |
varun.gupt |
99 |
sys.exit(1)
|
| 3086 |
rajveer |
100 |
pp.pprint(client.getEmailsToBeSent())
|
| 1422 |
varun.gupt |
101 |
|
|
|
102 |
elif cmd == 'markEmailAsSent':
|
|
|
103 |
if len(args) != 1:
|
|
|
104 |
print 'markEmailAsSent requires 1 args'
|
|
|
105 |
sys.exit(1)
|
|
|
106 |
pp.pprint(client.markEmailAsSent(eval(args[0]),))
|
|
|
107 |
|
| 765 |
rajveer |
108 |
elif cmd == 'sendMail':
|
| 349 |
ashish |
109 |
if len(args) != 1:
|
|
|
110 |
print 'sendMail requires 1 args'
|
|
|
111 |
sys.exit(1)
|
|
|
112 |
pp.pprint(client.sendMail(eval(args[0]),))
|
|
|
113 |
|
|
|
114 |
elif cmd == 'sendText':
|
|
|
115 |
if len(args) != 1:
|
|
|
116 |
print 'sendText requires 1 args'
|
|
|
117 |
sys.exit(1)
|
|
|
118 |
pp.pprint(client.sendText(eval(args[0]),))
|
|
|
119 |
|
|
|
120 |
elif cmd == 'addMessage':
|
|
|
121 |
if len(args) != 1:
|
|
|
122 |
print 'addMessage requires 1 args'
|
|
|
123 |
sys.exit(1)
|
|
|
124 |
pp.pprint(client.addMessage(eval(args[0]),))
|
|
|
125 |
|
|
|
126 |
elif cmd == 'updateMessage':
|
|
|
127 |
if len(args) != 2:
|
|
|
128 |
print 'updateMessage requires 2 args'
|
|
|
129 |
sys.exit(1)
|
|
|
130 |
pp.pprint(client.updateMessage(eval(args[0]),args[1],))
|
|
|
131 |
|
|
|
132 |
elif cmd == 'getMessage':
|
|
|
133 |
if len(args) != 1:
|
|
|
134 |
print 'getMessage requires 1 args'
|
|
|
135 |
sys.exit(1)
|
|
|
136 |
pp.pprint(client.getMessage(eval(args[0]),))
|
|
|
137 |
|
|
|
138 |
elif cmd == 'getSubstitutedMessage':
|
|
|
139 |
if len(args) != 2:
|
|
|
140 |
print 'getSubstitutedMessage requires 2 args'
|
|
|
141 |
sys.exit(1)
|
|
|
142 |
pp.pprint(client.getSubstitutedMessage(eval(args[0]),eval(args[1]),))
|
|
|
143 |
|
| 494 |
rajveer |
144 |
elif cmd == 'addUser':
|
|
|
145 |
if len(args) != 3:
|
|
|
146 |
print 'addUser requires 3 args'
|
|
|
147 |
sys.exit(1)
|
|
|
148 |
pp.pprint(client.addUser(args[0],args[1],eval(args[2]),))
|
|
|
149 |
|
|
|
150 |
elif cmd == 'deleteUser':
|
|
|
151 |
if len(args) != 1:
|
|
|
152 |
print 'deleteUser requires 1 args'
|
|
|
153 |
sys.exit(1)
|
|
|
154 |
pp.pprint(client.deleteUser(args[0],))
|
|
|
155 |
|
| 2447 |
chandransh |
156 |
elif cmd == 'authenticateDashboardUser':
|
| 494 |
rajveer |
157 |
if len(args) != 2:
|
| 2447 |
chandransh |
158 |
print 'authenticateDashboardUser requires 2 args'
|
| 494 |
rajveer |
159 |
sys.exit(1)
|
| 2447 |
chandransh |
160 |
pp.pprint(client.authenticateDashboardUser(args[0],args[1],))
|
| 494 |
rajveer |
161 |
|
|
|
162 |
elif cmd == 'updatePassword':
|
|
|
163 |
if len(args) != 3:
|
|
|
164 |
print 'updatePassword requires 3 args'
|
|
|
165 |
sys.exit(1)
|
|
|
166 |
pp.pprint(client.updatePassword(args[0],args[1],args[2],))
|
|
|
167 |
|
| 759 |
chandransh |
168 |
elif cmd == 'authenticateLogisticsUser':
|
|
|
169 |
if len(args) != 2:
|
|
|
170 |
print 'authenticateLogisticsUser requires 2 args'
|
|
|
171 |
sys.exit(1)
|
|
|
172 |
pp.pprint(client.authenticateLogisticsUser(args[0],args[1],))
|
|
|
173 |
|
| 1610 |
ankur.sing |
174 |
elif cmd == 'authenticateStatisticsUser':
|
|
|
175 |
if len(args) != 2:
|
|
|
176 |
print 'authenticateStatisticsUser requires 2 args'
|
|
|
177 |
sys.exit(1)
|
|
|
178 |
pp.pprint(client.authenticateStatisticsUser(args[0],args[1],))
|
|
|
179 |
|
| 1891 |
ankur.sing |
180 |
elif cmd == 'authenticateReportUser':
|
|
|
181 |
if len(args) != 2:
|
|
|
182 |
print 'authenticateReportUser requires 2 args'
|
|
|
183 |
sys.exit(1)
|
|
|
184 |
pp.pprint(client.authenticateReportUser(args[0],args[1],))
|
|
|
185 |
|
|
|
186 |
elif cmd == 'getReports':
|
|
|
187 |
if len(args) != 1:
|
|
|
188 |
print 'getReports requires 1 args'
|
|
|
189 |
sys.exit(1)
|
|
|
190 |
pp.pprint(client.getReports(eval(args[0]),))
|
|
|
191 |
|
| 2025 |
ankur.sing |
192 |
elif cmd == 'authenticateCatalogUser':
|
| 2358 |
ankur.sing |
193 |
if len(args) != 3:
|
|
|
194 |
print 'authenticateCatalogUser requires 3 args'
|
| 2025 |
ankur.sing |
195 |
sys.exit(1)
|
| 2358 |
ankur.sing |
196 |
pp.pprint(client.authenticateCatalogUser(args[0],args[1],eval(args[2]),))
|
| 2025 |
ankur.sing |
197 |
|
| 349 |
ashish |
198 |
transport.close()
|