Subversion Repositories SmartDukaan

Rev

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

Rev Author Line No. Line
3131 rajveer 1
#!/usr/bin/env python
2
#
3431 rajveer 3
# Autogenerated by Thrift Compiler (0.7.0)
3131 rajveer 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 CRMService
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:'
3431 rajveer 24
  print '   getTickets(SearchFilter searchFilter)'
3376 rajveer 25
  print '   getUnassignedTickets()'
26
  print '  void updateTicket(Ticket ticket, Activity activity)'
27
  print '  i64 insertTicket(Ticket ticket, Activity activity)'
4948 phani.kuma 28
  print '  void unassignAgentTickets(i32 assigneeId)'
3431 rajveer 29
  print '   getActivities(SearchFilter searchFilter)'
30
  print '  i64 insertActivity(Activity activity)'
31
  print '  void markAsRead(i64 activityId, i64 agentId)'
32
  print '   getAgents(SearchFilter searchFilter)'
5791 anupam.sin 33
  print '   getInactiveAgents(SearchFilter searchFilter)'
3131 rajveer 34
  print '  void updatePasswordForAgent(string agentEmailId, string password)'
35
  print '   getRoleNamesForAgent(string agentEmailId)'
36
  print '   getPermissionsForRoleName(string roleName)'
3376 rajveer 37
  print '  i64 getLastEmailProcessedTimestamp()'
38
  print '  void updateLastEmailProcessedTimestamp(i64 timestamp)'
4948 phani.kuma 39
  print '  void changeAgentStatus(bool status, string emailId)'
40
  print '  void insertAgent(Agent agent,  role)'
5791 anupam.sin 41
  print '  void changeAgentRole(i64 id,  role)'
42
  print '  i32 getOpenTicketCountForAgent(i64 agentId)'
6104 rajveer 43
  print '   getOpenTicketsMap()'
14882 manish.sha 44
  print '   getFedexReconciliationDataMap( order_ids, string method_key)'
3131 rajveer 45
  print ''
46
  sys.exit(0)
47
 
48
pp = pprint.PrettyPrinter(indent = 2)
49
host = 'localhost'
50
port = 9090
51
uri = ''
52
framed = False
53
http = False
54
argi = 1
55
 
56
if sys.argv[argi] == '-h':
3431 rajveer 57
  parts = sys.argv[argi+1].split(':')
3131 rajveer 58
  host = parts[0]
59
  port = int(parts[1])
60
  argi += 2
61
 
62
if sys.argv[argi] == '-u':
63
  url = urlparse(sys.argv[argi+1])
3431 rajveer 64
  parts = url[1].split(':')
3131 rajveer 65
  host = parts[0]
66
  if len(parts) > 1:
67
    port = int(parts[1])
68
  else:
69
    port = 80
70
  uri = url[2]
3431 rajveer 71
  if url[4]:
72
    uri += '?%s' % url[4]
3131 rajveer 73
  http = True
74
  argi += 2
75
 
76
if sys.argv[argi] == '-f' or sys.argv[argi] == '-framed':
77
  framed = True
78
  argi += 1
79
 
80
cmd = sys.argv[argi]
81
args = sys.argv[argi+1:]
82
 
83
if http:
84
  transport = THttpClient.THttpClient(host, port, uri)
85
else:
86
  socket = TSocket.TSocket(host, port)
87
  if framed:
88
    transport = TTransport.TFramedTransport(socket)
89
  else:
90
    transport = TTransport.TBufferedTransport(socket)
91
protocol = TBinaryProtocol.TBinaryProtocol(transport)
92
client = CRMService.Client(protocol)
93
transport.open()
94
 
95
if cmd == 'getTickets':
96
  if len(args) != 1:
97
    print 'getTickets requires 1 args'
98
    sys.exit(1)
99
  pp.pprint(client.getTickets(eval(args[0]),))
100
 
3376 rajveer 101
elif cmd == 'getUnassignedTickets':
3131 rajveer 102
  if len(args) != 0:
3376 rajveer 103
    print 'getUnassignedTickets requires 0 args'
3131 rajveer 104
    sys.exit(1)
3376 rajveer 105
  pp.pprint(client.getUnassignedTickets())
3131 rajveer 106
 
107
elif cmd == 'updateTicket':
3376 rajveer 108
  if len(args) != 2:
109
    print 'updateTicket requires 2 args'
3131 rajveer 110
    sys.exit(1)
3376 rajveer 111
  pp.pprint(client.updateTicket(eval(args[0]),eval(args[1]),))
3131 rajveer 112
 
113
elif cmd == 'insertTicket':
3376 rajveer 114
  if len(args) != 2:
115
    print 'insertTicket requires 2 args'
3131 rajveer 116
    sys.exit(1)
3376 rajveer 117
  pp.pprint(client.insertTicket(eval(args[0]),eval(args[1]),))
3131 rajveer 118
 
4948 phani.kuma 119
elif cmd == 'unassignAgentTickets':
120
  if len(args) != 1:
