gitlabClient.js 830 B

123456789101112131415161718192021222324
  1. const RequestTool = require("../config/requestTool");
  2. class GitlabApi {
  3. static getAllProjetsByUserId(userId) {
  4. const path = GitlabApi.buildServerPath('/api/project/allProjects/' + userId);
  5. return RequestTool.req(path, null, RequestTool.GET);
  6. }
  7. static getCommitsByGitlabProjectId(gitlabProjectId) {
  8. const path = GitlabApi.buildGitlabPath(`/projects/${gitlabProjectId}/repository/commits`)+'&all=true';
  9. return RequestTool.req(path, null, RequestTool.GET);
  10. }
  11. static buildServerPath(relativePath) {
  12. return `https://seecoder-gitlab-server.seec.seecoder.cn/${relativePath}`
  13. }
  14. static buildGitlabPath(relativePath) {
  15. const token = '4KxFBJkxKoHZvEa-JmAx';
  16. return `https://seecoder-gitlab-gitlab.seec.seecoder.cn/api/v4/${relativePath}?private_token=${token}`
  17. }
  18. }
  19. module.exports = GitlabApi;