UNPKG

t-comm

Version:

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

50 lines (43 loc) 1.22 kB
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var tslib_es6 = require('../tslib.es6-01322ba9.js'); var axios = require('axios'); function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; } var axios__default = /*#__PURE__*/_interopDefaultLegacy(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__default["default"].post(pipelineUrl, tslib_es6.__assign({}, data)).then(function (res) { resolve(res.data); })["catch"](function (err) { reject(err); }); }); } exports.startPipeline = startPipeline;