UNPKG

t-comm

Version:

专业、稳定、纯粹的工具库

41 lines (38 loc) 897 B
import axios from 'axios'; /** * 启动流水线 * * @param {object} config 配置信息 * @param {string} config.buildId 流水线构建Id * @param {object} config.data 携带的数据 * @returns Promise * * @example * * ```ts * startPipeline({ * buildId, * data: {} * }).then(() => { * * }) * ``` */ function startPipeline(_ref) { var buildId = _ref.buildId, _ref$data = _ref.data, data = _ref$data === void 0 ? {} : _ref$data; return new Promise(function (resolve, reject) { if (!buildId) { reject(new Error('缺少buildId')); return; } var pipelineUrl = "http://devops.oa.com/ms/process/api/external/pipelines/".concat(buildId, "/build"); axios.post(pipelineUrl, Object.assign({}, data)).then(function (res) { resolve(res.data); })["catch"](function (err) { reject(err); }); }); } export { startPipeline };