121
    print 'unassignAgentTickets requires 1 args'
122
    sys.exit(1)
123
  pp.pprint(client.unassignAgentTickets(eval(args[0]),))
124
 
3131 rajveer 125
elif cmd == 'getActivities':
126
  if len(args) != 1:
127
    print 'getActivities requires 1 args'
128
    sys.exit(1)
129
  pp.pprint(client.getActivities(eval(args[0]),))
130
 
131
elif cmd == 'insertActivity':
132
  if len(args) != 1:
133
    print 'insertActivity requires 1 args'
134
    sys.exit(1)
135
  pp.pprint(client.insertActivity(eval(args[0]),))
136
 
3431 rajveer 137
elif cmd == 'markAsRead':
138
  if len(args) != 2:
139
    print 'markAsRead requires 2 args'
3131 rajveer 140
    sys.exit(1)
3431 rajveer 141
  pp.pprint(client.markAsRead(eval(args[0]),eval(args[1]),))
3131 rajveer 142
 
3431 rajveer 143
elif cmd == 'getAgents':
3131 rajveer 144
  if len(args) != 1:
3431 rajveer 145
    print 'getAgents requires 1 args'
3131 rajveer 146
    sys.exit(1)
3431 rajveer 147
  pp.pprint(client.getAgents(eval(args[0]),))
3131 rajveer 148
 
5791 anupam.sin 149
elif cmd == 'getInactiveAgents':
150
  if len(args) != 1:
151
    print 'getInactiveAgents requires 1 args'
152
    sys.exit(1)
153
  pp.pprint(client.getInactiveAgents(eval(args[0]),))
154
 
3131 rajveer 155
elif cmd == 'updatePasswordForAgent':
156
  if len(args) != 2:
157
    print 'updatePasswordForAgent requires 2 args'
158
    sys.exit(1)
159
  pp.pprint(client.updatePasswordForAgent(args[0],args[1],))
160
 
161
elif cmd == 'getRoleNamesForAgent':
162
  if len(args) != 1:
163
    print 'getRoleNamesForAgent requires 1 args'
164
    sys.exit(1)
165
  pp.pprint(client.getRoleNamesForAgent(args[0],))
166
 
167
elif cmd == 'getPermissionsForRoleName':
168
  if len(args) != 1:
169
    print 'getPermissionsForRoleName requires 1 args'
170
    sys.exit(1)
171
  pp.pprint(client.getPermissionsForRoleName(args[0],))
172
 
3376 rajveer 173
elif cmd == 'getLastEmailProcessedTimestamp':
174
  if len(args) != 0:
175
    print 'getLastEmailProcessedTimestamp requires 0 args'
176
    sys.exit(1)
177
  pp.pprint(client.getLastEmailProcessedTimestamp())
178
 
179
elif cmd == 'updateLastEmailProcessedTimestamp':
180
  if len(args) != 1:
181
    print 'updateLastEmailProcessedTimestamp requires 1 args'
182
    sys.exit(1)
183
  pp.pprint(client.updateLastEmailProcessedTimestamp(eval(args[0]),))
184
 
4948 phani.kuma 185
elif cmd == 'changeAgentStatus':
186
  if len(args) != 2:
187
    print 'changeAgentStatus requires 2 args'
188
    sys.exit(1)
189
  pp.pprint(client.changeAgentStatus(eval(args[0]),args[1],))
190
 
191
elif cmd == 'insertAgent':
192
  if len(args) != 2:
193
    print 'insertAgent requires 2 args'
194
    sys.exit(1)
195
  pp.pprint(client.insertAgent(eval(args[0]),eval(args[1]),))
196
 
5791 anupam.sin 197
elif cmd == 'changeAgentRole':
198
  if len(args) != 2:
199
    print 'changeAgentRole requires 2 args'
200
    sys.exit(1)
201
  pp.pprint(client.changeAgentRole(eval(args[0]),eval(args[1]),))
202
 
203
elif cmd == 'getOpenTicketCountForAgent':
204
  if len(args) != 1:
205
    print 'getOpenTicketCountForAgent requires 1 args'
206
    sys.exit(1)
207
  pp.pprint(client.getOpenTicketCountForAgent(eval(args[0]),))
208
 
6104 rajveer 209
elif cmd == 'getOpenTicketsMap':
210
  if len(args) != 0:
211
    print 'getOpenTicketsMap requires 0 args'
212
    sys.exit(1)
213
  pp.pprint(client.getOpenTicketsMap())
214
 
14882 manish.sha 215
elif cmd == 'getFedexReconciliationDataMap':
216
  if len(args) != 2:
217
    print 'getFedexReconciliationDataMap requires 2 args'
218
    sys.exit(1)
219
  pp.pprint(client.getFedexReconciliationDataMap(eval(args[0]),args[1],))
220
 
3431 rajveer 221
else:
222
  print 'Unrecognized method %s' % cmd
223
  sys.exit(1)
224
 
3131 rajveer 225
transport.close()