import type { InternalAxiosRequestConfig } from 'axios'; import { BaseService } from '../core/base.service'; import type { FileStatsResponse, ListUploadsResponse } from './types'; export class AdminUploadService extends BaseService { protected static readonly basePath = '/api/v1/admin/uploads'; static async listUploads( page = 1, pageSize = 20, keyword?: string, type?: string, extension?: string, ): Promise { const params: Record = { page, page_size: pageSize, }; if (keyword) params.keyword = keyword; if (type) params.type = type; if (extension) params.extension = extension; return this.get('', params); } static async getFileStats(): Promise { return this.get('/stats'); } static async deleteFile(id: string): Promise { return this.delete(`/${id}`); } static getDownloadUrl(id: string): string { return `${this.basePath}/download/${id}`; } static async batchDownload(ids: string[]): Promise { return this.post('/download/batch', { ids }, { responseType: 'blob', } as InternalAxiosRequestConfig); } }