mirror of
https://github.com/ankitects/anki.git
synced 2025-12-03 01:47:13 -05:00
27 lines
767 B
TypeScript
27 lines
767 B
TypeScript
// Copyright: Ankitects Pty Ltd and contributors
|
|
// License: GNU AGPL, version 3 or later; http://www.gnu.org/licenses/agpl.html
|
|
|
|
import {
|
|
ImportExport,
|
|
importExport,
|
|
Notetypes,
|
|
notetypes as notetypeService,
|
|
} from "../lib/proto";
|
|
|
|
export async function getNotetypeFields(notetypeId: number): Promise<string[]> {
|
|
return notetypeService
|
|
.getFieldNames(Notetypes.NotetypeId.create({ ntid: notetypeId }))
|
|
.then((list) => list.vals);
|
|
}
|
|
|
|
export async function getCsvMetadata(
|
|
path: string,
|
|
delimiter?: ImportExport.CsvMetadata.Delimiter,
|
|
): Promise<ImportExport.CsvMetadata> {
|
|
return importExport.getCsvMetadata(
|
|
ImportExport.CsvMetadataRequest.create({
|
|
path,
|
|
delimiter,
|
|
}),
|
|
);
|
|
}
|