n8n/packages/nodes-base/nodes/Cockpit/SingletonFunctions.ts

17 lines
647 B
TypeScript
Raw Normal View History

import { IExecuteFunctions, IExecuteSingleFunctions, ILoadOptionsFunctions } from 'n8n-core';
2020-04-04 07:04:25 -07:00
import { cockpitApiRequest } from './GenericFunctions';
export async function getSingleton(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
resourceName: string,
// tslint:disable-next-line:no-any
): Promise<any> {
2020-04-04 07:04:25 -07:00
return cockpitApiRequest.call(this, 'get', `/singletons/get/${resourceName}`);
}
export async function getAllSingletonNames(
this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
): Promise<string[]> {
return cockpitApiRequest.call(this, 'GET', `/singletons/listSingletons`, {});
}