import { request } from '../request'

export interface ReqDeleteAliOssFile {
  key: string
}

export interface AliOssSTS {
  AccessKeyId: string
  AccessKeySecret: string
  SecurityToken: string
  Expiration: string
  BucketName: string
  Region: string
}

/** 得到上传的token */
export function getAliOssTokenAxios() {
  return request<AliOssSTS>({
    url: `${import.meta.env.VITE_BASE_UPLOAD_URL}/admin/v1/oss/sts`,
    method: 'get',
  })
}

/** 删除阿里云oss 文件 */
export function deleteAliOssFileAxios(data: ReqDeleteAliOssFile) {
  return request<boolean>({
    url: `${import.meta.env.VITE_BASE_UPLOAD_URL}/admin/v1/oss/delete`,
    method: 'post',
    data,
  })
}
