mirror of
https://github.com/makeplane/plane.git
synced 2026-07-13 22:09:12 +02:00
* chore: gitlab integration add project and group APIs * entity connection schema changes + gitlab integration UI and store changes * gitlab integration UI + APIs for entity connections * Merge branch 'preview' into chore-gitlab_integration_ui * Merge branch 'preview' into chore-gitlab_integration_ui * gitlab webhook * sharedwithgroups key in gitlab merge request type * chore: gitlab update issue based on project connection * chore: gitlab integration * merged with preview * merged with preview * yarn fix
41 lines
1.2 KiB
TypeScript
41 lines
1.2 KiB
TypeScript
import axios, { AxiosInstance } from "axios";
|
|
// plane web types
|
|
import { TGitlabRepository } from "@/plane-web/types/integrations/gitlab";
|
|
import { IGitlabEntity } from "@plane/etl/gitlab";
|
|
|
|
export class GitlabDataService {
|
|
protected baseURL: string;
|
|
private axiosInstance: AxiosInstance;
|
|
|
|
constructor(baseURL: string) {
|
|
this.baseURL = baseURL;
|
|
this.axiosInstance = axios.create({ baseURL });
|
|
}
|
|
|
|
/**
|
|
* @description fetch gitlab repositories
|
|
* @param { string } workspaceId
|
|
* @returns { Promise<TGitlabRepository[] | undefined> }
|
|
*/
|
|
fetchGitlabRepositories = async (workspaceId: string): Promise<TGitlabRepository[] | undefined | undefined> =>
|
|
await this.axiosInstance
|
|
.get(`/api/gitlab/${workspaceId}/repos`)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
|
|
/**
|
|
* @description fetch gitlab entities
|
|
* @param { string } workspaceId
|
|
* @returns { Promise<IGitlabEntity[]> }
|
|
*/
|
|
fetchGitlabEntities = async (workspaceId: string): Promise<IGitlabEntity[]> =>
|
|
await this.axiosInstance
|
|
.get(`/api/gitlab/entities/${workspaceId}`)
|
|
.then((res) => res.data)
|
|
.catch((error) => {
|
|
throw error?.response?.data;
|
|
});
|
|
}
|