Merge pull request #33 from techdavid/decknamesandids
Add deckNamesAndIds action
This commit is contained in:
commit
6399da13e7
@ -515,6 +515,17 @@ class AnkiBridge:
|
|||||||
return collection.decks.allNames()
|
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):
|
def deckNameFromId(self, deckId):
|
||||||
collection = self.collection()
|
collection = self.collection()
|
||||||
if collection is not None:
|
if collection is not None:
|
||||||
@ -753,6 +764,11 @@ class AnkiConnect:
|
|||||||
return self.anki.deckNames()
|
return self.anki.deckNames()
|
||||||
|
|
||||||
|
|
||||||
|
@webApi
|
||||||
|
def deckNamesAndIds(self):
|
||||||
|
return self.anki.deckNamesAndIds()
|
||||||
|
|
||||||
|
|
||||||
@webApi
|
@webApi
|
||||||
def modelNames(self):
|
def modelNames(self):
|
||||||
return self.anki.modelNames()
|
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**
|
* **modelNames**
|
||||||
|
|
||||||
Gets the complete list of model names for the current user.
|
Gets the complete list of model names for the current user.
|
||||||
|
Loading…
Reference in New Issue
Block a user