Small improvements on Cockpit-Node

This commit is contained in:
Jan Oberhauser
2020-04-06 10:03:49 +02:00
parent 30e5960248
commit 7e17486383
6 changed files with 84 additions and 58 deletions

View File

@@ -50,24 +50,19 @@ export async function getAllCollectionEntries(this: IExecuteFunctions | IExecute
body.populate = options.populate as boolean;
}
if (options.simple) {
body.simple = options.simple as boolean;
body.simple = true;
if (options.rawData) {
body.simple = !options.rawData as boolean;
}
if (options.language) {
body.lang = options.language as string;
}
const resultData = await cockpitApiRequest.call(this, 'post', `/collections/get/${resourceName}`, body);
if (options.rawData === true) {
return resultData;
}
return (resultData as unknown as IDataObject).entries;
return cockpitApiRequest.call(this, 'post', `/collections/get/${resourceName}`, body);
}
export async function getAllCollectionNames(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions): Promise<string[]> {
return cockpitApiRequest.call(this, 'GET', `/collections/listCollections`, {});
}
}