mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +00:00
28 lines
943 B
TypeScript
28 lines
943 B
TypeScript
import { makeRestApiRequest } from '@n8n/rest-api-client';
|
|
import type { IRestApiContext } from '@n8n/rest-api-client';
|
|
import type {
|
|
InsightsSummary,
|
|
InsightsByTime,
|
|
InsightsByWorkflow,
|
|
ListInsightsWorkflowQueryDto,
|
|
InsightsDateRange,
|
|
} from '@n8n/api-types';
|
|
|
|
export const fetchInsightsSummary = async (
|
|
context: IRestApiContext,
|
|
filter?: { dateRange: InsightsDateRange['key'] },
|
|
): Promise<InsightsSummary> =>
|
|
await makeRestApiRequest(context, 'GET', '/insights/summary', filter);
|
|
|
|
export const fetchInsightsByTime = async (
|
|
context: IRestApiContext,
|
|
filter?: { dateRange: InsightsDateRange['key'] },
|
|
): Promise<InsightsByTime[]> =>
|
|
await makeRestApiRequest(context, 'GET', '/insights/by-time', filter);
|
|
|
|
export const fetchInsightsByWorkflow = async (
|
|
context: IRestApiContext,
|
|
filter?: ListInsightsWorkflowQueryDto,
|
|
): Promise<InsightsByWorkflow> =>
|
|
await makeRestApiRequest(context, 'GET', '/insights/by-workflow', filter);
|