import netTool from "../netTool" import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools" /** * 获取指定项目中某个文件的内容。 * @param {number} project_id - 项目ID。 * @param {string} path - 文件路径。 * @param {string} ref - 分支或标签名称。 * @returns {Promise} 返回包含文件内容的Promise。 */ const getFileContent = async ( project_id: number, path: string, ref: string ) => { const URL = `${GITLAB_BASE_URL}/projects/${project_id}/repository/files/${encodeURIComponent(path)}/raw?ref=${ref}` return gitlabReqWarp( () => netTool.get(URL, {}, GITLAB_AUTH_HEADER), "" ) } const repository = { getFileContent, } export default repository