@@ -155,7 +155,6 @@ def update_available(self):
155
155
resp = self .is_update_available ()
156
156
return resp
157
157
158
-
159
158
class Config :
160
159
"""
161
160
Class that represents the Config of a Device
@@ -165,11 +164,21 @@ def __init__(self, device):
165
164
self .device = device
166
165
self .url = '/config'
167
166
168
- def list (self ):
167
+ def list (self , params = None ):
169
168
"""
170
169
:return: List<AdvancedConfigAPIEntry>
171
170
"""
172
- resp = self .device .action (self .url + "/list" )
171
+ if params != None :
172
+ resp = self .device .action (self .url + "/list" )
173
+ return resp
174
+ resp = self .device .action (self .url + "/list" , params )
175
+ return resp
176
+
177
+ def listEnum (self , type ):
178
+ """
179
+ :return: List<AdvancedConfigAPIEntry>
180
+ """
181
+ resp = self .device .action (self .url + "/listEnum" , params = [type ])
173
182
return resp
174
183
175
184
def get (self , interface_name , storage , key ):
@@ -185,6 +194,62 @@ def get(self, interface_name, storage, key):
185
194
resp = self .device .action (self .url + "/get" , params )
186
195
return resp
187
196
197
+ def getDefault (self , interfaceName , storage , key ):
198
+ """
199
+ :param interfaceName: a valid interface name from List<AdvancedConfigAPIEntry>
200
+ :type: str:
201
+ :param storage: 'null' to use default or 'cfg/' + interfaceName
202
+ :type: str:
203
+ :param key: a valid key from from List<AdvancedConfigAPIEntry>
204
+ :type: str:
205
+ """
206
+ params = [interfaceName , storage , key ]
207
+ resp = self .device .action (self .url + "/getDefault" , params )
208
+ return resp
209
+
210
+ def query (self ,
211
+ params = [{
212
+ "configInterface" : "" ,
213
+ "defaultValues" : True ,
214
+ "description" : True ,
215
+ "enumInfo" : True ,
216
+ "includeExtensions" : True ,
217
+ "pattern" : "" ,
218
+ "values" : True
219
+ }]):
220
+ """
221
+ :param params: A dictionary with options. The default dictionary is
222
+ configured so it returns you all the downloads with all details, but you
223
+ can put your own with your options. All the options available are this
224
+ ones:
225
+ {
226
+ "configInterface" : "",
227
+ "defaultValues" : True,
228
+ "description" : True,
229
+ "enumInfo" : True,
230
+ "includeExtensions": True,
231
+ "pattern" : "",
232
+ "values" : ""
233
+ }
234
+ :type: Dictionary
235
+ :rtype: List of dictionaries of this style, with more or less detail based on your options.
236
+ """
237
+ resp = self .device .action (self .url + "/query" , params )
238
+ return resp
239
+
240
+ def reset (self , interfaceName , storage , key ):
241
+ """
242
+ :param interfaceName: a valid interface name from List<AdvancedConfigAPIEntry>
243
+ :type: str:
244
+ :param storage: 'null' to use default or 'cfg/' + interfaceName
245
+ :type: str:
246
+ :param key: a valid key from from List<AdvancedConfigAPIEntry>
247
+ :type: str:
248
+ """
249
+ params = [interfaceName , storage , key ]
250
+ resp = self .device .action (self .url + "/reset" , params )
251
+ return resp
252
+
188
253
def set (self , interface_name , storage , key , value ):
189
254
"""
190
255
:param interfaceName: a valid interface name from List<AdvancedConfigAPIEntry>
@@ -262,6 +327,80 @@ def get_current_state(self):
262
327
resp = self .device .action (self .url + "/getCurrentState" )
263
328
return resp
264
329
330
+ class Extension :
331
+ def __init__ (self , device ):
332
+ self .device = device
333
+ self .url = "/extensions"
334
+
335
+ def list (self ,
336
+ params = [{
337
+ "configInterface" : True ,
338
+ "description" : True ,
339
+ "enabled" : True ,
340
+ "iconKey" : True ,
341
+ "name" : True ,
342
+ "pattern" : "" ,
343
+ "installed" : True
344
+ }]):
345
+ """
346
+ :param params: A dictionary with options. The default dictionary is
347
+ configured so it returns you all the downloads with all details, but you
348
+ can put your own with your options. All the options available are this
349
+ ones:
350
+ {
351
+ "configInterface" : True,
352
+ "description" : True,
353
+ "enabled" : True,
354
+ "iconKey" : True,
355
+ "name" : True,
356
+ "pattern" : "",
357
+ "installed" : True
358
+ }
359
+ :type: Dictionary
360
+ :rtype: List of dictionaries of this style, with more or less detail based on your options.
361
+ """
362
+ resp = self .device .action (self .url + "/list" , params = params )
363
+ return resp
364
+
365
+ def install (self , id ):
366
+ resp = self .device .action (self .url + "/install" , params = [id ])
367
+ return resp
368
+
369
+ def isInstalled (self , id ):
370
+ resp = self .device .action (self .url + "/isInstalled" , params = [id ])
371
+ return resp
372
+
373
+ def isEnabled (self , id ):
374
+ resp = self .device .action (self .url + "/isEnabled" , params = [id ])
375
+ return resp
376
+
377
+ def setEnabled (self , id , enabled ):
378
+ resp = self .device .action (self .url + "/setEnabled" , params = [id , enabled ])
379
+ return resp
380
+
381
+ class Dialog :
382
+ """
383
+ Class that represents the dialogs on myJD
384
+ """
385
+ def __init__ (self , device ):
386
+ self .device = device
387
+ self .url = "/dialogs"
388
+
389
+ def answer (self , id , data ):
390
+ resp = self .device .action (self .url + "/answer" , params = [id , data ])
391
+ return resp
392
+
393
+ def get (self , id , icon = True , properties = True ):
394
+ resp = self .device .action (self .url + "/get" , params = [id , icon , properties ])
395
+ return resp
396
+
397
+ def getTypeInfo (self , dialogType ):
398
+ resp = self .device .action (self .url + "/getTypeInfo" , params = [dialogType ])
399
+ return resp
400
+
401
+ def list (self ):
402
+ resp = self .device .action (self .url + "/list" )
403
+ return resp
265
404
266
405
class Linkgrabber :
267
406
"""
@@ -824,6 +963,8 @@ def __init__(self, jd, device_dict):
824
963
self .downloads = Downloads (self )
825
964
self .toolbar = Toolbar (self )
826
965
self .downloadcontroller = DownloadController (self )
966
+ self .extensions = Extension (self )
967
+ self .dialogs = Dialog (self )
827
968
self .update = Update (self )
828
969
self .jd = Jd (self )
829
970
self .system = System (self )
0 commit comments