diff options
author | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-01-03 21:00:58 +0100 |
---|---|---|
committer | RaNaN <Mast3rRaNaN@hotmail.de> | 2013-01-03 21:00:58 +0100 |
commit | 7c6374b4b5d452ab239f8b725038f2a2eb82368f (patch) | |
tree | 392f5809fb908eb7f22dffd273821bcc831da3dc /module/api/UserInteractionApi.py | |
parent | seperate api into several components (diff) | |
download | pyload-7c6374b4b5d452ab239f8b725038f2a2eb82368f.tar.xz |
split api into more components
Diffstat (limited to 'module/api/UserInteractionApi.py')
-rw-r--r-- | module/api/UserInteractionApi.py | 65 |
1 files changed, 65 insertions, 0 deletions
diff --git a/module/api/UserInteractionApi.py b/module/api/UserInteractionApi.py new file mode 100644 index 000000000..ded305c30 --- /dev/null +++ b/module/api/UserInteractionApi.py @@ -0,0 +1,65 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- + +from module.Api import Api, RequirePerm, Permission, InteractionTask + +from ApiComponent import ApiComponent + +class UserInteractionApi(ApiComponent): + """ Everything needed for user interaction """ + + @RequirePerm(Permission.Interaction) + def isInteractionWaiting(self, mode): + """ Check if task is waiting. + + :param mode: binary or'ed output type + :return: boolean + """ + return self.core.interactionManager.isTaskWaiting(mode) + + @RequirePerm(Permission.Interaction) + def getInteractionTask(self, mode): + """Retrieve task for specific mode. + + :param mode: binary or'ed output type + :return: :class:`InteractionTask` + """ + task = self.core.interactionManager.getTask(mode) + return InteractionTask(-1) if not task else task + + + @RequirePerm(Permission.Interaction) + def setInteractionResult(self, iid, result): + """Set Result for a interaction task. It will be immediately removed from task queue afterwards + + :param iid: interaction id + :param result: result as string + """ + task = self.core.interactionManager.getTaskByID(iid) + if task: + task.setResult(result) + + @RequirePerm(Permission.Interaction) + def getNotifications(self): + """List of all available notifcations. They stay in queue for some time, client should\ + save which notifications it already has seen. + + :return: list of :class:`InteractionTask` + """ + return self.core.interactionManager.getNotifications() + + @RequirePerm(Permission.Interaction) + def getAddonHandler(self): + pass + + @RequirePerm(Permission.Interaction) + def callAddonHandler(self, plugin, func, pid_or_fid): + pass + + @RequirePerm(Permission.Download) + def generateDownloadLink(self, fid, timeout): + pass + + +if Api.extend(UserInteractionApi): + del UserInteractionApi
\ No newline at end of file |