commit
a779fa673f
20
README.md
20
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**
|
* **loadProfile**
|
||||||
|
|
||||||
Selects the profile specified in request.
|
Selects the profile specified in request.
|
||||||
|
@ -262,6 +262,9 @@ class AnkiConnect:
|
|||||||
def version(self):
|
def version(self):
|
||||||
return util.setting('apiVersion')
|
return util.setting('apiVersion')
|
||||||
|
|
||||||
|
@util.api()
|
||||||
|
def getProfiles(self):
|
||||||
|
return self.window().pm.profiles()
|
||||||
|
|
||||||
@util.api()
|
@util.api()
|
||||||
def loadProfile(self, name):
|
def loadProfile(self, name):
|
||||||
|
@ -14,6 +14,14 @@ class TestMisc(unittest.TestCase):
|
|||||||
# sync
|
# sync
|
||||||
util.invoke('sync')
|
util.invoke('sync')
|
||||||
|
|
||||||
|
# getProfiles
|
||||||
|
profiles = util.invoke('getProfiles')
|
||||||
|
self.assertIsInstance(profiles, list)
|
||||||
|
self.assertGreater(len(profiles), 0)
|
||||||
|
|
||||||
|
# loadProfile
|
||||||
|
util.invoke('loadProfile', name=profiles[0])
|
||||||
|
|
||||||
# multi
|
# multi
|
||||||
actions = [util.request('version'), util.request('version'), util.request('version')]
|
actions = [util.request('version'), util.request('version'), util.request('version')]
|
||||||
results = util.invoke('multi', actions=actions)
|
results = util.invoke('multi', actions=actions)
|
||||||
|
Loading…
Reference in New Issue
Block a user