import type { AxiosResponse } from "axios"; import type { Attachment, AttachmentList, AttachmentParams, AttachmentService, } from "../attachment/attachment-interface"; import { getData, deleteData } from "../index"; export const ENDPOINT = { ATTACH_SERVICE: { TUS_UPLOAD: "/attach-service/api/v1/tus/upload", EDITOR_UPLOAD: "/attach-service/api/v1/upload/editor", IMAGES: "/attach-service/api/v1/images", MOVIE_THUMBNAIL: "/attach-service/api/v1/movie/thumbnail", ATTACHMENTS: "/attach-service/api/v1/atfl/attachments", DOWNLOAD: "/attach-service/api/v1/atflcd/download", STREAM_VIDEO: "/attach-service/api/v1/stream/video", DELETE_FILE_BY_ATFLCD: "/attach-service/api/v1/atfl/attachments/atflCd", }, }; export class AttachmentApiService implements AttachmentService { public async getAttachmentsList( params: AttachmentParams, ): Promise { const response = await getData(`${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}`); return response.data; } public async getAttachmentsInfo(atflCd: string): Promise { const response = await getData( `${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/${atflCd}`, ); return response.data; } public async deleteAttachmentByAtflCd(atflCd: string): Promise { await deleteData(`${ENDPOINT.ATTACH_SERVICE.ATTACHMENTS}/atflCd/${atflCd}`); } } export const AttachmentApi = new AttachmentApiService();