import type {IApiQueryReq} from "@/interface/page/api/IApiQueryReq.ts";
import axiosInstance from "@/api/axios.ts";
import type {IBaseApiData} from "@/model/table/IBaseApiData.ts";

export default class ApiApi {

    // 查询 API 数据
    static queryApi(searchData: IApiQueryReq) {
        return axiosInstance.post("/app/api/queryApiBaseInfo", searchData);
    };

    // 重载接口数据
    static reloadApi() {
        return axiosInstance.put("/app/api/reloadApiKey")
    }

    // 添加 API 数据
    static addApi(apiData: IBaseApiData) {
        return axiosInstance.post("/app/api/addApiBaseInfo", apiData);
    };

    // 删除 API 数据
    static deleteApi(apiId: string | undefined) {
        return axiosInstance.delete("/app/api/deleteApiBaseInfo/" + apiId)
    };

    // 更新数据
    static updateApi(apiData: IBaseApiData) {
        return axiosInstance.post("/app/api/updateApiBaseInfo", apiData);
    }
}