Add createDeck action
This commit is contained in:
parent
c4fef2d0b2
commit
64a0a9d6a6
@ -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):
|
||||
|
22
README.md
22
README.md
@ -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.
|
||||
|
Loading…
Reference in New Issue
Block a user