api

package
v0.0.0-...-1b76672 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 22, 2025 License: Apache-2.0 Imports: 34 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SetupRoutes

func SetupRoutes(router *gin.Engine, database *db.Database, logger *logrus.Logger)

Types

type ActivityHandlers

type ActivityHandlers struct {
	// contains filtered or unexported fields
}

ActivityHandlers contains handlers for activity-related endpoints

func NewActivityHandlers

func NewActivityHandlers(repositoryService services.RepositoryService, activityService services.ActivityService, db *gorm.DB, logger *logrus.Logger) *ActivityHandlers

NewActivityHandlers creates a new activity handlers instance

func (*ActivityHandlers) GetRepositoryActivity

func (h *ActivityHandlers) GetRepositoryActivity(c *gin.Context)

GetRepositoryActivity handles GET /api/v1/repositories/{owner}/{repo}/activity

func (*ActivityHandlers) GetRepositoryContributors

func (h *ActivityHandlers) GetRepositoryContributors(c *gin.Context)

GetRepositoryContributors handles GET /api/v1/repositories/{owner}/{repo}/contributors

func (*ActivityHandlers) GetRepositorySubscription

func (h *ActivityHandlers) GetRepositorySubscription(c *gin.Context)

GetRepositorySubscription handles GET /api/v1/repositories/{owner}/{repo}/subscription

func (*ActivityHandlers) UnwatchRepository

func (h *ActivityHandlers) UnwatchRepository(c *gin.Context)

UnwatchRepository handles DELETE /api/v1/repositories/{owner}/{repo}/subscription

func (*ActivityHandlers) WatchRepository

func (h *ActivityHandlers) WatchRepository(c *gin.Context)

WatchRepository handles PUT /api/v1/repositories/{owner}/{repo}/subscription

type AdminEmailHandlers

type AdminEmailHandlers struct {
	// contains filtered or unexported fields
}

AdminEmailHandlers contains handlers for admin email-related endpoints

func NewAdminEmailHandlers

func NewAdminEmailHandlers(db *gorm.DB, cfg *config.Config, logger *logrus.Logger) *AdminEmailHandlers

NewAdminEmailHandlers creates a new admin email handlers instance

func (*AdminEmailHandlers) GetEmailConfig

func (h *AdminEmailHandlers) GetEmailConfig(c *gin.Context)

GetEmailConfig handles GET /api/v1/admin/email/config

func (*AdminEmailHandlers) GetEmailHealth

func (h *AdminEmailHandlers) GetEmailHealth(c *gin.Context)

GetEmailHealth handles GET /api/v1/admin/email/health

func (*AdminEmailHandlers) GetEmailLogs

func (h *AdminEmailHandlers) GetEmailLogs(c *gin.Context)

GetEmailLogs handles GET /api/v1/admin/email/logs

func (*AdminEmailHandlers) TestEmailConfig

func (h *AdminEmailHandlers) TestEmailConfig(c *gin.Context)

TestEmailConfig handles POST /api/v1/admin/email/test

func (*AdminEmailHandlers) UpdateEmailConfig

func (h *AdminEmailHandlers) UpdateEmailConfig(c *gin.Context)

UpdateEmailConfig handles PUT /api/v1/admin/email/config

type AdminHandlers

type AdminHandlers struct {
	// contains filtered or unexported fields
}

AdminHandlers contains handlers for admin-related endpoints

func NewAdminHandlers

func NewAdminHandlers(authService auth.AuthService, db *gorm.DB, logger *logrus.Logger) *AdminHandlers

NewAdminHandlers creates a new admin handlers instance

func (*AdminHandlers) CreateUser

func (h *AdminHandlers) CreateUser(c *gin.Context)

CreateUser handles POST /api/v1/admin/users

func (*AdminHandlers) DeleteUser

func (h *AdminHandlers) DeleteUser(c *gin.Context)

DeleteUser handles DELETE /api/v1/admin/users/:id

func (*AdminHandlers) DisableUser

func (h *AdminHandlers) DisableUser(c *gin.Context)

DisableUser handles POST /api/v1/admin/users/:id/disable

func (*AdminHandlers) EnableUser

func (h *AdminHandlers) EnableUser(c *gin.Context)

EnableUser handles POST /api/v1/admin/users/:id/enable

func (*AdminHandlers) GetUser

func (h *AdminHandlers) GetUser(c *gin.Context)

GetUser handles GET /api/v1/admin/users/:id

func (*AdminHandlers) GetUserStats

func (h *AdminHandlers) GetUserStats(c *gin.Context)

GetUserStats handles GET /api/v1/admin/users/stats

func (*AdminHandlers) ListUsers

func (h *AdminHandlers) ListUsers(c *gin.Context)

ListUsers handles GET /api/v1/admin/users

func (*AdminHandlers) SetUserRole

func (h *AdminHandlers) SetUserRole(c *gin.Context)

SetUserRole handles PATCH /api/v1/admin/users/:id/role

func (*AdminHandlers) UpdateUser

func (h *AdminHandlers) UpdateUser(c *gin.Context)

UpdateUser handles PATCH /api/v1/admin/users/:id

type AdminUserResponse

type AdminUserResponse struct {
	ID               uuid.UUID  `json:"id"`
	Username         string     `json:"username"`
	Email            string     `json:"email"`
	FullName         string     `json:"full_name"`
	AvatarURL        string     `json:"avatar_url"`
	Bio              string     `json:"bio"`
	Location         string     `json:"location"`
	Website          string     `json:"website"`
	Company          string     `json:"company"`
	EmailVerified    bool       `json:"email_verified"`
	TwoFactorEnabled bool       `json:"two_factor_enabled"`
	IsActive         bool       `json:"is_active"`
	IsAdmin          bool       `json:"is_admin"`
	CreatedAt        time.Time  `json:"created_at"`
	UpdatedAt        time.Time  `json:"updated_at"`
	LastLoginAt      *time.Time `json:"last_login_at"`
	PhoneNumber      string     `json:"phone_number"`
	Type             string     `json:"type"`
}

AdminUserResponse represents the user data returned by admin endpoints

type AnalyticsHandlers

