"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.publishFunction = exports.deleteFunction = exports.updateFunction = exports.addFunction = exports.fetchAppFunctions = exports.fetchFunctions = void 0;
const api_agent_1 = __importDefault(require("@/utils/api-agent"));
const fetchFunctions = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/function-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchFunctions = fetchFunctions;
const fetchAppFunctions = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/functions/file-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchAppFunctions = fetchAppFunctions;
const addFunction = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/functions', params, (rs) => {
        resolve(rs);
    });
});
exports.addFunction = addFunction;
const updateFunction = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/functions', params, (rs) => {
        resolve(rs);
    });
});
exports.updateFunction = updateFunction;
const deleteFunction = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/functions/status', params, (rs) => {
        resolve(rs);
    });
});
exports.deleteFunction = deleteFunction;
const publishFunction = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/functions/version-publish', params, (rs) => {
        resolve(rs);
    });
});
exports.publishFunction = publishFunction;
