Open pattontim opened 1 year ago
When you create a model, all of its info in its entirety is available to you.
"result":{ "sortf":0, "did":1, "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}", "mod":1551462107, "usn":-1, "vers":[ ], "type":0, "css":".card {\n font-family: arial;\n font-size: 20px;\n text-align: center;\n color: black;\n background-color: white;\n}\n", "name":"TestApiModel", "flds":[ { "name":"Field1", "ord":0, [...]
However, if you want to retrieve information by model ID it is necessary to make several requests and attempt to reconstruct the information-
chain('modelFieldNames', { "modelName": modelName }) .add('modelTemplates', { "modelName": modelName }) .add('modelFieldFonts', { "modelName": modelName }) .add('modelStyling', { "modelName": modelName }) .add('modelFieldsOnTemplates', { "modelName": modelName }) const [fieldNames, templates, fonts, styling, fieldsOnTemplates] = modelBuilder.commit() as [ fieldNames: string[], templates: { [templateName: string]: { [fieldName: string]: string } }, fonts: { [fieldName: string]: { font: string, size: number } }, styling: { css: string }, fieldsOnTemplates: { [templateName: string]: [string][] } ]
Even more calls would be needed to recreate all of the info
A simplified endpoint might look like...
modelInfo: { params: { modelName: string; }; result: { sortf: number; did: number; latexPre: string; latexPost: string; mod: number; usn: number; vers: unknown[]; type: number; css: string; name: string; flds: AnkiField[]; tmpls: AnkiTemplate[]; tags: string[]; id: number; req: unknown[]; } };
When you create a model, all of its info in its entirety is available to you.
However, if you want to retrieve information by model ID it is necessary to make several requests and attempt to reconstruct the information-
Even more calls would be needed to recreate all of the info
A simplified endpoint might look like...