api client refactor
This commit is contained in:
24
apps/website/lib/api/analytics/AnalyticsApiClient.ts
Normal file
24
apps/website/lib/api/analytics/AnalyticsApiClient.ts
Normal file
@@ -0,0 +1,24 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type {
|
||||
RecordPageViewInputDto,
|
||||
RecordPageViewOutputDto,
|
||||
RecordEngagementInputDto,
|
||||
RecordEngagementOutputDto,
|
||||
} from '../../dtos';
|
||||
|
||||
/**
|
||||
* 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user