@tak-ps/node-tak
Version:
Lightweight JavaScript library for communicating with TAK Server
42 lines • 1.3 kB
JavaScript
import { TAKList } from './types.js';
import { Type } from '@sinclair/typebox';
import Commands, { CommandOutputFormat } from '../commands.js';
export const TAKList_Iconsets = TAKList(Type.String());
export default class InjectorCommands extends Commands {
schema = {
list: {
description: 'List Iconsets',
params: Type.Object({}),
query: Type.Object({}),
formats: [CommandOutputFormat.JSON]
}
};
async cli(args) {
if (args._[3] === 'list') {
const list = await this.list();
if (args.format === 'json') {
return list;
}
else {
return list.data.map((iconset) => {
return iconset;
}).join('\n');
}
}
else {
throw new Error('Unsupported Subcommand');
}
}
/**
* Return a list of iconset UIDs
*
* {@link https://docs.tak.gov/api/takserver/redoc#tag/iconset-icon-api/operation/getAllIconsetUids TAK Server Docs}.
*/
async list() {
const url = new URL('/Marti/api/iconset/all/uid', this.api.url);
return await this.api.fetch(url, {
method: 'GET'
});
}
}
//# sourceMappingURL=iconsets.js.map