Files
gridpilot.gg/apps/website/lib/api/analytics/AnalyticsApiClient.ts
2025-12-18 22:19:40 +01:00

34 lines
1.5 KiB
TypeScript

import { BaseApiClient } from '../base/BaseApiClient';
import { RecordPageViewOutputDTO } from '../../types/generated/RecordPageViewOutputDTO';
import { RecordEngagementOutputDTO } from '../../types/generated/RecordEngagementOutputDTO';
import { GetDashboardDataOutputDTO } from '../../types/generated/GetDashboardDataOutputDTO';
import { GetAnalyticsMetricsOutputDTO } from '../../types/generated/GetAnalyticsMetricsOutputDTO';
import { RecordPageViewInputDTO } from '../../types/generated/RecordPageViewInputDTO';
import { RecordEngagementInputDTO } from '../../types/generated/RecordEngagementInputDTO';
/**
* Analytics API Client
*
* Handles all analytics-related API operations.
*/
export class AnalyticsApiClient extends BaseApiClient {
/** Record a page view */
recordPageView(input: RecordPageViewInputDTO): Promise<RecordPageViewOutputDTO> {
return this.post<RecordPageViewOutputDTO>('/analytics/page-view', input);
}
/** Record an engagement event */
recordEngagement(input: RecordEngagementInputDTO): Promise<RecordEngagementOutputDTO> {
return this.post<RecordEngagementOutputDTO>('/analytics/engagement', input);
}
/** Get analytics dashboard data */
getDashboardData(): Promise<GetDashboardDataOutputDTO> {
return this.get<GetDashboardDataOutputDTO>('/analytics/dashboard');
}
/** Get analytics metrics */
getAnalyticsMetrics(): Promise<GetAnalyticsMetricsOutputDTO> {
return this.get<GetAnalyticsMetricsOutputDTO>('/analytics/metrics');
}
}