t-comm
Version:
专业、稳定、纯粹的工具库
42 lines (39 loc) • 923 B
JavaScript
import { _ as __assign } from '../tslib.es6-096fffdd.js';
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(_a) {
var buildId = _a.buildId,
_b = _a.data,
data = _b === void 0 ? {} : _b;
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, __assign({}, data)).then(function (res) {
resolve(res.data);
})["catch"](function (err) {
reject(err);
});
});
}
export { startPipeline };