import api from './api'; class UploadService { private basePath = '/upload'; /** * Get a presigned download URL for an S3 key */ async getPresignedDownloadUrl(key: string): Promise { const response = await api.get<{ data: { url: string } }>( `${this.basePath}/presigned-download-url`, { params: { key } } ); return response.data.data.url; } /** * Check if a URL is an S3 key (not a full URL or local path) */ isS3Key(url: string | null | undefined): boolean { if (!url) return false; // S3 keys don't start with http or / return !url.startsWith('http') && !url.startsWith('/'); } } export const uploadService = new UploadService();