Files
plane/web/ee/services/integrations/gitlab/data.service.ts
Saurabh Kumar 13cefcbc3b [SILO-28] Chore: Gitlab integration UI and backend changes (#2071)
* 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
2025-01-02 13:19:26 +05:30

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;
});
}