type AnalyticsHandlers struct {
	// contains filtered or unexported fields
}

AnalyticsHandlers contains handlers for analytics-related endpoints

func NewAnalyticsHandlers

func NewAnalyticsHandlers(analyticsService services.AnalyticsService, logger *logrus.Logger, db *gorm.DB) *AnalyticsHandlers

NewAnalyticsHandlers creates a new analytics handlers instance

func (*AnalyticsHandlers) ExportAnalytics

func (h *AnalyticsHandlers) ExportAnalytics(c *gin.Context)

ExportAnalytics handles GET /api/v1/admin/analytics/export

func (*AnalyticsHandlers) GetCostAnalytics

func (h *AnalyticsHandlers) GetCostAnalytics(c *gin.Context)

GetCostAnalytics handles GET /api/v1/admin/analytics/costs

func (*AnalyticsHandlers) GetOrganizationAnalytics

func (h *AnalyticsHandlers) GetOrganizationAnalytics(c *gin.Context)

GetOrganizationAnalytics handles GET /api/v1/organizations/:org/analytics/overview

func (*AnalyticsHandlers) GetOrganizationMembers

func (h *AnalyticsHandlers) GetOrganizationMembers(c *gin.Context)

GetOrganizationMembers handles GET /api/v1/organizations/:org/analytics/members

func (*AnalyticsHandlers) GetOrganizationRepositories

func (h *AnalyticsHandlers) GetOrganizationRepositories(c *gin.Context)

GetOrganizationRepositories handles GET /api/v1/organizations/:org/analytics/repositories

func (*AnalyticsHandlers) GetOrganizationSecurity

func (h *AnalyticsHandlers) GetOrganizationSecurity(c *gin.Context)

GetOrganizationSecurity handles GET /api/v1/organizations/:org/analytics/security

func (*AnalyticsHandlers) GetOrganizationTeams

func (h *AnalyticsHandlers) GetOrganizationTeams(c *gin.Context)

GetOrganizationTeams handles GET /api/v1/organizations/:org/analytics/teams

func (*AnalyticsHandlers) GetPerformanceAnalytics

func (h *AnalyticsHandlers) GetPerformanceAnalytics(c *gin.Context)

GetPerformanceAnalytics handles GET /api/v1/admin/analytics/performance

func (*AnalyticsHandlers) GetPlatformAnalytics

func (h *AnalyticsHandlers) GetPlatformAnalytics(c *gin.Context)

GetPlatformAnalytics handles GET /api/v1/admin/analytics/platform

func (*AnalyticsHandlers) GetPublicUserAnalytics

func (h *AnalyticsHandlers) GetPublicUserAnalytics(c *gin.Context)

GetPublicUserAnalytics handles GET /api/v1/users/:username/analytics/public

func (*AnalyticsHandlers) GetRepositoryActivity

func (h *AnalyticsHandlers) GetRepositoryActivity(c *gin.Context)

GetRepositoryActivity handles GET /api/v1/repositories/:owner/:repo/analytics/activity

func (*AnalyticsHandlers) GetRepositoryAnalytics

func (h *AnalyticsHandlers) GetRepositoryAnalytics(c *gin.Context)

GetRepositoryAnalytics handles GET /api/v1/repositories/:owner/:repo/analytics

func (*AnalyticsHandlers) GetRepositoryCodeStats

func (h *AnalyticsHandlers) GetRepositoryCodeStats(c *gin.Context)

GetRepositoryCodeStats handles GET /api/v1/repositories/:owner/:repo/analytics/code-stats

func (*AnalyticsHandlers) GetRepositoryContributors

func (h *AnalyticsHandlers) GetRepositoryContributors(c *gin.Context)

GetRepositoryContributors handles GET /api/v1/repositories/:owner/:repo/analytics/contributors

func (*AnalyticsHandlers) GetRepositoryIssues

func (h *AnalyticsHandlers) GetRepositoryIssues(c *gin.Context)

GetRepositoryIssues handles GET /api/v1/repositories/:owner/:repo/analytics/issues

func (*AnalyticsHandlers) GetRepositoryPerformance

func (h *AnalyticsHandlers) GetRepositoryPerformance(c *gin.Context)

GetRepositoryPerformance handles GET /api/v1/repositories/:owner/:repo/analytics/performance

func (*AnalyticsHandlers) GetRepositoryPulls

func (h *AnalyticsHandlers) GetRepositoryPulls(c *gin.Context)

GetRepositoryPulls handles GET /api/v1/repositories/:owner/:repo/analytics/pulls

func (*AnalyticsHandlers) GetUsageAnalytics

func (h *AnalyticsHandlers) GetUsageAnalytics(c *gin.Context)

GetUsageAnalytics handles GET /api/v1/admin/analytics/usage

func (*AnalyticsHandlers) GetUserAnalytics

func (h *AnalyticsHandlers) GetUserAnalytics(c *gin.Context)

GetUserAnalytics handles GET /api/v1/user/analytics/activity

func (*AnalyticsHandlers) GetUserContributions

func (h *AnalyticsHandlers) GetUserContributions(c *gin.Context)

GetUserContributions handles GET /api/v1/user/analytics/contributions

func (*AnalyticsHandlers) GetUserRepositories

func (h *AnalyticsHandlers) GetUserRepositories(c *gin.Context)

GetUserRepositories handles GET /api/v1/user/analytics/repositories

func (*AnalyticsHandlers) RecordEvent

func (h *AnalyticsHandlers) RecordEvent(c *gin.Context)

RecordEvent handles POST /api/v1/analytics/events (internal)

func (*AnalyticsHandlers) RecordMetric

func (h *AnalyticsHandlers) RecordMetric(c *gin.Context)

RecordMetric handles POST /api/v1/analytics/metrics (internal)

func (*AnalyticsHandlers) RecordPerformanceLog

func (h *AnalyticsHandlers) RecordPerformanceLog(c *gin.Context)

RecordPerformanceLog handles POST /api/v1/analytics/performance (internal)

type AuthHandlers

type AuthHandlers struct {
	// contains filtered or unexported fields
}

func NewAuthHandlers

