From a17c4e42daa6df977b60f6402ed84587bd5fd1bd Mon Sep 17 00:00:00 2001 From: Kardia Date: Thu, 4 Jan 2024 12:00:40 -0500 Subject: [PATCH] add readme entry for new findModels* apis --- README.md | 377 +++++++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 376 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 2d2b8d8..c1f1f2c 100644 --- a/README.md +++ b/README.md @@ -920,7 +920,7 @@ Search parameters are passed to Anki, check the docs for more information: https #### `deleteDecks` -* Deletes decks with the given names. +* Deletes decks with the given names. The argument `cardsToo` *must* be specified and set to `true`.
@@ -2323,6 +2323,381 @@ Search parameters are passed to Anki, check the docs for more information: https ```
+#### `findModelsById` + +* Gets a list of models for the provided model IDs from the current user. + +
+ Sample request: + + ```json + { + "action": "findModelsById", + "version": 6, + "params": { + "modelIds": [ 1704387367119, 1704387398570 ] + } + } + ``` +
+ +
+ Sample result: + + ```json + { + "result": [ + { + "id": 1704387367119, + "name": "Basic", + "type": 0, + "mod": 1704387367, + "usn": -1, + "sortf": 0, + "did": null, + "tmpls": [ + { + "name": "Card 1", + "ord": 0, + "qfmt": "{{Front}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Back}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": 9176047152973362695 + } + ], + "flds": [ + { + "name": "Front", + "ord": 0, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": 2453723143453745216, + "tag": null, + "preventDeletion": false + }, + { + "name": "Back", + "ord": 1, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": -4853200230425436781, + "tag": null, + "preventDeletion": false + } + ], + "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", + "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", + "latexPost": "\\end{document}", + "latexsvg": false, + "req": [ + [ + 0, + "any", + [ + 0 + ] + ] + ], + "originalStockKind": 1 + }, + { + "id": 1704387398570, + "name": "Basic (and reversed card)", + "type": 0, + "mod": 1704387398, + "usn": -1, + "sortf": 0, + "did": null, + "tmpls": [ + { + "name": "Card 1", + "ord": 0, + "qfmt": "{{Front}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Back}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": 1689886528158874152 + }, + { + "name": "Card 2", + "ord": 1, + "qfmt": "{{Back}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Front}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": -7839609225644824587 + } + ], + "flds": [ + { + "name": "Front", + "ord": 0, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": -7787837672455357996, + "tag": null, + "preventDeletion": false + }, + { + "name": "Back", + "ord": 1, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": 6364828289839985081, + "tag": null, + "preventDeletion": false + } + ], + "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", + "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", + "latexPost": "\\end{document}", + "latexsvg": false, + "req": [ + [ + 0, + "any", + [ + 0 + ] + ], + [ + 1, + "any", + [ + 1 + ] + ] + ], + "originalStockKind": 1 + } + ], + "error": null + } + ``` +
+ + +#### `findModelsByName` + +* Gets a list of models for the provided model names from the current user. + +
+ Sample request: + + ```json + { + "action": "findModelsByName", + "version": 6, + "params": { + "modelNames": ["Basic", "Basic (and reversed card)"] + } + } + ``` +
+ +
+ Sample result: + + ```json + { + "result": [ + { + "id": 1704387367119, + "name": "Basic", + "type": 0, + "mod": 1704387367, + "usn": -1, + "sortf": 0, + "did": null, + "tmpls": [ + { + "name": "Card 1", + "ord": 0, + "qfmt": "{{Front}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Back}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": 9176047152973362695 + } + ], + "flds": [ + { + "name": "Front", + "ord": 0, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": 2453723143453745216, + "tag": null, + "preventDeletion": false + }, + { + "name": "Back", + "ord": 1, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": -4853200230425436781, + "tag": null, + "preventDeletion": false + } + ], + "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", + "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", + "latexPost": "\\end{document}", + "latexsvg": false, + "req": [ + [ + 0, + "any", + [ + 0 + ] + ] + ], + "originalStockKind": 1 + }, + { + "id": 1704387398570, + "name": "Basic (and reversed card)", + "type": 0, + "mod": 1704387398, + "usn": -1, + "sortf": 0, + "did": null, + "tmpls": [ + { + "name": "Card 1", + "ord": 0, + "qfmt": "{{Front}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Back}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": 1689886528158874152 + }, + { + "name": "Card 2", + "ord": 1, + "qfmt": "{{Back}}", + "afmt": "{{FrontSide}}\n\n
\n\n{{Front}}", + "bqfmt": "", + "bafmt": "", + "did": null, + "bfont": "", + "bsize": 0, + "id": -7839609225644824587 + } + ], + "flds": [ + { + "name": "Front", + "ord": 0, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": -7787837672455357996, + "tag": null, + "preventDeletion": false + }, + { + "name": "Back", + "ord": 1, + "sticky": false, + "rtl": false, + "font": "Arial", + "size": 20, + "description": "", + "plainText": false, + "collapsed": false, + "excludeFromSearch": false, + "id": 6364828289839985081, + "tag": null, + "preventDeletion": false + } + ], + "css": ".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", + "latexPre": "\\documentclass[12pt]{article}\n\\special{papersize=3in,5in}\n\\usepackage[utf8]{inputenc}\n\\usepackage{amssymb,amsmath}\n\\pagestyle{empty}\n\\setlength{\\parindent}{0in}\n\\begin{document}\n", + "latexPost": "\\end{document}", + "latexsvg": false, + "req": [ + [ + 0, + "any", + [ + 0 + ] + ], + [ + 1, + "any", + [ + 1 + ] + ] + ], + "originalStockKind": 1 + } + ], + "error": null + } + ``` +
+ #### `modelFieldNames` * Gets the complete list of field names for the provided model name.