From fdae44f1d3a2356d8fd2197f7d6a304585ac2c46 Mon Sep 17 00:00:00 2001 From: Scott Noyes Date: Fri, 1 May 2020 09:24:51 -0500 Subject: [PATCH] Add getProfiles action --- README.md | 20 ++++++++++++++++++++ plugin/__init__.py | 3 +++ 2 files changed, 23 insertions(+) diff --git a/README.md b/README.md index 7f1104a..639b4a9 100644 --- a/README.md +++ b/README.md @@ -222,6 +222,26 @@ guarantee that your application continues to function properly in the future. } ``` +* **getProfiles** + + Retrieve the list of profiles. + + *Sample request*: + ```json + { + "action": "getProfiles", + "version": 6 + } + ``` + + *Sample result*: + ```json + { + "result": ["User 1"], + "error": null + } + ``` + * **loadProfile** Selects the profile specified in request. diff --git a/plugin/__init__.py b/plugin/__init__.py index 4d1f933..4b056d5 100644 --- a/plugin/__init__.py +++ b/plugin/__init__.py @@ -261,6 +261,9 @@ class AnkiConnect: def version(self): return util.setting('apiVersion') + @util.api() + def getProfiles(self): + return self.window().pm.profiles() @util.api() def loadProfile(self, name):