Add createDeck action

This commit is contained in:
c-okelly 2018-02-22 18:34:12 +00:00
parent c4fef2d0b2
commit 64a0a9d6a6
2 changed files with 32 additions and 0 deletions

View File

@ -793,6 +793,13 @@ class AnkiBridge:
return decks
def createDeck(self, deck):
self.startEditing()
deckId = self.collection().decks.id(deck)
self.stopEditing()
return deckId
def changeDeck(self, cards, deck):
self.startEditing()
@ -1207,6 +1214,9 @@ class AnkiConnect:
def getDecks(self, cards):
return self.anki.getDecks(cards)
@webApi()
def createDeck(self, deck):
return self.anki.createDeck(deck)
@webApi()
def changeDeck(self, cards, deck):

View File

@ -313,6 +313,28 @@ guarantee that your application continues to function properly in the future.
}
```
* **createDeck**
Create a new empty deck. Will not overwrite a deck that exists with the same name.
*Sample request*:
```json
{
"action": "createDeck",
"version": 5,
"params": {
"deck": "Japanese::Tokyo"
}
}
```
*Sample result*:
```json
{
"result": 1519323742721,
"error": null
}
```
* **changeDeck**
Moves cards with the given IDs to a different deck, creating the deck if it doesn't exist yet.