gitlab

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2026 License: MIT Imports: 11 Imported by: 1

Documentation

Overview

Package gitlab implements the provider interface for GitLab.

This package provides GitLab-specific API integration for repository operations including listing, cloning, and group management.

Features

  • Repository listing (group and user)
  • Subgroup support (flat and nested modes)
  • Custom SSH port configuration
  • Self-hosted instance support
  • Token validation

Usage

provider, err := gitlab.NewProvider(token, "https://gitlab.example.com")
repos, err := provider.ListOrganizationRepos(ctx, "mygroup")

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Provider

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

Provider implements the provider.Provider interface for GitLab.

func NewProvider

func NewProvider(token, baseURL string) (*Provider, error)

NewProvider creates a new GitLab provider.

func NewProviderWithOptions

func NewProviderWithOptions(opts ProviderOptions) (*Provider, error)

NewProviderWithOptions creates a new GitLab provider with custom options.

func (*Provider) CreatePullRequest

CreatePullRequest creates a GitLab merge request.

func (*Provider) FindPullRequest

func (p *Provider) FindPullRequest(ctx context.Context, owner, repo, head, base string) (*provider.PullRequest, error)

FindPullRequest returns the open MR for head/base, or ErrPullRequestNotFound.

func (*Provider) GetRateLimit

func (p *Provider) GetRateLimit(ctx context.Context) (*provider.RateLimit, error)

GetRateLimit returns current rate limit status GitLab doesn't have a dedicated rate limit API, so we return estimated values.

func (*Provider) GetRepository

func (p *Provider) GetRepository(ctx context.Context, owner, repo string) (*provider.Repository, error)

GetRepository gets a single repository from GitLab.

func (*Provider) ListOrganizationRepos

func (p *Provider) ListOrganizationRepos(ctx context.Context, group string) ([]*provider.Repository, error)

ListOrganizationRepos lists all repositories in a GitLab group.

func (*Provider) ListOrganizations

func (p *Provider) ListOrganizations(ctx context.Context) ([]*provider.Organization, error)

ListOrganizations lists groups the authenticated user belongs to.

func (*Provider) ListUserRepos

func (p *Provider) ListUserRepos(ctx context.Context, user string) ([]*provider.Repository, error)

ListUserRepos lists all repositories for a user.

func (*Provider) Name

func (p *Provider) Name() string

Name returns the provider name.

func (*Provider) SSHPort

func (p *Provider) SSHPort() int

SSHPort returns the configured custom SSH port (0 means the default, 22). It makes the SSH-port wiring observable so callers/tests can confirm the port survived provider construction — the field that historically drifted between the forge-sync and doctor provider-creation paths.

func (*Provider) SetToken

func (p *Provider) SetToken(token string) error

SetToken sets the authentication token.

func (*Provider) ValidateToken

func (p *Provider) ValidateToken(ctx context.Context) (bool, error)

ValidateToken validates the current token.

type ProviderOptions

type ProviderOptions struct {
	Token   string
	BaseURL string // API endpoint (http/https only)
	SSHPort int    // Custom SSH port (0 = default 22)
}

ProviderOptions configures the GitLab Provider.

Jump to

Keyboard shortcuts

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