summaryrefslogtreecommitdiffstats
path: root/module/api/AccountApi.py
diff options
context:
space:
mode:
authorGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-03 21:00:58 +0100
committerGravatar RaNaN <Mast3rRaNaN@hotmail.de> 2013-01-03 21:00:58 +0100
commit7c6374b4b5d452ab239f8b725038f2a2eb82368f (patch)
tree392f5809fb908eb7f22dffd273821bcc831da3dc /module/api/AccountApi.py
parentseperate api into several components (diff)
downloadpyload-7c6374b4b5d452ab239f8b725038f2a2eb82368f.tar.xz
split api into more components
Diffstat (limited to 'module/api/AccountApi.py')
-rw-r--r--module/api/AccountApi.py49
1 files changed, 49 insertions, 0 deletions
diff --git a/module/api/AccountApi.py b/module/api/AccountApi.py
new file mode 100644
index 000000000..396824a55
--- /dev/null
+++ b/module/api/AccountApi.py
@@ -0,0 +1,49 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+
+from module.Api import Api, RequirePerm, Permission
+
+from ApiComponent import ApiComponent
+
+class AccountApi(ApiComponent):
+ """ All methods to control accounts """
+
+ @RequirePerm(Permission.Accounts)
+ def getAccounts(self, refresh):
+ """Get information about all entered accounts.
+
+ :param refresh: reload account info
+ :return: list of `AccountInfo`
+ """
+ accs = self.core.accountManager.getAllAccounts(refresh)
+ accounts = []
+ for plugin in accs.itervalues():
+ accounts.extend(plugin.values())
+
+ return accounts
+
+ @RequirePerm(Permission.All)
+ def getAccountTypes(self):
+ """All available account types.
+
+ :return: string list
+ """
+ return self.core.pluginManager.getPlugins("accounts").keys()
+
+ @RequirePerm(Permission.Accounts)
+ def updateAccount(self, plugin, account, password=None, options={}):
+ """Changes pw/options for specific account."""
+ self.core.accountManager.updateAccount(plugin, account, password, options)
+
+ @RequirePerm(Permission.Accounts)
+ def removeAccount(self, plugin, account):
+ """Remove account from pyload.
+
+ :param plugin: pluginname
+ :param account: accountname
+ """
+ self.core.accountManager.removeAccount(plugin, account)
+
+
+if Api.extend(AccountApi):
+ del AccountApi \ No newline at end of file