func NewAuthHandlers(authService auth.AuthService, oauthService *auth.OAuthService, mfaService *auth.MFAService) *AuthHandlers

func (*AuthHandlers) DisableMFA

func (h *AuthHandlers) DisableMFA(c *gin.Context)

POST /api/v1/auth/mfa/disable

func (*AuthHandlers) ForgotPassword

func (h *AuthHandlers) ForgotPassword(c *gin.Context)

POST /api/v1/auth/forgot-password

func (*AuthHandlers) Login

func (h *AuthHandlers) Login(c *gin.Context)

POST /api/v1/auth/login

func (*AuthHandlers) Logout

func (h *AuthHandlers) Logout(c *gin.Context)

POST /api/v1/auth/logout

func (*AuthHandlers) OAuthCallback

func (h *AuthHandlers) OAuthCallback(c *gin.Context)

GET /api/v1/auth/oauth/{provider}/callback

func (*AuthHandlers) OAuthRedirect

func (h *AuthHandlers) OAuthRedirect(c *gin.Context)

GET /api/v1/auth/oauth/{provider}

func (*AuthHandlers) RefreshToken

func (h *AuthHandlers) RefreshToken(c *gin.Context)

POST /api/v1/auth/refresh

func (*AuthHandlers) RegenerateBackupCodes

func (h *AuthHandlers) RegenerateBackupCodes(c *gin.Context)

POST /api/v1/auth/mfa/regenerate-codes

func (*AuthHandlers) Register

func (h *AuthHandlers) Register(c *gin.Context)

POST /api/v1/auth/register

func (*AuthHandlers) ResetPassword

func (h *AuthHandlers) ResetPassword(c *gin.Context)

POST /api/v1/auth/reset-password

func (*AuthHandlers) SetupMFA

func (h *AuthHandlers) SetupMFA(c *gin.Context)

POST /api/v1/auth/mfa/setup

func (*AuthHandlers) VerifyEmail

func (h *AuthHandlers) VerifyEmail(c *gin.Context)

POST /api/v1/auth/verify-email

func (*AuthHandlers) VerifyMFA

func (h *AuthHandlers) VerifyMFA(c *gin.Context)

POST /api/v1/auth/mfa/verify

type BranchProtection

type BranchProtection struct {
	URL                           string                      `json:"url"`
	RequiredStatusChecks          *RequiredStatusChecks       `json:"required_status_checks"`
	RequiredPullRequestReviews    *RequiredPullRequestReviews `json:"required_pull_request_reviews"`
	EnforceAdmins                 bool                        `json:"enforce_admins"`
	Restrictions                  *BranchRestrictions         `json:"restrictions"`
	RequireLinearHistory          bool                        `json:"require_linear_history"`
	AllowForcePushes              bool                        `json:"allow_force_pushes"`
	AllowDeletions                bool                        `json:"allow_deletions"`
	RequireConversationResolution bool                        `json:"require_conversation_resolution"`
}

BranchProtection represents branch protection rules

type BranchProtectionHandlers

type BranchProtectionHandlers struct {
	// contains filtered or unexported fields
}

BranchProtectionHandlers contains handlers for branch protection-related endpoints

func NewBranchProtectionHandlers

func NewBranchProtectionHandlers(repositoryService services.RepositoryService, branchService services.BranchService, logger *logrus.Logger) *BranchProtectionHandlers

NewBranchProtectionHandlers creates a new branch protection handlers instance

func (*BranchProtectionHandlers) DeleteBranchProtection

func (h *BranchProtectionHandlers) DeleteBranchProtection(c *gin.Context)

DeleteBranchProtection handles DELETE /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection

func (*BranchProtectionHandlers) DeleteRequiredPullRequestReviews

func (h *BranchProtectionHandlers) DeleteRequiredPullRequestReviews(c *gin.Context)

DeleteRequiredPullRequestReviews handles DELETE /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews

func (*BranchProtectionHandlers) DeleteRequiredStatusChecks

func (h *BranchProtectionHandlers) DeleteRequiredStatusChecks(c *gin.Context)

DeleteRequiredStatusChecks handles DELETE /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_status_checks

func (*BranchProtectionHandlers) GetBranchProtection

func (h *BranchProtectionHandlers) GetBranchProtection(c *gin.Context)

GetBranchProtection handles GET /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection

func (*BranchProtectionHandlers) GetRequiredPullRequestReviews

func (h *BranchProtectionHandlers) GetRequiredPullRequestReviews(c *gin.Context)

GetRequiredPullRequestReviews handles GET /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews

func (*BranchProtectionHandlers) GetRequiredStatusChecks

func (h *BranchProtectionHandlers) GetRequiredStatusChecks(c *gin.Context)

GetRequiredStatusChecks handles GET /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_status_checks

func (*BranchProtectionHandlers) UpdateBranchProtection

func (h *BranchProtectionHandlers) UpdateBranchProtection(c *gin.Context)

UpdateBranchProtection handles PUT /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection

func (*BranchProtectionHandlers) UpdateRequiredPullRequestReviews

func (h *BranchProtectionHandlers) UpdateRequiredPullRequestReviews(c *gin.Context)

UpdateRequiredPullRequestReviews handles PATCH /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_pull_request_reviews

func (*BranchProtectionHandlers) UpdateRequiredStatusChecks

func (h *BranchProtectionHandlers) UpdateRequiredStatusChecks(c *gin.Context)

UpdateRequiredStatusChecks handles PATCH /api/v1/repositories/{owner}/{repo}/branches/{branch}/protection/required_status_checks

type BranchRestrictions

type BranchRestrictions struct {
	Users []gin.H `json:"users"`
	Teams []gin.H `json:"teams"`
	Apps  []gin.H `json:"apps"`
}

BranchRestrictions represents branch access restrictions

type CreateSSHKeyRequest

type CreateSSHKeyRequest struct {
	Title   string `json:"title" binding:"required"`
	KeyData string `json:"key_data" binding:"required"`
}

CreateSSHKeyRequest represents a request to create an SSH key

type DeployKey

