Skip to content

Unify Repository Endpoints and Add Multi-Provider Support #15

@zmotso

Description

@zmotso

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 (requires gitServer and owner, optional repoName)
    • GET /api/v1/repository — Get repository details (requires gitServer, owner, and repoName)
  • All parameters are now query parameters.
  • Response schemas are now provider-agnostic.

Handler Refactor

  • Removed provider-specific handlers (GitHub, GitLab, Bitbucket).
  • Added a single RepositoryHandler to handle all repository-related requests for all providers.
  • Updated server wiring to use the new handler and endpoints.

Multi-Provider Service

  • Added a MultiProviderService that uses a map to dispatch repository operations to the correct provider implementation (GitHubService, GitlabService, BitbucketService) based on the GitProvider field in GitProviderSettings.
  • 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.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions