UNPKG

@lcap/cli

Version:

utils for lcap

67 lines 1.93 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.MR = exports.Commit = exports.Branch = exports.Repositories = void 0; const BaseUrl = 'https://g.hz.netease.com/api/v4'; /** * 仓库接口 */ exports.Repositories = { Tree: (projectId) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/repository/tree`, method: 'GET', timeout: 30000, }), File: (projectId) => (file) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/repository/files/${encodeURIComponent(file)}`, method: 'GET', timeout: 60000, }), FileMeta: (projectId) => (file) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/repository/files/${encodeURIComponent(file)}`, method: 'HEAD', timeout: 10000, }), }; /** * Branch 分支接口 */ exports.Branch = { /** * 从文件创建 commit * * @link https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions */ Create: (projectId) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/repository/branches`, method: 'POST', }), }; /** * Commit 提交接口 */ exports.Commit = { /** * 从文件创建 commit * * @link https://docs.gitlab.com/ee/api/commits.html#create-a-commit-with-multiple-files-and-actions */ CreateWithAction: (projectId) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/repository/commits`, method: 'POST', }), }; /** * MR 提交接口 */ exports.MR = { /** * 创建 MR * * @link https://docs.gitlab.com/ee/api/merge_requests.html#create-mr */ CreateWithBranch: (projectId) => ({ url: `${BaseUrl}/projects/${encodeURIComponent(projectId)}/merge_requests`, method: 'POST', }), }; //# sourceMappingURL=constant.js.map