| 123456789101112131415161718192021222324 |
- const RequestTool = require("../config/requestTool");
- class GitlabApi {
- static getAllProjetsByUserId(userId) {
- const path = GitlabApi.buildServerPath('/api/project/allProjects/' + userId);
- return RequestTool.req(path, null, RequestTool.GET);
- }
- static getCommitsByGitlabProjectId(gitlabProjectId) {
- const path = GitlabApi.buildGitlabPath(`/projects/${gitlabProjectId}/repository/commits`)+'&all=true';
- return RequestTool.req(path, null, RequestTool.GET);
- }
- static buildServerPath(relativePath) {
- return `https://seecoder-gitlab-server.seec.seecoder.cn/${relativePath}`
- }
- static buildGitlabPath(relativePath) {
- const token = '4KxFBJkxKoHZvEa-JmAx';
- return `https://seecoder-gitlab-gitlab.seec.seecoder.cn/api/v4/${relativePath}?private_token=${token}`
- }
- }
- module.exports = GitlabApi;
|