import {
  get,
  getFileUrl
} from '@/common/utils/http-util.ts'

interface PresignedUrl extends Record<string, string | undefined> {
  url?: string
  bucketName?: string
  objectName?: string
}

export default {
  obtainPresignedUrl(filename: string) {
    return get<PresignedUrl>('/oss/obtain_presigned_url', {filename})
  },
  download(objectName: string) {
    return get('/oss/download/' + objectName)
  },
  fileUrl(filename: string) {
    return getFileUrl('/oss/download' + filename)
  }
}
