from typing import Any from app.git.provider import GitProvider from app.git.types import ConnectionStatus, ProviderKind class GitLabAdapter(GitProvider): BASE_URL = "https://gitlab.com/api/v4" def get_kind(self) -> ProviderKind: return ProviderKind.gitlab def _get_headers(self, token: str) -> dict[str, str]: return {"Authorization": f"Bearer {token}"} def _extract_project_path(self, git_url: str) -> str: path = git_url.replace("https://gitlab.com/", "") path = path.replace("git@gitlab.com:", "") path = path.replace(".git", "") return path def validate_connection(self, git_url: str, credential_id: str) -> ConnectionStatus: return ConnectionStatus.connected def list_repositories(self, credential_id: str) -> list[dict[str, Any]]: return [] def create_deploy_key(self, git_url: str, public_key: str) -> str: return "" def delete_deploy_key(self, git_url: str, deploy_key_id: str) -> None: return def get_default_branch(self, git_url: str, credential_id: str) -> str: return "main"