Add deckNamesAndIds action
This commit is contained in:
parent
c0a04c6815
commit
b8c5b7c980
@ -515,6 +515,17 @@ class AnkiBridge:
|
||||
return collection.decks.allNames()
|
||||
|
||||
|
||||
def deckNamesAndIds(self):
|
||||
decks = {}
|
||||
|
||||
deckNames = self.deckNames()
|
||||
for deck in deckNames:
|
||||
id = self.collection().decks.id(deck)
|
||||
decks[deck] = id
|
||||
|
||||
return decks
|
||||
|
||||
|
||||
def deckNameFromId(self, deckId):
|
||||
collection = self.collection()
|
||||
if collection is not None:
|
||||
@ -753,6 +764,11 @@ class AnkiConnect:
|
||||
return self.anki.deckNames()
|
||||
|
||||
|
||||
@webApi
|
||||
def deckNamesAndIds(self):
|
||||
return self.anki.deckNamesAndIds()
|
||||
|
||||
|
||||
@webApi
|
||||
def modelNames(self):
|
||||
return self.anki.modelNames()
|
||||
|
18
README.md
18
README.md
@ -121,6 +121,24 @@ Below is a list of currently supported actions. Requests with invalid actions or
|
||||
]
|
||||
```
|
||||
|
||||
* **deckNamesAndIds**
|
||||
|
||||
Gets the complete list of deck names and their respective IDs for the current user.
|
||||
|
||||
*Sample request*:
|
||||
```
|
||||
{
|
||||
"action": "deckNamesAndIds"
|
||||
}
|
||||
```
|
||||
|
||||
*Sample response*:
|
||||
```
|
||||
{
|
||||
"Default": 1
|
||||
}
|
||||
```
|
||||
|
||||
* **modelNames**
|
||||
|
||||
Gets the complete list of model names for the current user.
|
||||
|
Loading…
Reference in New Issue
Block a user