feat: add agent API and operational analytics
This commit is contained in:
1 parent
720ea0652a
commit
e8b730b592
65 files changed
+2650
-1214
No files matched your search
@@ -3,6 +3,7 @@ import {
|
||||
StrategyPerformanceResponseSchema,
|
||||
SubredditPerformanceResponseSchema,
|
||||
SuccessfulExamplesResponseSchema,
|
||||
FunnelResponseSchema,
|
||||
} from '../../../../../packages/api-contracts/src/index.js';
|
||||
import type { z } from 'zod';
|
||||
import { createDashboardRequest } from '../../api/request.js';
|
||||
@@ -11,6 +12,7 @@ type SubredditPerformanceResponse = z.infer<typeof SubredditPerformanceResponseS
|
||||
type StrategyPerformanceResponse = z.infer<typeof StrategyPerformanceResponseSchema>;
|
||||
type DailyTrendResponse = z.infer<typeof DailyTrendResponseSchema>;
|
||||
type SuccessfulExamplesResponse = z.infer<typeof SuccessfulExamplesResponseSchema>;
|
||||
type FunnelResponse = z.infer<typeof FunnelResponseSchema>;
|
||||
|
||||
async function parseResponse<T>(
|
||||
response: Response,
|
||||
@@ -35,6 +37,7 @@ export interface PerformanceApi {
|
||||
getStrategyPerformance(): Promise<StrategyPerformanceResponse>;
|
||||
getDailyTrend(days: number): Promise<DailyTrendResponse>;
|
||||
getSuccessfulExamples(): Promise<SuccessfulExamplesResponse>;
|
||||
getFunnel(): Promise<FunnelResponse>;
|
||||
}
|
||||
|
||||
export function createPerformanceApi(
|
||||
@@ -66,6 +69,12 @@ export function createPerformanceApi(
|
||||
SuccessfulExamplesResponseSchema,
|
||||
);
|
||||
},
|
||||
async getFunnel() {
|
||||
return parseResponse(
|
||||
await request('/api/analytics/funnel'),
|
||||
FunnelResponseSchema,
|
||||
);
|
||||
},
|
||||
} satisfies PerformanceApi;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user