type DeployKey struct {
	ID        int       `json:"id"`
	Key       string    `json:"key"`
	URL       string    `json:"url"`
	Title     string    `json:"title"`
	Verified  bool      `json:"verified"`
	CreatedAt time.Time `json:"created_at"`
	ReadOnly  bool      `json:"read_only"`
}

DeployKey represents a repository deploy key

type ExportHandlers

type ExportHandlers struct {
	// contains filtered or unexported fields
}

ExportHandlers handles repository export endpoints and enqueues jobs.

func NewExportHandlers

func NewExportHandlers(database *db.Database) *ExportHandlers

NewExportHandlers creates a new ExportHandlers with database access.

func (*ExportHandlers) GetExportStatus

func (h *ExportHandlers) GetExportStatus(c *gin.Context)

func (*ExportHandlers) InitiateExport

func (h *ExportHandlers) InitiateExport(c *gin.Context)

InitiateExport starts an export job to an external Git service.

type GitHandlers

type GitHandlers struct {
	// contains filtered or unexported fields
}

GitHandlers contains handlers for Git HTTP protocol endpoints

func NewGitHandlers

func NewGitHandlers(repositoryService services.RepositoryService, logger *logrus.Logger, jwtManager *auth.JWTManager) *GitHandlers

NewGitHandlers creates a new Git handlers instance

func (*GitHandlers) GitMiddleware

func (h *GitHandlers) GitMiddleware() gin.HandlerFunc

GitMiddleware adds Git-specific headers and logging

func (*GitHandlers) InfoRefs

func (h *GitHandlers) InfoRefs(c *gin.Context)

InfoRefs handles GET /{owner}/{repo.git}/info/refs

func (*GitHandlers) ReceivePack

func (h *GitHandlers) ReceivePack(c *gin.Context)

ReceivePack handles POST /{owner}/{repo.git}/git-receive-pack

func (*GitHandlers) UploadPack

func (h *GitHandlers) UploadPack(c *gin.Context)

UploadPack handles POST /{owner}/{repo.git}/git-upload-pack

type HooksHandlers

type HooksHandlers struct {
	// contains filtered or unexported fields
}

HooksHandlers contains handlers for webhook-related endpoints

func NewHooksHandlers

func NewHooksHandlers(repositoryService services.RepositoryService, webhookDeliveryService *services.WebhookDeliveryService, deployKeyService *services.DeployKeyService, logger *logrus.Logger) *HooksHandlers

NewHooksHandlers creates a new hooks handlers instance

func (*HooksHandlers) CreateDeployKey

func (h *HooksHandlers) CreateDeployKey(c *gin.Context)

CreateDeployKey handles POST /api/v1/repositories/{owner}/{repo}/keys

func (*HooksHandlers) CreateWebhook

func (h *HooksHandlers) CreateWebhook(c *gin.Context)

CreateWebhook handles POST /api/v1/repositories/{owner}/{repo}/hooks

func (*HooksHandlers) DeleteDeployKey

func (h *HooksHandlers) DeleteDeployKey(c *gin.Context)

DeleteDeployKey handles DELETE /api/v1/repositories/{owner}/{repo}/keys/{key_id}

func (*HooksHandlers) DeleteWebhook

func (h *HooksHandlers) DeleteWebhook(c *gin.Context)

DeleteWebhook handles DELETE /api/v1/repositories/{owner}/{repo}/hooks/{hook_id}

func (*HooksHandlers) GetDeployKey

func (h *HooksHandlers) GetDeployKey(c *gin.Context)

GetDeployKey handles GET /api/v1/repositories/{owner}/{repo}/keys/{key_id}

func (*HooksHandlers) GetWebhook

func (h *HooksHandlers) GetWebhook(c *gin.Context)

GetWebhook handles GET /api/v1/repositories/{owner}/{repo}/hooks/{hook_id}

func (*HooksHandlers) ListDeployKeys

func (h *HooksHandlers) ListDeployKeys(c *gin.Context)

ListDeployKeys handles GET /api/v1/repositories/{owner}/{repo}/keys

func (*HooksHandlers) ListWebhooks

func (h *HooksHandlers) ListWebhooks(c *gin.Context)

ListWebhooks handles GET /api/v1/repositories/{owner}/{repo}/hooks

func (*HooksHandlers) PingWebhook

func (h *HooksHandlers) PingWebhook(c *gin.Context)

PingWebhook handles POST /api/v1/repositories/{owner}/{repo}/hooks/{hook_id}/pings

func (*HooksHandlers) UpdateWebhook

func (h *HooksHandlers) UpdateWebhook(c *gin.Context)

UpdateWebhook handles PATCH /api/v1/repositories/{owner}/{repo}/hooks/{hook_id}

type ImportHandlers

type ImportHandlers struct {
	// contains filtered or unexported fields
}

ImportHandlers handles repository import endpoints and enqueues jobs.

func NewImportHandlers

func NewImportHandlers(database *db.Database) *ImportHandlers

NewImportHandlers creates a new ImportHandlers with database access.

func (*ImportHandlers) GetImportStatus

func (h *ImportHandlers) GetImportStatus(c *gin.Context)

GetImportStatus returns the status of an import job.

func (*ImportHandlers) InitiateImport

func (h *ImportHandlers) InitiateImport(c *gin.Context)

InitiateImport starts an import job from an external Git service.

type LFSHandlers

type LFSHandlers struct {
	// contains filtered or unexported fields
}

LFSHandlers provides Git LFS endpoint handlers. Implements basic Git LFS Batch, Upload, Download, and Verify using storage backends.

func NewLFSHandlers

func NewLFSHandlers(cfg config.LFS, repoBasePath string) (*LFSHandlers, error)

NewLFSHandlers creates a new LFSHandlers with the given LFS config and repository base path. repoBasePath is used as the root for filesystem-based LFS storage.

func (*LFSHandlers) Batch

func (h *LFSHandlers) Batch(c *gin.Context)

Batch handles Git LFS batch API requests (upload/download actions).

func (*LFSHandlers) Download

func (h *LFSHandlers) Download(c *gin.Context)

Download handles Git LFS object download requests (streams raw content).

func (*LFSHandlers) Upload

func (h *LFSHandlers) Upload(c *gin.Context)

Upload handles Git LFS object upload requests (POST with raw content).

