import type { AxiosResponse } from 'axios' import { apiHttp as http } from '@/utils/http' import type { AfterScriptDetail } from './type' /** * 根据id 加载后置脚本 * @param id 脚本ID */ export const getAfterScriptApi = async (id: string): Promise> => { return http.get({ url: `/dataset/script/${id}/` }) } /** * 获取后置脚本列表 */ export const getAfterScriptListApi = async (): Promise> => { return http.get({ url: '/dataset/script/' }) } /** * 更新后置脚本 * @param id 后置脚本id * @param data 后置脚本 */ export const updateAfterScriptApi = async ( id: string, data: Partial> ): Promise> => { return http.put({ url: `/dataset/script/${id}/`, data: { ...data, id } }) } /** * 创建后置脚本 * @param data 后置脚本 */ export const createAfterScriptApi = async ( data: Pick ): Promise> => { return http.post({ url: '/dataset/script/', data: data }) } /** * 删除后置脚本 * @param id 脚本ID */ export const deleteAfterScriptApi = async ( id: string ): Promise> => { return http.post({ url: `/dataset/script/${id}/` }) }