zhaoyingbo 3f220f7943
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 29s
CI Monitor CI/CD / deploy (push) Successful in 34s
style: 优化项目结构
2024-07-24 10:35:50 +00:00

25 lines
707 B
TypeScript

import { Gitlab } from "../../types/gitlab";
import netTool from "../netTool";
import { GITLAB_AUTH_HEADER, GITLAB_BASE_URL, gitlabReqWarp } from "./tools";
/**
* 获取 GitLab 项目的详细信息。
* @param project_id - 项目的 ID 或 URL-encoded 路径。
* @returns 一个解析为项目详细信息的 promise。
*/
const getDetail = async (project_id: number | string) => {
if (typeof project_id === "string")
project_id = encodeURIComponent(project_id);
const URL = `${GITLAB_BASE_URL}/projects/${project_id}`;
return gitlabReqWarp<Gitlab.ProjDetail>(
() => netTool.get(URL, {}, GITLAB_AUTH_HEADER),
null
);
};
const project = {
getDetail,
};
export default project;