api client refactor
This commit is contained in:
41
apps/website/lib/api/sponsors/SponsorsApiClient.ts
Normal file
41
apps/website/lib/api/sponsors/SponsorsApiClient.ts
Normal file
@@ -0,0 +1,41 @@
|
||||
import { BaseApiClient } from '../base/BaseApiClient';
|
||||
import type {
|
||||
GetEntitySponsorshipPricingResultDto,
|
||||
GetSponsorsOutputDto,
|
||||
CreateSponsorInputDto,
|
||||
CreateSponsorOutputDto,
|
||||
SponsorDashboardDto,
|
||||
SponsorSponsorshipsDto,
|
||||
} from '../../dtos';
|
||||
|
||||
/**
|
||||
* Sponsors API Client
|
||||
*
|
||||
* Handles all sponsor-related API operations.
|
||||
*/
|
||||
export class SponsorsApiClient extends BaseApiClient {
|
||||
/** Get sponsorship pricing */
|
||||
getPricing(): Promise<GetEntitySponsorshipPricingResultDto> {
|
||||
return this.get<GetEntitySponsorshipPricingResultDto>('/sponsors/pricing');
|
||||
}
|
||||
|
||||
/** Get all sponsors */
|
||||
getAll(): Promise<GetSponsorsOutputDto> {
|
||||
return this.get<GetSponsorsOutputDto>('/sponsors');
|
||||
}
|
||||
|
||||
/** Create a new sponsor */
|
||||
create(input: CreateSponsorInputDto): Promise<CreateSponsorOutputDto> {
|
||||
return this.post<CreateSponsorOutputDto>('/sponsors', input);
|
||||
}
|
||||
|
||||
/** Get sponsor dashboard */
|
||||
getDashboard(sponsorId: string): Promise<SponsorDashboardDto | null> {
|
||||
return this.get<SponsorDashboardDto | null>(`/sponsors/dashboard/${sponsorId}`);
|
||||
}
|
||||
|
||||
/** Get sponsor sponsorships */
|
||||
getSponsorships(sponsorId: string): Promise<SponsorSponsorshipsDto | null> {
|
||||
return this.get<SponsorSponsorshipsDto | null>(`/sponsors/${sponsorId}/sponsorships`);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user