"use strict";
var __importDefault = (this && this.__importDefault) || function (mod) {
    return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.batchPublishEditors = exports.saveEditors = exports.saveComponentRemote = exports.fetchRemoteComponents = exports.searchComponentRemotes = exports.getComponentsEditVersions = exports.putComponentsLiveVersion = exports.putComponentsVersionPublish = exports.getComponentsVersionSearchs = exports.putComponentsVersions = exports.postComponentsVersions = exports.getComponentsContents = exports.getComponentSearchs = exports.putComponentsStatus = exports.postComponents = void 0;
const api_agent_1 = __importDefault(require("@/utils/api-agent"));
// components
// 新增组件
const postComponents = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/components', params, (rs) => {
        resolve(rs);
    });
});
exports.postComponents = postComponents;
// /components/status
// 删除组件
const putComponentsStatus = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/components/status', params, (rs) => {
        resolve(rs);
    });
});
exports.putComponentsStatus = putComponentsStatus;
// 查询组件列表
const getComponentSearchs = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/component-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.getComponentSearchs = getComponentSearchs;
// /components/contents
// 获取组件详情
const getComponentsContents = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/components/contents', params, (rs) => {
        resolve(rs);
    });
});
exports.getComponentsContents = getComponentsContents;
// /components/versions
// 组件新增版本
const postComponentsVersions = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/components/versions', params, (rs) => {
        resolve(rs);
    });
});
exports.postComponentsVersions = postComponentsVersions;
const putComponentsVersions = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/components/versions', params, (rs) => {
        resolve(rs);
    });
});
exports.putComponentsVersions = putComponentsVersions;
// /components/version-searchs
// 获取组件 version 列表
const getComponentsVersionSearchs = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/components/version-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.getComponentsVersionSearchs = getComponentsVersionSearchs;
// /components/version-publish
// 更新组件版本状态
const putComponentsVersionPublish = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/components/version-publish', params, (rs) => {
        resolve(rs);
    });
});
exports.putComponentsVersionPublish = putComponentsVersionPublish;
// /components/live-versions
// live 组件版本
const putComponentsLiveVersion = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/components/live-versions', params, (rs) => {
        resolve(rs);
    });
});
exports.putComponentsLiveVersion = putComponentsLiveVersion;
const getComponentsEditVersions = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/components/edit-versions', params, (rs) => {
        resolve(rs);
    });
});
exports.getComponentsEditVersions = getComponentsEditVersions;
const searchComponentRemotes = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/components/remote', params, (rs) => {
        resolve(rs);
    });
});
exports.searchComponentRemotes = searchComponentRemotes;
const fetchRemoteComponents = (params) => new Promise((resolve) => {
    api_agent_1.default.get('/components/remote-searchs', params, (rs) => {
        resolve(rs);
    });
});
exports.fetchRemoteComponents = fetchRemoteComponents;
const saveComponentRemote = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/components/batch', params, (rs) => {
        resolve(rs);
    });
});
exports.saveComponentRemote = saveComponentRemote;
const saveEditors = (params) => new Promise((resolve) => {
    api_agent_1.default.post('/components/editor-batch', params, (rs) => {
        resolve(rs);
    });
});
exports.saveEditors = saveEditors;
const batchPublishEditors = (params) => new Promise((resolve) => {
    api_agent_1.default.put('/components/batch-live-versions', params, (rs) => {
        resolve(rs);
    });
});
exports.batchPublishEditors = batchPublishEditors;
