-
Notifications
You must be signed in to change notification settings - Fork 1
Description
Summary
This refactor unifies repository endpoints for all supported Git providers (GitHub, GitLab, Bitbucket) and introduces a dynamic, map-based multi-provider service for repository operations. The API and backend logic are now provider-agnostic and easier to extend.
Details
API Changes
- Replaced all provider-specific endpoints with two generic endpoints:
GET /api/v1/repositories— List repositories (requiresgitServerandowner, optionalrepoName)GET /api/v1/repository— Get repository details (requiresgitServer,owner, andrepoName)
- All parameters are now query parameters.
- Response schemas are now provider-agnostic.
Handler Refactor
- Removed provider-specific handlers (GitHub, GitLab, Bitbucket).
- Added a single
RepositoryHandlerto handle all repository-related requests for all providers. - Updated server wiring to use the new handler and endpoints.
Multi-Provider Service
- Added a
MultiProviderServicethat uses a map to dispatch repository operations to the correct provider implementation (GitHubService,GitlabService,BitbucketService) based on theGitProviderfield inGitProviderSettings. - Follows the Strategy pattern for extensibility and maintainability.
Supporting Changes
- Deprecated and replaced all provider-specific handler files.
- Updated handler registration and server construction to use the new multi-provider service.
Motivation
- Simplifies the API for clients.
- Reduces code duplication and maintenance overhead.
- Makes it easy to add support for new providers in the future.
- Follows Go best practices and the Strategy design pattern.