func (*LFSHandlers) Verify

func (h *LFSHandlers) Verify(c *gin.Context)

Verify handles Git LFS object existence verification (HEAD request).

type OrganizationAdvancedHandlers

type OrganizationAdvancedHandlers struct {
	// contains filtered or unexported fields
}

Organization Advanced Handlers

func (*OrganizationAdvancedHandlers) CreateCustomRole

func (h *OrganizationAdvancedHandlers) CreateCustomRole(c *gin.Context)

Custom Roles Handlers

func (*OrganizationAdvancedHandlers) CreatePolicy

func (h *OrganizationAdvancedHandlers) CreatePolicy(c *gin.Context)

Policy Handlers

func (*OrganizationAdvancedHandlers) CreateTeamFromTemplate

func (h *OrganizationAdvancedHandlers) CreateTeamFromTemplate(c *gin.Context)

Team Template Handlers

func (*OrganizationAdvancedHandlers) DeleteCustomRole

func (h *OrganizationAdvancedHandlers) DeleteCustomRole(c *gin.Context)

func (*OrganizationAdvancedHandlers) DeletePolicy

func (h *OrganizationAdvancedHandlers) DeletePolicy(c *gin.Context)

func (*OrganizationAdvancedHandlers) ExportActivities

func (h *OrganizationAdvancedHandlers) ExportActivities(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetActivitiesWithFilters

func (h *OrganizationAdvancedHandlers) GetActivitiesWithFilters(c *gin.Context)

Audit Handlers

func (*OrganizationAdvancedHandlers) GetAuditSummary

func (h *OrganizationAdvancedHandlers) GetAuditSummary(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetCustomRole

func (h *OrganizationAdvancedHandlers) GetCustomRole(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetDashboardMetrics

func (h *OrganizationAdvancedHandlers) GetDashboardMetrics(c *gin.Context)

Analytics Handlers

func (*OrganizationAdvancedHandlers) GetMemberActivityMetrics

func (h *OrganizationAdvancedHandlers) GetMemberActivityMetrics(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetPolicy

func (h *OrganizationAdvancedHandlers) GetPolicy(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetRepositoryUsageMetrics

func (h *OrganizationAdvancedHandlers) GetRepositoryUsageMetrics(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetRetentionPolicyStatus

func (h *OrganizationAdvancedHandlers) GetRetentionPolicyStatus(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetSecurityMetrics

func (h *OrganizationAdvancedHandlers) GetSecurityMetrics(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetTeamPerformanceMetrics

func (h *OrganizationAdvancedHandlers) GetTeamPerformanceMetrics(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetTeamPerformanceMetricsForTeam

func (h *OrganizationAdvancedHandlers) GetTeamPerformanceMetricsForTeam(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetTeamTemplates

func (h *OrganizationAdvancedHandlers) GetTeamTemplates(c *gin.Context)

func (*OrganizationAdvancedHandlers) GetUsageAndCostMetrics

func (h *OrganizationAdvancedHandlers) GetUsageAndCostMetrics(c *gin.Context)

func (*OrganizationAdvancedHandlers) ListCustomRoles

func (h *OrganizationAdvancedHandlers) ListCustomRoles(c *gin.Context)

func (*OrganizationAdvancedHandlers) ListPolicies

func (h *OrganizationAdvancedHandlers) ListPolicies(c *gin.Context)

func (*OrganizationAdvancedHandlers) SearchActivities

func (h *OrganizationAdvancedHandlers) SearchActivities(c *gin.Context)

func (*OrganizationAdvancedHandlers) UpdateCustomRole

func (h *OrganizationAdvancedHandlers) UpdateCustomRole(c *gin.Context)

func (*OrganizationAdvancedHandlers) UpdatePolicy

func (h *OrganizationAdvancedHandlers) UpdatePolicy(c *gin.Context)

type OwnerInfo

type OwnerInfo struct {
	ID        uuid.UUID `json:"id"`
	Username  string    `json:"username"`
	Type      string    `json:"type"`
	AvatarURL *string   `json:"avatar_url,omitempty"`
}

OwnerInfo represents repository owner information

type PluginHandlers

type PluginHandlers struct {
	// contains filtered or unexported fields
}

PluginHandlers handles HTTP requests for plugin operations.

func NewPluginHandlers

func NewPluginHandlers(s services.PluginService) *PluginHandlers

NewPluginHandlers constructs handlers for plugin endpoints.

func (*PluginHandlers) InstallOrgPlugin

func (h *PluginHandlers) InstallOrgPlugin(c *gin.Context)

InstallOrgPlugin installs a plugin for an organization.

func (*PluginHandlers) InstallRepoPlugin

func (h *PluginHandlers) InstallRepoPlugin(c *gin.Context)

InstallRepoPlugin installs a plugin for a repository.

func (*PluginHandlers) ListPlugins

func (h *PluginHandlers) ListPlugins(c *gin.Context)

ListPlugins returns the plugin marketplace.

func (*PluginHandlers) UninstallOrgPlugin

func (h *PluginHandlers) UninstallOrgPlugin(c *gin.Context)

UninstallOrgPlugin removes a plugin from an organization.

func (*PluginHandlers) UninstallRepoPlugin

func (h *PluginHandlers) UninstallRepoPlugin(c *gin.Context)

UninstallRepoPlugin removes a plugin from a repository.

type PullRequestHandlers

type PullRequestHandlers struct {
	// contains filtered or unexported fields
}

func NewPullRequestHandlers

func NewPullRequestHandlers(service services.PullRequestService, logger *logrus.Logger) *PullRequestHandlers

func (*PullRequestHandlers) CreatePullRequest

func (h *PullRequestHandlers) CreatePullRequest(c *gin.Context)

CreatePullRequest handles POST /api/v1/repositories/:owner/:repo/pulls

func (*PullRequestHandlers) GetPullRequest

func (h *PullRequestHandlers) GetPullRequest(c *gin.Context)

GetPullRequest handles GET /api/v1/repositories/:owner/:repo/pulls/:number

func (*PullRequestHandlers) ListPullRequests

func (h *PullRequestHandlers) ListPullRequests(c *gin.Context)

ListPullRequests handles GET /api/v1/repositories/:owner/:repo/pulls

func (*PullRequestHandlers) MergePullRequest

func (h *PullRequestHandlers) MergePullRequest(c *gin.Context)

MergePullRequest handles POST /api/v1/repositories/:owner/:repo/pulls/:number/merge

func (*PullRequestHandlers) UpdatePullRequest

func (h *PullRequestHandlers) UpdatePullRequest(c *gin.Context)

UpdatePullRequest handles PATCH /api/v1/repositories/:owner/:repo/pulls/:number

type RepositoryHandlers

type RepositoryHandlers struct {
	// contains filtered or unexported fields
}

RepositoryHandlers contains handlers for repository-related endpoints

func NewRepositoryHandlers

func NewRepositoryHandlers(repositoryService services.RepositoryService, branchService services.BranchService, gitService git.GitService, logger *logrus.Logger, db *gorm.DB) *RepositoryHandlers

NewRepositoryHandlers creates a new repository handlers instance

func (*RepositoryHandlers) CheckStarred

func (h *RepositoryHandlers) CheckStarred(c *gin.Context)

CheckStarred handles GET /api/v1/repositories/{owner}/{repo}/star

func (*RepositoryHandlers) CompareBranches

func (h *RepositoryHandlers) CompareBranches(c *gin.Context)

CompareBranches handles GET /api/v1/repositories/{owner}/{repo}/compare/{base}...{head}

func (*RepositoryHandlers) CreateBranch

func (h *RepositoryHandlers) CreateBranch(c *gin.Context)

CreateBranch handles POST /api/v1/repositories/{owner}/{repo}/branches

func (*RepositoryHandlers) CreateFile

func (h *RepositoryHandlers) CreateFile(c *gin.Context)

CreateFile handles POST /api/v1/repositories/{owner}/{repo}/contents/{path}

func (*RepositoryHandlers) CreateGitHook

func (h *RepositoryHandlers) CreateGitHook(c *gin.Context)

CreateGitHook handles POST /api/v1/repositories/{owner}/{repo}/hooks

func (*RepositoryHandlers) CreateRepository

func (h *RepositoryHandlers) CreateRepository(c *gin.Context)

CreateRepository handles POST /api/v1/repositories

func (*RepositoryHandlers) CreateTemplate

func (h *RepositoryHandlers) CreateTemplate(c *gin.Context)

CreateTemplate handles POST /api/v1/repositories/{owner}/{repo}/template

func (*RepositoryHandlers) DeleteBranch

func (h *RepositoryHandlers) DeleteBranch(c *gin.Context)

DeleteBranch handles DELETE /api/v1/repositories/{owner}/{repo}/branches/{branch}

func (*RepositoryHandlers) DeleteFile

func (h *RepositoryHandlers) DeleteFile(c *gin.Context)

DeleteFile handles DELETE /api/v1/repositories/{owner}/{repo}/contents/{path}

func (*RepositoryHandlers) DeleteGitHook

func (h *RepositoryHandlers) DeleteGitHook(c *gin.Context)

DeleteGitHook handles DELETE /api/v1/repositories/{owner}/{repo}/hooks/{hookId}

func (*RepositoryHandlers) DeleteRepository

func (h *RepositoryHandlers) DeleteRepository(c *gin.Context)

DeleteRepository handles DELETE /api/v1/repositories/{owner}/{repo}

func (*RepositoryHandlers) ForkRepository

func (h *RepositoryHandlers) ForkRepository(c *gin.Context)

ForkRepository handles POST /api/v1/repositories/{owner}/{repo}/fork

func (*RepositoryHandlers) GetBranch

func (h *RepositoryHandlers) GetBranch(c *gin.Context)

GetBranch handles GET /api/v1/repositories/{owner}/{repo}/branches/{branch}

func (*RepositoryHandlers) GetBranches

func (h *RepositoryHandlers) GetBranches(c *gin.Context)

GetBranches handles GET /api/v1/repositories/{owner}/{repo}/branches

func (*RepositoryHandlers) GetCommit

func (h *RepositoryHandlers) GetCommit(c *gin.Context)

GetCommit handles GET /api/v1/repositories/{owner}/{repo}/commits/{sha}

func (*RepositoryHandlers) GetCommits

func (h *RepositoryHandlers) GetCommits(c *gin.Context)

GetCommits handles GET /api/v1/repositories/{owner}/{repo}/commits

func (*RepositoryHandlers) GetFile

func (h *RepositoryHandlers) GetFile(c *gin.Context)

GetFile handles GET /api/v1/repositories/{owner}/{repo}/contents/{path} (for files)

func (*RepositoryHandlers) GetGitHooks

func (h *RepositoryHandlers) GetGitHooks(c *gin.Context)

GetGitHooks handles GET /api/v1/repositories/{owner}/{repo}/hooks

func (*RepositoryHandlers) GetMergeBase

func (h *RepositoryHandlers) GetMergeBase(c *gin.Context)

GetMergeBase handles GET /api/v1/repositories/{owner}/{repo}/compare/{base}...HEAD

func (*RepositoryHandlers) GetRepository

func (h *RepositoryHandlers) GetRepository(c *gin.Context)

GetRepository handles GET /api/v1/repositories/{owner}/{repo}

func (*RepositoryHandlers) GetRepositoryInfo

func (h *RepositoryHandlers) GetRepositoryInfo(c *gin.Context)

GetRepositoryInfo handles GET /api/v1/repositories/{owner}/{repo}/info

func (*RepositoryHandlers) GetRepositoryLanguages

func (h *RepositoryHandlers) GetRepositoryLanguages(c *gin.Context)

GetRepositoryLanguages handles GET /api/v1/repositories/{owner}/{repo}/languages

func (*RepositoryHandlers) GetRepositorySettings

func (h *RepositoryHandlers) GetRepositorySettings(c *gin.Context)

GetRepositorySettings handles GET /api/v1/repositories/{owner}/{repo}/settings

func (*RepositoryHandlers) GetRepositoryStatistics

func (h *RepositoryHandlers) GetRepositoryStatistics(c *gin.Context)

GetRepositoryStatistics handles GET /api/v1/repositories/{owner}/{repo}/stats

func (*RepositoryHandlers) GetRepositoryStats

func (h *RepositoryHandlers) GetRepositoryStats(c *gin.Context)

GetRepositoryStats handles GET /api/v1/repositories/{owner}/{repo}/stats

func (*RepositoryHandlers) GetRepositoryTags

func (h *RepositoryHandlers) GetRepositoryTags(c *gin.Context)

GetRepositoryTags handles GET /api/v1/repositories/{owner}/{repo}/tags

func (*RepositoryHandlers) GetTemplates

func (h *RepositoryHandlers) GetTemplates(c *gin.Context)

GetTemplates handles GET /api/v1/templates

func (*RepositoryHandlers) GetTree

func (h *RepositoryHandlers) GetTree(c *gin.Context)

GetTree handles GET /api/v1/repositories/{owner}/{repo}/contents/{path}

func (*RepositoryHandlers) ListRepositories

func (h *RepositoryHandlers) ListRepositories(c *gin.Context)

ListRepositories handles GET /api/v1/repositories

func (*RepositoryHandlers) StarRepository

func (h *RepositoryHandlers) StarRepository(c *gin.Context)

StarRepository handles PUT /api/v1/repositories/{owner}/{repo}/star

func (*RepositoryHandlers) TransferRepository

func (h *RepositoryHandlers) TransferRepository(c *gin.Context)

TransferRepository handles POST /api/v1/repositories/{owner}/{repo}/transfer

func (*RepositoryHandlers) UnstarRepository

func (h *RepositoryHandlers) UnstarRepository(c *gin.Context)

UnstarRepository handles DELETE /api/v1/repositories/{owner}/{repo}/star

func (*RepositoryHandlers) UpdateFile

func (h *RepositoryHandlers) UpdateFile(c *gin.Context)

UpdateFile handles PUT /api/v1/repositories/{owner}/{repo}/contents/{path}

func (*RepositoryHandlers) UpdateGitHook

func (h *RepositoryHandlers) UpdateGitHook(c *gin.Context)

UpdateGitHook handles PUT /api/v1/repositories/{owner}/{repo}/hooks/{hookId}

func (*RepositoryHandlers) UpdateRepository

func (h *RepositoryHandlers) UpdateRepository(c *gin.Context)

UpdateRepository handles PATCH /api/v1/repositories/{owner}/{repo}

func (*RepositoryHandlers) UpdateRepositorySettings

func (h *RepositoryHandlers) UpdateRepositorySettings(c *gin.Context)

UpdateRepositorySettings handles PUT /api/v1/repositories/{owner}/{repo}/settings

func (*RepositoryHandlers) UpdateRepositoryStats

func (h *RepositoryHandlers) UpdateRepositoryStats(c *gin.Context)

UpdateRepositoryStats handles POST /api/v1/repositories/{owner}/{repo}/stats/update

func (*RepositoryHandlers) UseTemplate

func (h *RepositoryHandlers) UseTemplate(c *gin.Context)

UseTemplate handles POST /api/v1/templates/{templateId}/use

type RepositoryResponse

type RepositoryResponse struct {
	models.Repository
	FullName        string     `json:"full_name"`
	Owner           *OwnerInfo `json:"owner,omitempty"`
	Private         bool       `json:"private"`
	Fork            bool       `json:"fork"`
	Language        *string    `json:"language,omitempty"`
	StargazersCount int        `json:"stargazers_count"`
	ForksCount      int        `json:"forks_count"`
	WatchersCount   int        `json:"watchers_count"`
	OpenIssuesCount int        `json:"open_issues_count"`
	CloneURL        string     `json:"clone_url"`
	SSHURL          string     `json:"ssh_url"`
	Size            int64      `json:"size"`
	PushedAt        *string    `json:"pushed_at,omitempty"`
}

RepositoryResponse represents a repository with additional fields for API responses

type RequiredPullRequestReviews

type RequiredPullRequestReviews struct {
	DismissStaleReviews          bool                `json:"dismiss_stale_reviews"`
	RequireCodeOwnerReviews      bool                `json:"require_code_owner_reviews"`
	RequiredApprovingReviewCount int                 `json:"required_approving_review_count"`
	RequireLastPushApproval      bool                `json:"require_last_push_approval"`
	DismissalRestrictions        *BranchRestrictions `json:"dismissal_restrictions,omitempty"`
}

RequiredPullRequestReviews represents required pull request reviews configuration

type RequiredStatusChecks

type RequiredStatusChecks struct {
	Strict   bool     `json:"strict"`
	Contexts []string `json:"contexts"`
}

RequiredStatusChecks represents required status checks configuration

type SSHKeyHandlers

type SSHKeyHandlers struct {
	// contains filtered or unexported fields
}

SSHKeyHandlers handles SSH key related operations

func NewSSHKeyHandlers

func NewSSHKeyHandlers(db *gorm.DB, logger *logrus.Logger) *SSHKeyHandlers

NewSSHKeyHandlers creates a new SSH key handlers instance

func (*SSHKeyHandlers) CreateSSHKey

func (h *SSHKeyHandlers) CreateSSHKey(c *gin.Context)

CreateSSHKey handles POST /api/v1/user/keys

func (*SSHKeyHandlers) DeleteSSHKey

func (h *SSHKeyHandlers) DeleteSSHKey(c *gin.Context)

DeleteSSHKey handles DELETE /api/v1/user/keys/:id

func (*SSHKeyHandlers) GetSSHKey

func (h *SSHKeyHandlers) GetSSHKey(c *gin.Context)

GetSSHKey handles GET /api/v1/user/keys/:id

func (*SSHKeyHandlers) ListSSHKeys

func (h *SSHKeyHandlers) ListSSHKeys(c *gin.Context)

ListSSHKeys handles GET /api/v1/user/keys

type SSHKeyResponse

type SSHKeyResponse struct {
	ID          uuid.UUID  `json:"id"`
	Title       string     `json:"title"`
	Fingerprint string     `json:"fingerprint"`
	KeyType     string     `json:"key_type"`
	LastUsedAt  *time.Time `json:"last_used_at"`
	CreatedAt   time.Time  `json:"created_at"`
}

SSHKeyResponse represents an SSH key response

type SearchHandlers

type SearchHandlers struct {
	// contains filtered or unexported fields
}

func NewSearchHandlers

func NewSearchHandlers(searchService *services.SearchService, logger *logrus.Logger) *SearchHandlers

func (*SearchHandlers) GlobalSearch

func (h *SearchHandlers) GlobalSearch(c *gin.Context)

GlobalSearch handles GET /api/v1/search

type UserCreateRequest

type UserCreateRequest struct {
	Username    string `json:"username" binding:"required,min=3,max=50"`
	Email       string `json:"email" binding:"required,email"`
	Password    string `json:"password" binding:"required,min=12"`
	FullName    string `json:"full_name" binding:"required,min=1,max=255"`
	Bio         string `json:"bio,omitempty"`
	Location    string `json:"location,omitempty"`
	Website     string `json:"website,omitempty"`
	Company     string `json:"company,omitempty"`
	PhoneNumber string `json:"phone_number,omitempty"`
	IsAdmin     bool   `json:"is_admin,omitempty"`
}

UserCreateRequest represents the request body for creating a user

type UserHandlers

type UserHandlers struct {
	// contains filtered or unexported fields
}

UserHandlers contains handlers for user-related endpoints UserHandlers contains handlers for user-related endpoints

func NewUserHandlers

func NewUserHandlers(
	authService auth.AuthService,
	db *gorm.DB,
	cfg *config.Config,
	logger *logrus.Logger,
	notificationService services.NotificationService,
) *UserHandlers

NewUserHandlers creates a new user handlers instance NewUserHandlers creates a new user handlers instance

func (*UserHandlers) GetCurrentUserProfile

func (h *UserHandlers) GetCurrentUserProfile(c *gin.Context)

GetCurrentUserProfile handles GET /api/v1/user

func (*UserHandlers) GetEmailPreferences

func (h *UserHandlers) GetEmailPreferences(c *gin.Context)

GetEmailPreferences handles GET /api/v1/user/email/preferences

func (*UserHandlers) GetEmailVerificationStatus

func (h *UserHandlers) GetEmailVerificationStatus(c *gin.Context)

GetEmailVerificationStatus handles GET /api/v1/user/email/verification-status

func (*UserHandlers) GetNotifications

func (h *UserHandlers) GetNotifications(c *gin.Context)

GetNotifications handles GET /api/v1/notifications

func (*UserHandlers) GetUserActivity

func (h *UserHandlers) GetUserActivity(c *gin.Context)

GetUserActivity handles GET /api/v1/user/activity

func (*UserHandlers) GetUserOrganizations

func (h *UserHandlers) GetUserOrganizations(c *gin.Context)

GetUserOrganizations handles GET /api/v1/users/{username}/organizations

func (*UserHandlers) GetUserProfile

func (h *UserHandlers) GetUserProfile(c *gin.Context)

GetUserProfile handles GET /api/v1/users/{username}

func (*UserHandlers) GetUserRepositories

func (h *UserHandlers) GetUserRepositories(c *gin.Context)

GetUserRepositories handles GET /api/v1/users/{username}/repositories

func (*UserHandlers) MarkNotificationsAsRead

func (h *UserHandlers) MarkNotificationsAsRead(c *gin.Context)

MarkNotificationsAsRead handles PATCH /api/v1/notifications

func (*UserHandlers) ResendEmailVerification

func (h *UserHandlers) ResendEmailVerification(c *gin.Context)

ResendEmailVerification handles POST /api/v1/user/email/resend-verification

func (*UserHandlers) SubscribeNotifications

func (h *UserHandlers) SubscribeNotifications(c *gin.Context)

SubscribeNotifications upgrades connection to WebSocket and streams real-time notifications

func (*UserHandlers) UpdateEmailPreferences

func (h *UserHandlers) UpdateEmailPreferences(c *gin.Context)

UpdateEmailPreferences handles PUT /api/v1/user/email/preferences

func (*UserHandlers) UpdateUserProfile

func (h *UserHandlers) UpdateUserProfile(c *gin.Context)

UpdateUserProfile handles PATCH /api/v1/user

type UserQueryParams

type UserQueryParams struct {
	Page    int    `form:"page,default=1"`
	PerPage int    `form:"per_page,default=30"`
	Search  string `form:"search"`
	Role    string `form:"role"`
	Status  string `form:"status"`
	SortBy  string `form:"sort_by,default=created_at"`
	SortDir string `form:"sort_dir,default=desc"`
}

UserQueryParams represents query parameters for user listing and filtering

type UserUpdateRequest

type UserUpdateRequest struct {
	FullName    *string `json:"full_name,omitempty"`
	Email       *string `json:"email,omitempty"`
	Bio         *string `json:"bio,omitempty"`
	Location    *string `json:"location,omitempty"`
	Website     *string `json:"website,omitempty"`
	Company     *string `json:"company,omitempty"`
	AvatarURL   *string `json:"avatar_url,omitempty"`
	PhoneNumber *string `json:"phone_number,omitempty"`
	IsActive    *bool   `json:"is_active,omitempty"`
	IsAdmin     *bool   `json:"is_admin,omitempty"`
}

UserUpdateRequest represents the request body for updating a user

type Webhook

type Webhook struct {
	ID           int                    `json:"id"`
	Name         string                 `json:"name"`
	Config       map[string]interface{} `json:"config"`
	Events       []string               `json:"events"`
	Active       bool                   `json:"active"`
	CreatedAt    time.Time              `json:"created_at"`
	UpdatedAt    time.Time              `json:"updated_at"`
	PingURL      string                 `json:"ping_url,omitempty"`
	TestURL      string                 `json:"test_url,omitempty"`
	LastResponse *WebhookResponse       `json:"last_response,omitempty"`
}

Webhook represents a repository webhook

type WebhookResponse

type WebhookResponse struct {
	Code    int    `json:"code"`
	Status  string `json:"status"`
	Message string `json:"message,omitempty"`
}

WebhookResponse represents a webhook delivery response

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL