api client refactor
This commit is contained in:
29
apps/website/lib/api/drivers/DriversApiClient.ts
Normal file
29
apps/website/lib/api/drivers/DriversApiClient.ts
Normal file
@@ -0,0 +1,29 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type {
|
||||
DriversLeaderboardDto,
|
||||
CompleteOnboardingInputDto,
|
||||
CompleteOnboardingOutputDto,
|
||||
DriverDto,
|
||||
} from '../../dtos';
|
||||
|
||||
/**
|
||||
* Drivers API Client
|
||||
*
|
||||
* Handles all driver-related API operations.
|
||||
*/
|
||||
export class DriversApiClient extends BaseApiClient {
|
||||
/** Get drivers leaderboard */
|
||||
getLeaderboard(): Promise<DriversLeaderboardDto> {
|
||||
return this.get<DriversLeaderboardDto>('/drivers/leaderboard');
|
||||
}
|
||||
|
||||
/** Complete driver onboarding */
|
||||
completeOnboarding(input: CompleteOnboardingInputDto): Promise<CompleteOnboardingOutputDto> {
|
||||
return this.post<CompleteOnboardingOutputDto>('/drivers/complete-onboarding', input);
|
||||
}
|
||||
|
||||
/** Get current driver (based on session) */
|
||||
getCurrent(): Promise<DriverDto | null> {
|
||||
return this.get<DriverDto | null>('/drivers/current');
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user