@@ -119,11 +119,16 @@ def __init__(self, auth_stub, obj_type):
119
119
##
120
120
########
121
121
class ET_Configure (ET_Constructor ):
122
- def __init__ (self , auth_stub , obj_type , props = None , update = False ):
122
+ def __init__ (self , auth_stub , obj_type , props = None , update = False , delete = False ):
123
123
auth_stub .refresh_token ()
124
124
125
125
ws_configureRequest = auth_stub .soap_client .factory .create ('ConfigureRequestMsg' )
126
- ws_configureRequest .Action = 'create' if update is False else 'update'
126
+ action = 'create'
127
+ if delete :
128
+ action = 'delete'
129
+ elif update :
130
+ action = 'update'
131
+ ws_configureRequest .Action = action
127
132
ws_configureRequest .Configurations = {'Configuration' : self .parse_props_into_ws_object (auth_stub , obj_type , props )}
128
133
129
134
response = auth_stub .soap_client .service .Configure (None , ws_configureRequest )
@@ -138,7 +143,7 @@ def __init__(self, auth_stub, obj_type, props = None, update = False):
138
143
##
139
144
########
140
145
class ET_Get (ET_Constructor ):
141
- def __init__ (self , auth_stub , obj_type , props = None , search_filter = None ):
146
+ def __init__ (self , auth_stub , obj_type , props = None , search_filter = None , options = None ):
142
147
auth_stub .refresh_token ()
143
148
144
149
if props is None : #if there are no properties to retrieve for the obj_type then return a Description of obj_type
@@ -187,6 +192,14 @@ def __init__(self, auth_stub, obj_type, props = None, search_filter = None):
187
192
ws_simpleFilterPart [prop [0 ]] = search_filter [prop [0 ]]
188
193
ws_retrieveRequest .Filter = ws_simpleFilterPart
189
194
195
+ if options is not None :
196
+ for key , value in options .iteritems ():
197
+ if isinstance (value , dict ):
198
+ for k , v in value .iteritems ():
199
+ ws_retrieveRequest .Options [key ][k ] = v
200
+ else :
201
+ ws_retrieveRequest .Options [key ] = value
202
+
190
203
ws_retrieveRequest .ObjectType = obj_type
191
204
192
205
response = auth_stub .soap_client .service .Retrieve (ws_retrieveRequest )
@@ -264,6 +277,7 @@ class ET_BaseObject(object):
264
277
props = None
265
278
extProps = None
266
279
search_filter = None
280
+ options = None
267
281
268
282
########
269
283
##
@@ -273,9 +287,10 @@ class ET_BaseObject(object):
273
287
class ET_GetSupport (ET_BaseObject ):
274
288
obj_type = 'ET_GetSupport' #should be overwritten by inherited class
275
289
276
- def get (self , m_props = None , m_filter = None ):
290
+ def get (self , m_props = None , m_filter = None , m_options = None ):
277
291
props = self .props
278
292
search_filter = self .search_filter
293
+ options = self .options
279
294
280
295
if m_props is not None and type (m_props ) is list :
281
296
props = m_props
@@ -285,7 +300,10 @@ def get(self, m_props = None, m_filter = None):
285
300
if m_filter is not None and type (m_filter ) is dict :
286
301
search_filter = m_filter
287
302
288
- obj = ET_Get (self .auth_stub , self .obj_type , props , search_filter )
303
+ if m_options is not None and type (m_filter ) is dict :
304
+ options = m_options
305
+
306
+ obj = ET_Get (self .auth_stub , self .obj_type , props , search_filter , options )
289
307
if obj is not None :
290
308
self .last_request_id = obj .request_id
291
309
return obj
0 commit comments