zhaoyingbo 18a95387ee
All checks were successful
CI Monitor CI/CD / build-image (push) Successful in 33s
CI Monitor CI/CD / deploy (push) Successful in 37s
chore: 更新lint-staged和commitlint配置
2024-07-25 01:09:24 +00:00

25 lines
698 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