This commit is contained in:
@@ -34,6 +34,24 @@ export interface GetUploadUrlResponse {
|
||||
expires_in: number
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取文件下载预签名 URL 请求
|
||||
*/
|
||||
export interface BatchDownloadUrlsRequest {
|
||||
/** 文件路径标识列表,最多 50 个 */
|
||||
file_keys: string[]
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取文件下载预签名 URL 响应
|
||||
*/
|
||||
export interface BatchDownloadUrlsResponse {
|
||||
/** 文件下载地址映射,key 为 file_key */
|
||||
urls: Record<string, string>
|
||||
/** URL 有效期(秒) */
|
||||
expires_in: number
|
||||
}
|
||||
|
||||
export class StorageService extends BaseService {
|
||||
/**
|
||||
* 获取文件上传预签名 URL
|
||||
@@ -100,4 +118,18 @@ export class StorageService extends BaseService {
|
||||
throw error
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 批量获取文件下载预签名 URL
|
||||
* 用于获取私有文件的临时下载地址
|
||||
* @param data 请求参数
|
||||
*/
|
||||
static batchDownloadUrls(
|
||||
data: BatchDownloadUrlsRequest
|
||||
): Promise<BaseResponse<BatchDownloadUrlsResponse>> {
|
||||
return this.post<BaseResponse<BatchDownloadUrlsResponse>>(
|
||||
'/api/admin/storage/batch-download-urls',
|
||||
data
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user