n8n/packages/nodes-base/nodes/Splunk/v2/methods/loadOptions.ts
2024-07-04 16:07:17 +03:00

14 lines
472 B
TypeScript

import type { ILoadOptionsFunctions, INodePropertyOptions } from 'n8n-workflow';
import { splunkApiJsonRequest } from '../transport';
export async function getRoles(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const endpoint = '/services/authorization/roles';
const responseData = await splunkApiJsonRequest.call(this, 'GET', endpoint);
return (responseData as Array<{ id: string }>).map((entry) => ({
name: entry.id,
value: entry.id,
}));
}