42 lines
1.7 KiB
TypeScript
42 lines
1.7 KiB
TypeScript
import { BaseApiClient } from '../base/BaseApiClient';
|
|
import type { CreateSponsorInputDTO } from '../../types/generated/CreateSponsorInputDTO';
|
|
import type { SponsorDashboardDTO } from '../../types/generated/SponsorDashboardDTO';
|
|
import type { SponsorSponsorshipsDTO } from '../../types/generated/SponsorSponsorshipsDTO';
|
|
|
|
// TODO: Move these types to apps/website/lib/types/generated when available
|
|
export type CreateSponsorOutputDto = { id: string; name: string };
|
|
export type GetEntitySponsorshipPricingResultDto = { pricing: Array<{ entityType: string; price: number }> };
|
|
export type SponsorDTO = { id: string; name: string; logoUrl?: string; websiteUrl?: string };
|
|
export type GetSponsorsOutputDto = { sponsors: SponsorDTO[] };
|
|
|
|
/**
|
|
* 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`);
|
|
}
|
|
} |