Merge pull request #69 from sudarshang/add_sync
Expose Anki sync via AnkiConnect
This commit is contained in:
commit
89bd6ca6db
@ -947,10 +947,14 @@ class AnkiBridge:
|
||||
timer.timeout.connect(exitAnki)
|
||||
timer.start(1000) # 1s should be enough to allow the response to be sent.
|
||||
|
||||
def sync(self):
|
||||
self.window().onSync()
|
||||
|
||||
#
|
||||
# AnkiConnect
|
||||
#
|
||||
|
||||
|
||||
class AnkiConnect:
|
||||
def __init__(self):
|
||||
self.anki = AnkiBridge()
|
||||
@ -1281,6 +1285,11 @@ class AnkiConnect:
|
||||
def notesInfo(self, notes):
|
||||
return self.anki.notesInfo(notes)
|
||||
|
||||
@webApi()
|
||||
def sync(self):
|
||||
return self.anki.sync()
|
||||
|
||||
|
||||
#
|
||||
# Entry
|
||||
#
|
||||
|
21
README.md
21
README.md
@ -191,6 +191,27 @@ guarantee that your application continues to function properly in the future.
|
||||
}
|
||||
```
|
||||
|
||||
* **sync**
|
||||
|
||||
Synchronizes the local anki collections with ankiweb.
|
||||
|
||||
*Sample request*:
|
||||
```json
|
||||
{
|
||||
"action": "sync",
|
||||
"version": 5
|
||||
|
||||
}
|
||||
```
|
||||
|
||||
*Sample result*:
|
||||
```json
|
||||
{
|
||||
"result": null,
|
||||
"error": null
|
||||
}
|
||||
|
||||
|
||||
* **multi**
|
||||
|
||||
Performs multiple actions in one request, returning an array with the response of each action (in the given order).
|
||||
|
Loading…
Reference in New Issue
Block a user