t-comm
Version:
专业、稳定、纯粹的工具库
45 lines (40 loc) • 1.13 kB
JavaScript
;
Object.defineProperty(exports, '__esModule', { value: true });
var tgit_helper = require('./helper.js');
require('axios');
/**
* 获取commit详情
* @param {object} options 输入配置
* @param {string} options.projectName 项目名称
* @param {string} options.commitId 提交hash
* @param {string} options.privateToken 密钥
* @returns {Promise<object>} 请求Promise
* @example
*
* getOneCommitDetail({
* projectName: 't-comm',
* commitId: 'aaaa',
* privateToken: 'xxxxx',
* }).then((resp) => {
*
* })
*/
function getOneCommitDetail(_a) {
var projectName = _a.projectName,
commitId = _a.commitId,
privateToken = _a.privateToken;
return new Promise(function (resolve) {
tgit_helper.instance({
url: "/projects/".concat(encodeURIComponent(projectName), "/repository/commits/").concat(encodeURIComponent(commitId)),
method: 'GET',
headers: {
'PRIVATE-TOKEN': privateToken
}
}).then(function (res) {
resolve(res.data);
})["catch"](function () {
resolve({});
});
});
}
exports.getOneCommitDetail = getOneCommitDetail;