Stats API Client
Component Detail
Infrastructure
low complexity
mobile
0
Dependencies
0
Dependents
0
Entities
0
Integrations
Description
Typed REST API client responsible for calling the stats aggregation endpoint on the Next.js backend. Handles authentication header injection, response deserialization into typed Dart models, and network error handling with retry logic. Registered as a Riverpod provider so it can be mocked in tests.
stats-api-client
Responsibilities
- Execute authenticated GET requests to /api/v1/stats endpoints
- Deserialize JSON response payloads into typed StatsPayload models
- Handle HTTP errors and surface typed exceptions to the service layer
- Support request cancellation on filter change
Interfaces
fetchPersonalStats(filter: StatsFilter) → Future<StatsPayload>
fetchMentorStats(mentorId: string, filter: StatsFilter) → Future<StatsPayload>
cancelPendingRequests() → void